8 years, 1 month ago.

Unable to compile mbed project with gcc

steps:

1) create a new project from a template (Nucleo_ticker) in mbed online compiler for a nucleo board (stm32f303ret6 in my case) 2) export the project for gnu arm gcc 3) download the project 4) edit the Makefile in order to add a linker script 5) run make

compilation result

arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=softfp  -Wl,--gc-sections --specs=nano.specs -u _printf_float -u _scanf_float -Wl,--wrap,main -Wl,-Map=Nucleo_ticker.map,--cref -T/opt/stm32cubef3/Projects/STM32F303RE-Nucleo/Templates/TrueSTUDIO/STM32F303RE-Nucleo/STM32F303RE_FLASH.ld  -o Nucleo_ticker.elf main.o  -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys  -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys
/usr/lib/gcc/arm-none-eabi/5.3.0/../../../../arm-none-eabi/bin/ld: warning: cannot find entry symbol Reset_Handler; defaulting to 0000000008000000
main.o: In function `mbed::Ticker::~Ticker()':
/home/clynamen/NUCLEO_TEST/Nucleo_ticker/./mbed/Ticker.h:109: undefined reference to `mbed::Ticker::detach()'
/home/clynamen/NUCLEO_TEST/Nucleo_ticker/./mbed/Ticker.h:108: undefined reference to `mbed::TimerEvent::~TimerEvent()'
/home/clynamen/NUCLEO_TEST/Nucleo_ticker/./mbed/Ticker.h:110: undefined reference to `vtable for mbed::Ticker'
main.o: In function `mbed::Ticker::Ticker()':
/home/clynamen/NUCLEO_TEST/Nucleo_ticker/./mbed/Ticker.h:60: undefined reference to `mbed::TimerEvent::TimerEvent()'
main.o: In function `mbed::DigitalOut::DigitalOut(PinName)':
/home/clynamen/NUCLEO_TEST/Nucleo_ticker/./mbed/DigitalOut.h:49: undefined reference to `vtable for mbed::Ticker'
/home/clynamen/NUCLEO_TEST/Nucleo_ticker/./mbed/DigitalOut.h:49: undefined reference to `gpio_init_out'
collect2: error: ld returned 1 exit status
Makefile:68: recipe for target 'Nucleo_ticker.elf' failed
make: *** [Nucleo_ticker.elf] Error 1

It seems that the exported project does not include nor the embed library (something like mbed.a) neither the source code of the library, so compilation cannot be done.

How can I export a project in order to use make?

1 Answer

8 years, 1 month ago.

How strange, looks like you're right, the mbed library is missing for the F303RE.

In the online compiler, if you delete the mbed library and add the mbed-src library, it should provide all of the source files for the mbed library. I was able to successfully compile offline with mbed-src.

Please report this to github, if the target supports gcc arm, we can add it to the next release

posted by Martin Kojtal 21 Mar 2016

I checked out with another nucleo and it works fine indeed. it seems to be a problem with that nucleo indeed

posted by Vincenzo Comito 22 Mar 2016