nabilt / STM32F4-Discovery-Firmware

Modified STM32F4 Discovery Demo Firmware from ST compile with arm-none-eabi-gcc
134 stars 122 forks source link

Cannot compile the code. #3

Open sawaYch opened 5 years ago

sawaYch commented 5 years ago

The code from Demonstration (actually all projects) cannot be compiled on Ubuntu 18.04. I have already follow the steps in README.md and here is the error message:

error: /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/crt0.o: Conflicting CPU architectures 13/1
...
collect2: error: ld returned 1 exit status

Any ideas?

sawaYch commented 5 years ago

I think I found the solution. It is a bug of libnewlib in version 2.4.0.20160527-3 Compilation success after update the lib to version 2.4.0.20160527-4 Related discussion: https://github.com/bbcmicrobit/micropython/issues/514#issuecomment-404759614

sawaYch commented 5 years ago

I have another question: cannot flash the program by using openocd. So I tried texane's stlink and it works. Just mention in here for reference, somebody may found it helps. Beware of the format (.hex), if your target is in .bin format then no need to add extra options. st-flash --format ihex write demo.hex

brandonros commented 4 years ago

I think I found the solution. It is a bug of libnewlib in version 2.4.0.20160527-3 Compilation success after update the lib to version 2.4.0.20160527-4 Related discussion: bbcmicrobit/micropython#514 (comment)

I'm running into this on Mac FWIW.

$ make
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mlittle-endian -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb-interwork  -Os  -DUSE_STDPERIPH_DRIVER -DSTM32F4XX -DMANGUSTA_DISCOVERY -DUSE_USB_OTG_FS -DHSE_VALUE=8000000 -I./ -I./ -I../../Utilities/STM32F4-Discovery -I../../Libraries/CMSIS/ST/STM32F4xx/Include/ -I../../Libraries/CMSIS/Include/ -I../../Libraries/STM32F4xx_StdPeriph_Driver/inc/ -I../../Libraries/STM32_USB_Device_Library/Class/hid/inc -I../../Libraries/STM32_USB_Device_Library/Core/inc/ -I../../Libraries/STM32_USB_OTG_Driver/inc/  -Wl,-T,stm32_flash.ld main.c stm32f4xx_it.c system_stm32f4xx.c ../../Utilities/STM32F4-Discovery/stm32f4_discovery.c ../../Libraries/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_syscfg.c ../../Libraries/STM32F4xx_StdPeriph_Driver/src/misc.c ../../Libraries/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_gpio.c ../../Libraries/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_rcc.c ../../Libraries/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_exti.c startup_stm32f4xx.s -o demo.elf
/usr/local/Caskroom/gcc-arm-embedded/9-2019-q4-major/gcc-arm-none-eabi-9-2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /usr/local/Caskroom/gcc-arm-embedded/9-2019-q4-major/gcc-arm-none-eabi-9-2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard/libc.a(lib_a-exit.o): in function `exit':
exit.c:(.text.exit+0x16): undefined reference to `_exit'
collect2: error: ld returned 1 exit status
make: *** [demo.elf] Error 1

no way to update libnewlib from what I understand?