6 years, 10 months ago.

Linking error with CoIDE

I was exporting Nucleo_Blink_example from MBED online compiler(succesfully compiled) to CoIDE 1.7.8. But when I try to Build the console give me error

/TARGET_NUCLEO_F446RE/TOOLCHAIN_GCC_ARMSTM32F446XE.ld:1: ignoring invalid character `#' in expression /TARGET_NUCLEO_F446RE/TOOLCHAIN_GCC_ARMSTM32F446XE.ld:1: syntax error

collect2.exe: error: ld returned 1 exit status

How to fix this?

1 Answer

6 years, 10 months ago.

Hello Achmad,

It seems that precompiler directives (like #if ...) in linker files are not supported by the GNU ARM mbedded toolchain. You can work around it for instance by converting the respective #if sections in the targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F446xE/device/TOOLCHAIN_GCC_ARM/STM32F446XE.ld linker file to C style comments and modifying the FLASH : ORIGIN and LENGTH assignments as follows:

STM32F446XE.ld

/*
#if !defined(MBED_APP_START)
  #define MBED_APP_START 0x08000000
#endif

#if !defined(MBED_APP_SIZE)
  #define MBED_APP_SIZE 512K
#endif
*/
/* Linker script to configure memory regions. */
MEMORY
{
  FLASH (rx)   : ORIGIN = 0x08000000, LENGTH = 512K
  RAM (rwx)  : ORIGIN = 0x200001C4, LENGTH = 128k - 0x1C4
}

...

With best regards,

Zoltan

Accepted Answer