NUCLEO_F411RE: Working offline under OSX with GCC/eclipse?

15 May 2015

Hello everyone,

Can someone please point me into the right direction on how to get going using eclipse with GCC and mbed to develop under OS X? I have a NUCLEO_F411RE.

I started following this guide: mbed GCC with eclipse KL25Z (Part 1). I made the following changes:

  • At step 3 I used the following command: python build.py -m NUCLEO_F411RE -t GCC_ARM
  • At step 5 I added the following to the Platforms file:

else ifeq ($(BOARD), NUCLEO_F411RE)
	LINKER_NAME = STM32F411XE
	STARTUP_NAME = startup_stm32f411xe
	SYSTEM_NAME = system_stm32f4xx
	TARGET_BOARD = TARGET_NUCLEO_F411RE
	TARGET_VENDOR = TARGET_STM
	TARGET_FAMILY = TARGET_STM32F4
	TARGET_SPECIFIC = .
	CPU = cortex-m4
  • At step 5 I also added the following to the Makefile:

INC_DIRS += $(MBED_DIR)/$(TARGET_BOARD)/$(TARGET_VENDOR)/$(TARGET_FAMILY)/$(TARGET_BOARD)
  • At step 7 the build produces the following output:

18:45:18 **** Build of configuration Default for project Blink ****
make all 
Building file: main.o
Invoking: MCU C++ Compiler
arm-none-eabi-g++ -g -ggdb -Os -Wall -fno-strict-aliasing -fno-rtti -ffunction-sections -fdata-sections -fno-exceptions -fno-delete-null-pointer-checks -fmessage-length=0 -fno-builtin -mthumb -mcpu=cortex-m4 -MMD -MP -DTARGET_NUCLEO_F411RE -DTOOLCHAIN_GCC_ARM -DNDEBUG -MF build/main.d -I.  -Imbed  -Imbed/TARGET_NUCLEO_F411RE  -Imbed/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM  -Imbed/TARGET_NUCLEO_F411RE/TARGET_STM/TARGET_STM32F4  -Imbed/TARGET_NUCLEO_F411RE/TARGET_STM/TARGET_STM32F4/.  -Imbed/TARGET_NUCLEO_F411RE/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F411RE -std=gnu++98 -c main.cpp -o build/main.o
Finished building: main.o
 
Building target: build/mbed.elf
Invoking: MCU Linker
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -Os -L mbed/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM -T mbed/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/STM32F411XE.ld -I.  -Imbed  -Imbed/TARGET_NUCLEO_F411RE  -Imbed/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM  -Imbed/TARGET_NUCLEO_F411RE/TARGET_STM/TARGET_STM32F4  -Imbed/TARGET_NUCLEO_F411RE/TARGET_STM/TARGET_STM32F4/.  -Imbed/TARGET_NUCLEO_F411RE/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F411RE -specs=nano.specs -Wl,-Map=build/mbed.map,--gc-sections build/main.o   mbed/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/board.o mbed/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/cmsis_nvic.o mbed/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/startup_stm32f411xe.o mbed/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/retarget.o mbed/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/system_stm32f4xx.o mbed/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/mbed_overrides.o -lmbed -lstdc++ -lsupc++ -lm -lgcc -lc -lnosys -o build/mbed.elf
mbed/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/system_stm32f4xx.o: In function `SystemInit':
/mbed/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F411RE/system_stm32f4xx.c:233: undefined reference to `HAL_Init'
Makefile:163: recipe for target 'build/mbed.elf' failed
mbed/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/system_stm32f4xx.o: In function `SetSysClock_PLL_HSE':
/mbed/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F411RE/system_stm32f4xx.c:619: undefined reference to `HAL_RCC_OscConfig'
/mbed/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F411RE/system_stm32f4xx.c:630: undefined reference to `HAL_RCC_ClockConfig'
mbed/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/system_stm32f4xx.o: In function `SetSysClock_PLL_HSI':
/mbed/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F411RE/system_stm32f4xx.c:673: undefined reference to `HAL_RCC_OscConfig'
/mbed/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F411RE/system_stm32f4xx.c:684: undefined reference to `HAL_RCC_ClockConfig'
mbed/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/libmbed.a(serial_api.o): In function `init_uart':
/mbed/libraries/mbed/targets/hal/TARGET_STM/TARGET_STM32F4/serial_api.c:69: undefined reference to `HAL_UART_Init'
mbed/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/libmbed.a(pinmap.o): In function `pin_function':
/mbed/libraries/mbed/targets/hal/TARGET_STM/TARGET_STM32F4/pinmap.c:145: undefined reference to `HAL_GPIO_Init'
mbed/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/libmbed.a(us_ticker.o): In function `us_ticker_init':
/mbed/libraries/mbed/targets/hal/TARGET_STM/TARGET_STM32F4/us_ticker.c:44: undefined reference to `HAL_InitTick'
collect2: error: ld returned 1 exit status
make: *** [build/mbed.elf] Error 1

18:45:22 Build Finished (took 4s.571ms)

Now I'm stuck. Any help would be greatly appreciated

Thank you

16 May 2015

Hello Pieter Kruger,

It would be helpful if you attach the Makefile you are trying to compile (or the whole project). The error you are getting is that, while everything compiled well, the linker can't find HAL_UART_Init, HAL_GPIO_Init or HAL_InitTick, this means that either you missed adding them to the objects being built or that you missed a library (-lmbed?). If you have your project in the online IDE, you can export it as GCC ARM compiler, then inside the zip you'll find the autogenerated Makefile, that would be a good starting point to find out what's missing. I guess that the ones you are missing are (at least):

  • /mbed/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_gpio.o
  • /mbed/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_uart.o
  • /mbed/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal.o
25 May 2015

Hello Sebastián Pastor

Thank you for the help. Yes, that was the problem. I also tried GCC4MBED, which, after a few small modifications, is working perfectly :-) It has build-in support for the F411RE and OS X.