[help needed] Проблема с компиляцией (Linux)

Не компилится? Не соединяется? Показывает пургу?
Post Reply
mkf
Posts: 25
Joined: Sun Oct 25, 2015 7:11 am
Location: Russia, Tomsk City
Contact:

Проблема с компиляцией (Linux)

Post by mkf » Mon Oct 26, 2015 8:00 am

Скачал последние исходники через SVN.
Инсталировал arm-none-eabi-gcc :
  • Using built-in specs.
    COLLECT_GCC=arm-none-eabi-gcc
    COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-none-eabi/5.2.0/lto-wrapper
    Target: arm-none-eabi
    Configured with: /build/arm-none-eabi-gcc/src/gcc-5.2.0/configure --target=arm-none-eabi --prefix=/usr --with-sysroot=/usr/arm-none-eabi --with-native-system-header-dir=/include --libexecdir=/usr/lib --enable-languages=c,c++ --enable-plugins --disable-decimal-float --disable-libffi --disable-libgomp --disable-libmudflap --disable-libquadmath --disable-libssp --disable-libstdcxx-pch --disable-nls --disable-shared --disable-threads --disable-tls --with-gnu-as --with-gnu-ld --with-system-zlib --with-newlib --with-headers=/usr/arm-none-eabi/include --with-python-dir=share/gcc-arm-none-eabi --with-gmp --with-mpfr --with-mpc --with-isl --with-libelf --enable-gnu-indirect-function --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --with-pkgversion='Arch Repository' --with-bugurl=https://bugs.archlinux.org/ --with-multilib-list=armv6-m,armv7-m,armv7e-m,armv7-r
    Thread model: single
    gcc version 5.2.0 (Arch Repository)
версия make:
  • GNU Make 4.1
    Эта программа собрана для x86_64-unknown-linux-gnu
    Copyright (C) 1988-2014 Free Software Foundation, Inc.
    Лицензия GPLv3+: GNU GPL версии 3 или новее <http://gnu.org/licenses/gpl.html>
    Это свободное программное обеспечение: вы можете свободно изменять его и
    распространять. НЕТ НИКАКИХ ГАРАНТИЙ вне пределов, допустимых законом.
Попытка собрать проект из консоли закончилась не удачно. Объектные файлы создались. Дальше проблемка (последние строки в консоли):
  • Compiling rusefi.cpp
    Compiling main.cpp
    Linking build/rusefi.elf
    /usr/lib/gcc/arm-none-eabi/5.2.0/../../../../arm-none-eabi/lib/armv7e-m/softfp/libc.a(lib_a-sbrkr.o): In function `_sbrk_r':
    sbrkr.c:(.text._sbrk_r+0xc): undefined reference to `_sbrk'
    collect2: error: ld returned 1 exit status
    chibios/os/ports/GCC/ARMCMx/rules.mk:210: ошибка выполнения рецепта для цели «build/rusefi.elf»
    make: *** [build/rusefi.elf] Ошибка 1
Потупил полдня, гуру гугл не помог. Какие-то проблемы с динамической памятью, но чего сделать не понял. Поставил eclipse с plug-ins для ARM. Помучался с настройками, т.к. проект создан под Windows (eclipse запускал cs-make вместо make, в настройках вместо "..\config\stm32f4ems\STM32F407xG_CCM.ld" вписал "../config/stm32f4ems/STM32F407xG_CCM.ld" стало компилироваться, то сборка завершилась аналогично с такой же ошибкой):
  • 13:17:28 **** Incremental Build of configuration Debug_EMS for project firmware ****
    Info: Internal Builder is used for build
    .........................................
    .........................................
    /usr/lib/gcc/arm-none-eabi/5.2.0/../../../../arm-none-eabi/lib/armv7e-m/softfp/libg.a(lib_a-sbrkr.o): In function `_sbrk_r':
    sbrkr.c:(.text._sbrk_r+0xc): undefined reference to `_sbrk'
    collect2: error: ld returned 1 exit status


    13:17:32 Build Finished (took 3s.769ms)
В итоге не понимаю чего делать и в какую сторону копать.Завис одним словом.

User avatar
russian
Site Admin
Posts: 9518
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Soldering skill: yes
Coding skill?: yes
Contact:

Re: Проблема с компиляцией (Linux)

Post by russian » Mon Oct 26, 2015 11:27 am

Динамической памяти у нас нет и методы высоко уровня типа _sbrk нам не нужны. Это шайтан вокруг настроек линковщика вероятно, я два года назад добился счастья и забыл. Странно, что это всплыло у тебя - видимо достаточно другая версия компилятора :( Точнее другие стандартные библиотеки?

Например https://balau82.wordpress.com/2010/12/1 ... -programs/ советует --disable-newlib-supplied-syscalls

Есть ли вариант попробовать другой компилятор? Есть ли вариант на Windows попробовать? Я сам не использую linux для всего этого, но я знаю, что несколько человек успешно компилируют.
https://rusefi.com/s/howtocontribute
very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions
my skype is arro239

mkf
Posts: 25
Joined: Sun Oct 25, 2015 7:11 am
Location: Russia, Tomsk City
Contact:

Re: Проблема с компиляцией (Linux)

Post by mkf » Mon Oct 26, 2015 12:14 pm

windows-а нету. Извел его как класс.
Версии компилятора и библиотек:
arm-none-eabi-gcc 5.2.0-1
arm-none-eabi-gdb 7.10-2
arm-none-eabi-newlib 2.2.0-4
openocd 1:0.9.0-1
Поиски привели к функциям типа printf. Я так понял много народу с ними бьются.
Последние рецепты советуют подключить файлик затычку - syscalls.c. Только я не понимаю чему он нужен и чем это грозит (отвалится вывод в консоль? или зависнет?)

С ключем --disable-newlib-supplied-syscalls не компилится, хотя может я не туда его пишу

User avatar
russian
Site Admin
Posts: 9518
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Soldering skill: yes
Coding skill?: yes
Contact:

Re: Проблема с компиляцией (Linux)

Post by russian » Mon Oct 26, 2015 2:08 pm

Функцию printf arm-версия прошивки кажется не использует.

http://crapcan-am.com:8080/job/rusEfi/ публично доступные логи успешной компиляции на убунту, например

Code: Select all

ARM GCC
Using built-in specs.
COLLECT_GCC=arm-none-eabi-gcc
COLLECT_LTO_WRAPPER=/opt/ARM/bin/../lib/gcc/arm-none-eabi/4.8.3/lto-wrapper
Target: arm-none-eabi
Configured with: /home/build/work/GCC-4-8-build/src/gcc/configure --target=arm-none-eabi --prefix=/home/build/work/GCC-4-8-build/install-native --libexecdir=/home/build/work/GCC-4-8-build/install-native/lib --infodir=/home/build/work/GCC-4-8-build/install-native/share/doc/gcc-arm-none-eabi/info --mandir=/home/build/work/GCC-4-8-build/install-native/share/doc/gcc-arm-none-eabi/man --htmldir=/home/build/work/GCC-4-8-build/install-native/share/doc/gcc-arm-none-eabi/html --pdfdir=/home/build/work/GCC-4-8-build/install-native/share/doc/gcc-arm-none-eabi/pdf --enable-languages=c,c++ --enable-plugins --disable-decimal-float --disable-libffi --disable-libgomp --disable-libmudflap --disable-libquadmath --disable-libssp --disable-libstdcxx-pch --disable-nls --disable-shared --disable-threads --disable-tls --with-gnu-as --with-gnu-ld --with-newlib --with-headers=yes --with-python-dir=share/gcc-arm-none-eabi --with-sysroot=/home/build/work/GCC-4-8-build/install-native/arm-none-eabi --build=i686-linux-gnu --host=i686-linux-gnu --with-gmp=/home/build/work/GCC-4-8-build/build-native/host-libs/usr --with-mpfr=/home/build/work/GCC-4-8-build/build-native/host-libs/usr --with-mpc=/home/build/work/GCC-4-8-build/build-native/host-libs/usr --with-isl=/home/build/work/GCC-4-8-build/build-native/host-libs/usr --with-cloog=/home/build/work/GCC-4-8-build/build-native/host-libs/usr --with-libelf=/home/build/work/GCC-4-8-build/build-native/host-libs/usr --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --with-pkgversion='GNU Tools for ARM Embedded Processors' --with-multilib-list=armv6-m,armv7-m,armv7e-m,armv7-r
Thread model: single
gcc version 4.8.3 20131129 (release) [ARM/embedded-4_8-branch revision 205641] (GNU Tools for ARM Embedded Processors) 
https://rusefi.com/s/howtocontribute
very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions
my skype is arro239

User avatar
russian
Site Admin
Posts: 9518
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Soldering skill: yes
Coding skill?: yes
Contact:

Re: Проблема с компиляцией (Linux)

Post by russian » Mon Oct 26, 2015 2:09 pm

предлагаю попробовать версию поближе к 4.8.3
https://rusefi.com/s/howtocontribute
very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions
my skype is arro239

mkf
Posts: 25
Joined: Sun Oct 25, 2015 7:11 am
Location: Russia, Tomsk City
Contact:

Re: Проблема с компиляцией (Linux)

Post by mkf » Mon Oct 26, 2015 2:47 pm

попробовал сборку
http://www.mentor.com/embedded-software ... e-edition/
версия 4.9.3
результат аналогичен
  • /usr/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv7e-m/softfp/libg.a(lib_a-sbrkr.o): In function `_sbrk_r':
    sbrkr.c:(.text._sbrk_r+0xc): undefined reference to `_sbrk'
    collect2: error: ld returned 1 exit status
буду пробовать еще более старую

mkf
Posts: 25
Joined: Sun Oct 25, 2015 7:11 am
Location: Russia, Tomsk City
Contact:

Re: Проблема с компиляцией (Linux)

Post by mkf » Mon Oct 26, 2015 3:38 pm

Вау! не прошло двух дней :)

Code: Select all

arm-none-eabi-g++ -mcpu=cortex-m4 -mthumb -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -O0 -fmessage-length=0 -ffunction-sections -fdata-sections -flto -g3 -T ../config/stm32f4ems/STM32F407xG_CCM.ld -Xlinker --gc-sections -Wl,-Map,rusefi.map -Wl,-Map,rusefi.map -mcpu=cortex-m4 -mthumb -g3 -o rusefi.elf chibios/boards/ST_STM32F4_DISCOVERY/board.o chibios/ext/fatfs/src/ff.o chibios/ext/fatfs/src/option/ccsbcs.o chibios/os/hal/platforms/STM32/GPIOv2/pal_lld.o chibios/os/hal/platforms/STM32/I2Cv1/i2c_lld.o chibios/os/hal/platforms/STM32/OTGv1/usb_lld.o chibios/os/hal/platforms/STM32/RTCv2/rtc_lld.o chibios/os/hal/platforms/STM32/SPIv1/spi_lld.o chibios/os/hal/platforms/STM32/TIMv1/gpt_lld.o chibios/os/hal/platforms/STM32/TIMv1/icu_lld.o chibios/os/hal/platforms/STM32/TIMv1/pwm_lld.o chibios/os/hal/platforms/STM32/USARTv1/serial_lld.o chibios/os/hal/platforms/STM32/USARTv1/uart_lld.o chibios/os/hal/platforms/STM32/can_lld.o chibios/os/hal/platforms/STM32/ext_lld.o chibios/os/hal/platforms/STM32/i2s_lld.o chibios/os/hal/platforms/STM32/mac_lld.o chibios/os/hal/platforms/STM32/sdc_lld.o chibios/os/hal/platforms/STM32F4xx/adc_lld.o chibios/os/hal/platforms/STM32F4xx/ext_lld_isr.o chibios/os/hal/platforms/STM32F4xx/hal_lld.o chibios/os/hal/platforms/STM32F4xx/stm32_dma.o chibios/os/hal/src/adc.o chibios/os/hal/src/can.o chibios/os/hal/src/ext.o chibios/os/hal/src/gpt.o chibios/os/hal/src/hal.o chibios/os/hal/src/i2c.o chibios/os/hal/src/icu.o chibios/os/hal/src/mac.o chibios/os/hal/src/mmc_spi.o chibios/os/hal/src/mmcsd.o chibios/os/hal/src/pal.o chibios/os/hal/src/pwm.o chibios/os/hal/src/rtc.o chibios/os/hal/src/sdc.o chibios/os/hal/src/serial.o chibios/os/hal/src/serial_usb.o chibios/os/hal/src/spi.o chibios/os/hal/src/tm.o chibios/os/hal/src/uart.o chibios/os/hal/src/usb.o chibios/os/kernel/src/chcond.o chibios/os/kernel/src/chdebug.o chibios/os/kernel/src/chdynamic.o chibios/os/kernel/src/chevents.o chibios/os/kernel/src/chheap.o chibios/os/kernel/src/chlists.o chibios/os/kernel/src/chmboxes.o chibios/os/kernel/src/chmemcore.o chibios/os/kernel/src/chmempools.o chibios/os/kernel/src/chmsg.o chibios/os/kernel/src/chmtx.o chibios/os/kernel/src/chqueues.o chibios/os/kernel/src/chregistry.o chibios/os/kernel/src/chschd.o chibios/os/kernel/src/chsem.o chibios/os/kernel/src/chsys.o chibios/os/kernel/src/chthreads.o chibios/os/kernel/src/chvt.o chibios/os/ports/GCC/ARMCMx/STM32F4xx/vectors.o chibios/os/ports/GCC/ARMCMx/chcore.o chibios/os/ports/GCC/ARMCMx/chcore_v7m.o chibios/os/ports/GCC/ARMCMx/crt0.o chibios/os/ports/common/ARMCMx/nvic.o chibios/os/various/chprintf.o chibios/os/various/chrtclib.o chibios/os/various/cpp_wrappers/ch.o chibios/os/various/fatfs_bindings/fatfs_diskio.o chibios/os/various/fatfs_bindings/fatfs_syscall.o chibios/os/various/memstreams.o config/engines/GY6_139QMB.o config/engines/MiniCooperR50.o config/engines/acura_rsx.o config/engines/audi_aan.o config/engines/bmw_e34.o config/engines/chevrolet_camaro_4.o config/engines/citroenBerlingoTU3JP.o config/engines/custom_engine.o config/engines/daihatsu.o config/engines/dodge_neon.o config/engines/dodge_ram.o config/engines/dodge_stratus.o config/engines/ford_1995_inline_6.o config/engines/ford_aspire.o config/engines/ford_fiesta.o config/engines/gm_2_2.o config/engines/honda_accord.o config/engines/mazda_323.o config/engines/mazda_626.o config/engines/mazda_miata.o config/engines/mazda_miata_nb.o config/engines/mitsubishi.o config/engines/nissan_primera.o config/engines/rover_v8.o config/engines/sachs.o config/engines/saturn_ion.o config/engines/snow_blower.o config/engines/subaru.o config/engines/suzuki_vitara.o config/engines/test_engine.o config/engines/vw.o console/binary/tunerstudio.o console/binary/tunerstudio_io.o console/console_io.o console/eficonsole.o console/status_loop.o console_util/rfiutil.o controllers/PwmTester.o controllers/algo/accel_enrichment.o controllers/algo/advance_map.o controllers/algo/algo.o controllers/algo/auto_generated_enums.o controllers/algo/engine.o controllers/algo/engine_configuration.o controllers/algo/event_registry.o controllers/algo/fuel_math.o controllers/algo/idle_controller.o controllers/algo/lcd_menu_tree.o controllers/algo/malfunction_central.o controllers/algo/map_adjuster.o controllers/algo/nmea.o controllers/algo/signal_executor.o controllers/alternatorController.o controllers/core/EfiWave.o controllers/core/avg_values.o controllers/core/fsio_core.o controllers/core/fsio_impl.o controllers/core/interpolation.o controllers/core/signal_filtering.o controllers/core/table_helper.o controllers/electronic_throttle.o controllers/engine_controller.o controllers/error_handling.o controllers/flash_main.o controllers/idle_thread.o controllers/injector_central.o controllers/lcd_controller.o controllers/malfunction_indicator.o controllers/map_averaging.o controllers/math/engine_math.o controllers/math/pid.o controllers/math/speed_density.o controllers/obd2.o controllers/obd2viaCAN.o controllers/sensors/allsensors.o controllers/sensors/ego.o controllers/sensors/hip9011_lookup.o controllers/sensors/maf.o controllers/sensors/map.o controllers/sensors/thermistors.o controllers/sensors/tps.o controllers/sensors/voltage.o controllers/settings.o controllers/system/SingleTimerExecutor.o controllers/system/efiGpio.o controllers/system/event_queue.o controllers/system/pwm_generator_logic.o controllers/system/signal_executor_sleep.o controllers/tachometer.o controllers/trigger/main_trigger_callback.o controllers/trigger/rpm_calculator.o controllers/trigger/trigger_bmw.o controllers/trigger/trigger_central.o controllers/trigger/trigger_chrysler.o controllers/trigger/trigger_decoder.o controllers/trigger/trigger_emulator_algo.o controllers/trigger/trigger_gm.o controllers/trigger/trigger_mazda.o controllers/trigger/trigger_mitsubishi.o controllers/trigger/trigger_nissan.o controllers/trigger/trigger_simulator.o controllers/trigger/trigger_structure.o controllers/trigger/trigger_subaru.o development/engine_emulator.o development/engine_sniffer.o development/hw_layer/poten.o development/rfi_perftest.o development/sensor_chart.o development/test/test.o development/test/testbmk.o development/trigger_emulator.o development/wave_analyzer.o hw_layer/HIP9011.o hw_layer/adc_inputs.o hw_layer/board_test.o hw_layer/can_hw.o hw_layer/digital_input_hw.o hw_layer/flash.o hw_layer/gpio_helper.o hw_layer/hardware.o hw_layer/io_pins.o hw_layer/joystick.o hw_layer/lcd/lcd_HD44780.o hw_layer/max31855.o hw_layer/mcp3208.o hw_layer/microsecond_timer.o hw_layer/mmc_card.o hw_layer/neo6m.o hw_layer/pin_repository.o hw_layer/pwm_generator.o hw_layer/rtc_helper.o hw_layer/serial_over_usb/usbcfg.o hw_layer/serial_over_usb/usbconsole.o hw_layer/servo.o hw_layer/stepper.o hw_layer/stm32f4/mpu_util.o hw_layer/trigger_input.o hw_layer/vehicle_speed.o hw_layer/wbo.o kill_for_coverity.o main.o rusefi.o util/LocalVersionHolder.o util/cli_registry.o util/crc.o util/cyclic_buffer.o util/data_buffer.o util/datalogging.o util/efilib.o util/efilib2.o util/histogram.o util/listener_array.o util/loggingcentral.o 
arm-none-eabi-objcopy -O ihex rusefi.elf rusefi.hex 
arm-none-eabi-size --format=berkeley rusefi.elf 
   text	   data	    bss	    dec	    hex	filename
 334512	   3944	 171876	 510332	  7c97c	rusefi.elf
оно собралось.
Версия компилятора:

Code: Select all

Using built-in specs.
COLLECT_GCC=arm-none-eabi-gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-none-eabi/4.8.4/lto-wrapper
Target: arm-none-eabi
Configured with: ../configure --with-pkgversion='Arch User Repository' --with-bugurl=https://aur.archlinux.org/packages/arm-none-eabi-gcc-linaro --target=arm-none-eabi --prefix=/usr --libexecdir=/usr/lib --datarootdir=/usr/share/arm-none-eabi-gcc --enable-multilib --enable-languages=c,c++ --enable-interwork --with-newlib --with-gnu-as --with-gnu-ld --with-system-zlib --disable-nls --disable-shared --disable-threads --disable-libssp --disable-libstdcxx-pch --disable-libmudflap --disable-libgomp --enable-silent-rules --with-headers=newlib/libc/include --disable-newlib-supplied-syscalls
Thread model: single
gcc version 4.8.4 20140811 (prerelease) (Arch User Repository)

mkf
Posts: 25
Joined: Sun Oct 25, 2015 7:11 am
Location: Russia, Tomsk City
Contact:

Re: Проблема с компиляцией (Linux)

Post by mkf » Mon Oct 26, 2015 3:47 pm

Смущает только разный размер
в убунте

Code: Select all

   text	   data	    bss	    dec	    hex	filename
 226128	   2340	 168036	 396504	  60cd8	build/rusefi.elf
у меня

Code: Select all

   text    data     bss     dec     hex filename
 245328    2344  168040  415712   657e0 build/rusefi.elf
хотя версия исходников одна и та же. значит компилятор чего-то накомпилировал еще.
Спасибо за помошь! Буду дальше разбираться.

mkf
Posts: 25
Joined: Sun Oct 25, 2015 7:11 am
Location: Russia, Tomsk City
Contact:

Re: Проблема с компиляцией (Linux)

Post by mkf » Mon Oct 26, 2015 3:57 pm

есть подозрение, что новым компиляторам надо было ключем в нос ткнуть, чтобы они использовали аппаратный fpu
  • /usr/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv7e-m/softfp/libg.a(lib_a-sbrkr.o): In function `_sbrk_r':
    sbrkr.c:(.text._sbrk_r+0xc): undefined reference to `_sbrk'
    collect2: error: ld returned 1 exit status

User avatar
russian
Site Admin
Posts: 9518
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Soldering skill: yes
Coding skill?: yes
Contact:

Re: Проблема с компиляцией (Linux)

Post by russian » Mon Oct 26, 2015 3:58 pm

Однако это косяк, не должно так быть. Поставил 4.9 и у меня тоже не собралось :(

https://sourceforge.net/p/rusefi/tickets/237/

кто хочет разобраться? :)
https://rusefi.com/s/howtocontribute
very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions
my skype is arro239

User avatar
rus084
contributor
contributor
Posts: 678
Joined: Sun Dec 01, 2013 1:40 pm
Location: Russia , Stavropol
Soldering skill: yes
Coding skill?: yes
Contact:

Re: Проблема с компиляцией (Linux)

Post by rus084 » Mon Oct 26, 2015 6:02 pm

russian wrote: Поставил 4.9 и у меня тоже не собралось
а ты под какой ОС собирал?

User avatar
russian
Site Admin
Posts: 9518
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Soldering skill: yes
Coding skill?: yes
Contact:

Re: Проблема с компиляцией (Linux)

Post by russian » Mon Oct 26, 2015 6:10 pm

rus084 wrote:а ты под какой ОС собирал?
c:/progra~1 в тикете намекает :)
Windows 10 - так что дело не в ОС, а в версии компилятора всё-таки.
https://rusefi.com/s/howtocontribute
very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions
my skype is arro239

mkf
Posts: 25
Joined: Sun Oct 25, 2015 7:11 am
Location: Russia, Tomsk City
Contact:

Re: Проблема с компиляцией (Linux)

Post by mkf » Mon Oct 26, 2015 6:36 pm

Описание версии 4.8.4 (компилируется)

Code: Select all

Features:
* Support the new cpu cortex-m7.
* All GCC 4.8 features, plus latest mainline features
  - Cortex-R7 support
* Additional code size optimizations
  - Don't expand multiply instruction for Thumb-1.
  - Avoid unnecessary lr save instruction for Thumb-1.
* Newlib-nano: newlib branch optimized for code size
* Cortex-A profile multilib
* Link Time Optimization (LTO)
* A new compiler option -mslow-flash-data to minimize the literal load to
  boost performance for some armv7-m targets.
* A new compiler option -mpic-data-is-text-relative to enable/disable
  addressing data with PC relative.
* Avoid missing _sbrk issue when .specs is used.
* Support multiple RAM sessions in startup code.
* A GCC plugin to optimize Finite State Machine program.
Описание версии 4.9.3 (уже не компилируется):

Code: Select all

Features:
* All GCC 4.9 features, plus latest mainline features
  - Cortex-M7 support
  - Small multiply support with options:
    . -mcpu=cortex-m1.small-multiply
    . -mcpu=cortex-m0.small-multiply
    . -mcpu=cortex-m0plus.small-multiply 
* Define aeabi_memcpy and aeabi_memcpy4 routines in newlib.
* Thumb-1 library optimizations.
* Additional code size optimizations
* Add gdb python build (arm-none-eabi-gdb-py).
* Object file without attribute section can be linked with any
  others.

mkf
Posts: 25
Joined: Sun Oct 25, 2015 7:11 am
Location: Russia, Tomsk City
Contact:

Re: Проблема с компиляцией (Linux)

Post by mkf » Mon Oct 26, 2015 7:47 pm

Ответ где-то тут
http://forum.chibios.org/phpbb/viewtopi ... l.c#p22361
http://forum.chibios.org/phpbb/viewtopi ... k_r#p12650
https://sourceware.org/newlib/libc.html#Syscalls
В новых компиляторах часть функций перенесена в Newlib. Выделение памяти (ChibiOS/RT пользуется ими) и видимо копирование областей памяти.
ChibiOS/RT должна обеспечивать обработку системных вызовов.
В новых ChibiOS-ях видимо есть:
The C library requires those functions, there is a module under /os/various named syscall.c, you should include it in your application Makefile.

mkf
Posts: 25
Joined: Sun Oct 25, 2015 7:11 am
Location: Russia, Tomsk City
Contact:

Re: Проблема с компиляцией (Linux)

Post by mkf » Mon Oct 26, 2015 7:52 pm

Вот он скачался (версия 3.0.2 ChibiOS/RT):

Code: Select all

/*
    ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
*/
/*
* **** This file incorporates work covered by the following copyright and ****
* **** permission notice:                                                 ****
*
*  Copyright (c) 2009 by Michael Fischer. All rights reserved.
*
*  Redistribution and use in source and binary forms, with or without
*  modification, are permitted provided that the following conditions
*  are met:
*
*  1. Redistributions of source code must retain the above copyright
*     notice, this list of conditions and the following disclaimer.
*  2. Redistributions in binary form must reproduce the above copyright
*     notice, this list of conditions and the following disclaimer in the
*     documentation and/or other materials provided with the distribution.
*  3. Neither the name of the author nor the names of its contributors may
*     be used to endorse or promote products derived from this software
*     without specific prior written permission.
*
*  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
*  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
*  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
*  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
*  THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
*  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
*  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
*  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
*  AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
*  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
*  THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
*  SUCH DAMAGE.
*
****************************************************************************
*  History:
*
*  28.03.09  mifi       First Version, based on the original syscall.c from
*                       newlib version 1.17.0
*  17.08.09  gdisirio   Modified the file for use under ChibiOS/RT
*  15.11.09  gdisirio   Added read and write handling
****************************************************************************/

#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>

#include "ch.h"
#if defined(STDOUT_SD) || defined(STDIN_SD)
#include "hal.h"
#endif

/***************************************************************************/

int _read_r(struct _reent *r, int file, char * ptr, int len)
{
  (void)r;
#if defined(STDIN_SD)
  if (!len || (file != 0)) {
    __errno_r(r) = EINVAL;
    return -1;
  }
  len = sdRead(&STDIN_SD, (uint8_t *)ptr, (size_t)len);
  return len;
#else
  (void)file;
  (void)ptr;
  (void)len;
  __errno_r(r) = EINVAL;
  return -1;
#endif
}

/***************************************************************************/

int _lseek_r(struct _reent *r, int file, int ptr, int dir)
{
  (void)r;
  (void)file;
  (void)ptr;
  (void)dir;

  return 0;
}

/***************************************************************************/

int _write_r(struct _reent *r, int file, char * ptr, int len)
{
  (void)r;
  (void)file;
  (void)ptr;
#if defined(STDOUT_SD)
  if (file != 1) {
    __errno_r(r) = EINVAL;
    return -1;
  }
  sdWrite(&STDOUT_SD, (uint8_t *)ptr, (size_t)len);
#endif
  return len;
}

/***************************************************************************/

int _close_r(struct _reent *r, int file)
{
  (void)r;
  (void)file;

  return 0;
}

/***************************************************************************/

caddr_t _sbrk_r(struct _reent *r, int incr)
{
#if CH_CFG_USE_MEMCORE
  void *p;

  chDbgCheck(incr > 0);

  p = chCoreAlloc((size_t)incr);
  if (p == NULL) {
    __errno_r(r) = ENOMEM;
    return (caddr_t)-1;
  }
  return (caddr_t)p;
#else
  (void)incr;
  __errno_r(r) = ENOMEM;
  return (caddr_t)-1;
#endif
}

/***************************************************************************/

int _fstat_r(struct _reent *r, int file, struct stat * st)
{
  (void)r;
  (void)file;

  memset(st, 0, sizeof(*st));
  st->st_mode = S_IFCHR;
  return 0;
}

/***************************************************************************/

int _isatty_r(struct _reent *r, int fd)
{
  (void)r;
  (void)fd;

  return 1;
}

/*** EOF ***/
находится тут /ChibiOS_3.0.2/os/various/syscalls.c
и тут /ChibiOS_2.6.9/os/various/syscalls.c

mkf
Posts: 25
Joined: Sun Oct 25, 2015 7:11 am
Location: Russia, Tomsk City
Contact:

Re: Проблема с компиляцией (Linux)

Post by mkf » Mon Oct 26, 2015 8:02 pm

И... Вуаля! Оно компилится с новым компилятором
arm-none-eabi-gcc 5.2.0-1
и библиотекой
arm-none-eabi-newlib 2.2.0-4

User avatar
russian
Site Admin
Posts: 9518
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Soldering skill: yes
Coding skill?: yes
Contact:

Re: Проблема с компиляцией (Linux)

Post by russian » Mon Oct 26, 2015 10:53 pm

Вот всегда бы так - сам ошибку нашёл и сам починил. Красота! Спасибо, закоммитил :)
https://rusefi.com/s/howtocontribute
very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions
my skype is arro239

mkf
Posts: 25
Joined: Sun Oct 25, 2015 7:11 am
Location: Russia, Tomsk City
Contact:

Re: Проблема с компиляцией (Linux)

Post by mkf » Thu Oct 29, 2015 4:16 pm

... видимо, продолжу доставать вас вопросами. Ну не программист я :(
Пытаюсь откомпилировать отладочную консоль, не получается

Code: Select all

[mkf@core_i5 java_console]$ ant  
Buildfile: /home/mkf/Kostik/rusefi/trunk/java_console/build.xml

compile:
    [mkdir] Created dir: /home/mkf/Kostik/rusefi/trunk/java_console/build/classes
    [javac] /home/mkf/Kostik/rusefi/trunk/java_console/build.xml:11: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
    [javac] Compiling 436 source files to /home/mkf/Kostik/rusefi/trunk/java_console/build/classes
    [javac] /home/mkf/Kostik/rusefi/trunk/java_console/autotest/src/com/rusefi/TestingUtils.java:9: warning: IOUtils is internal proprietary API and may be removed in a future release
    [javac] import sun.misc.IOUtils;
    [javac]                ^
    [javac] /home/mkf/Kostik/rusefi/trunk/java_console/romraider/src/com/romraider/util/SettingsManager.java:38: warning: DOMParser is internal proprietary API and may be removed in a future release
    [javac] import com.sun.org.apache.xerces.internal.parsers.DOMParser;
    [javac]                                                  ^
    [javac] /home/mkf/Kostik/rusefi/trunk/java_console/romraider/src/com/romraider/xml/DOMSettingsBuilder.java:34: warning: OutputFormat is internal proprietary API and may be removed in a future release
    [javac] import com.sun.org.apache.xml.internal.serialize.OutputFormat;
    [javac]                                                 ^
    [javac] /home/mkf/Kostik/rusefi/trunk/java_console/romraider/src/com/romraider/xml/DOMSettingsBuilder.java:35: warning: XMLSerializer is internal proprietary API and may be removed in a future release
    [javac] import com.sun.org.apache.xml.internal.serialize.XMLSerializer;
    [javac]                                                 ^
    [javac] /home/mkf/Kostik/rusefi/trunk/java_console/romraider/src/com/romraider/editor/ecu/ECUEditorManager.java:48: warning: DOMParser is internal proprietary API and may be removed in a future release
    [javac] /home/mkf/Kostik/rusefi/trunk/java_console/romraider/src/com/romraider/editor/ecu/ECUEditor.java:200: warning: DOMParser is internal proprietary API and may be removed in a future release
    [javac]         DOMParser parser = new DOMParser();
    [javac]         ^
    [javac] /home/mkf/Kostik/rusefi/trunk/java_console/romraider/src/com/romraider/editor/ecu/ECUEditor.java:200: warning: DOMParser is internal proprietary API and may be removed in a future release
    [javac]         DOMParser parser = new DOMParser();
    [javac]                                ^
    [javac] /home/mkf/Kostik/rusefi/trunk/java_console/romraider/src/com/romraider/util/SettingsManager.java:71: warning: DOMParser is internal proprietary API and may be removed in a future release
    [javac]             final DOMParser parser = new DOMParser();
    [javac]                   ^
    [javac] /home/mkf/Kostik/rusefi/trunk/java_console/romraider/src/com/romraider/util/SettingsManager.java:71: warning: DOMParser is internal proprietary API and may be removed in a future release
    [javac]             final DOMParser parser = new DOMParser();
    [javac]                                          ^
    [javac] /home/mkf/Kostik/rusefi/trunk/java_console/romraider/src/com/romraider/xml/DOMSettingsBuilder.java:59: warning: OutputFormat is internal proprietary API and may be removed in a future release
    [javac]         OutputFormat of = new OutputFormat("XML", "ISO-8859-1", true);
    [javac]         ^
    [javac] /home/mkf/Kostik/rusefi/trunk/java_console/romraider/src/com/romraider/xml/DOMSettingsBuilder.java:59: warning: OutputFormat is internal proprietary API and may be removed in a future release
    [javac]         OutputFormat of = new OutputFormat("XML", "ISO-8859-1", true);
    [javac]                               ^
    [javac] /home/mkf/Kostik/rusefi/trunk/java_console/romraider/src/com/romraider/xml/DOMSettingsBuilder.java:67: warning: XMLSerializer is internal proprietary API and may be removed in a future release
    [javac]             XMLSerializer serializer = new XMLSerializer(fos, of);
    [javac]             ^
    [javac] /home/mkf/Kostik/rusefi/trunk/java_console/romraider/src/com/romraider/xml/DOMSettingsBuilder.java:67: warning: XMLSerializer is internal proprietary API and may be removed in a future release
    [javac]             XMLSerializer serializer = new XMLSerializer(fos, of);
    [javac]                                            ^
    [javac] Note: Some input files use or override a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.
    [javac] Note: Some input files use unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
    [javac] 13 warnings
    [junit] Running com.rusefi.binaryprotocol.test.CRCTest
    [junit] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0,009 sec

BUILD FAILED
/home/mkf/Kostik/rusefi/trunk/java_console/build.xml:23: Test com.rusefi.binaryprotocol.test.CRCTest failed

Total time: 5 seconds
  • [javac] Note: Some input files use or override a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.
    [javac] Note: Some input files use unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
    [javac] 13 warnings
    [junit] Running com.rusefi.binaryprotocol.test.CRCTest
    [junit] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0,009 sec

    BUILD FAILED
Чего делать-то? Первый раз пробую компилировать жабу.
Скачал rusefi_console.zip распаковал запустил - работает. Но хотелось бы все по фен-шую...

User avatar
russian
Site Admin
Posts: 9518
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Soldering skill: yes
Coding skill?: yes
Contact:

Re: Проблема с компиляцией (Linux)

Post by russian » Thu Oct 29, 2015 5:38 pm

mkf wrote: [junit] Running com.rusefi.binaryprotocol.test.CRCTest
[junit] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0,009 sec
Странно!

А что в логе теста, в файле java_console\build\TEST-com.rusefi.binaryprotocol.test.CRCTest.txt написано?
https://rusefi.com/s/howtocontribute
very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions
my skype is arro239

mkf
Posts: 25
Joined: Sun Oct 25, 2015 7:11 am
Location: Russia, Tomsk City
Contact:

Re: Проблема с компиляцией (Linux)

Post by mkf » Fri Oct 30, 2015 1:01 am

вот:

Code: Select all

Testsuite: com.rusefi.binaryprotocol.test.CRCTest
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0,009 sec

Testcase: initializationError(com.rusefi.binaryprotocol.test.CRCTest):	Caused an ERROR
org/hamcrest/SelfDescribing
java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
	at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
Caused by: java.lang.ClassNotFoundException: org.hamcrest.SelfDescribing
	at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:358)

User avatar
russian
Site Admin
Posts: 9518
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Soldering skill: yes
Coding skill?: yes
Contact:

Re: Проблема с компиляцией (Linux)

Post by russian » Fri Oct 30, 2015 3:02 pm

SelfDescribing лежит в junit.jar который упомянут как lib/junit.jar в правильных местах, странно. Опять же, всё работает на http://crapcan-am.com:8080/job/rusEfi/7597/consoleFull

javac -version
?
ant -v
?
https://rusefi.com/s/howtocontribute
very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions
my skype is arro239

mkf
Posts: 25
Joined: Sun Oct 25, 2015 7:11 am
Location: Russia, Tomsk City
Contact:

Re: Проблема с компиляцией (Linux)

Post by mkf » Sat Oct 31, 2015 2:18 am

$ javac -version
javac 1.7.0_91

$ ant -version
Apache Ant(TM) version 1.9.6 compiled on July 3 2015

Я тут между делом подумал, что, возможно, мне будет достаточно уже скомпилированной версии. Вряд-ли я буду в исходниках ковыряться. В си как раз собрался шаманить, а в яве я ничего не понимаю. Если скомпилированая версия работает, то самому компилировать не обязательно. Тем более, что консоль работает лучше чем тюнер студия. По крайней мере сама последовательные порты находит - не нужно подстановки делать из /dev/ttyACM0 в /dev/ttyS0

Post Reply