LInaro linker error for cortex m4 freeRTOS hello_world.elf

Using Linaro 4.9 2015 Q3 toolchain for freeRTOS hello_world example. Compiler runs fine. Linker error:

Linking C executable hello_world.elf
MCIMX7D_M4_tcm.ld:102: nonconstant expression for origin
CMakeFiles/hello_world.dir/build.make:658: recipe for target hello_world.eof has failed.

Appreciate any insights. Affects all freeRTOS example projects.

Thanks very much,


I solved the compiler issues by upgrading to gcc-arm-none-eabi-9-2019-q4-major. It is correct to do the sudo apt-get stuff so the 32-bit compiler can run under 64-bit VirtualBox on a PC.

Dear @bobpbbd104

For better readability I replaced the fixed addresses in the linker script by symbolic definitions:

TCML_code         = 0x1fff8000;
TCMU_system       = 0x20000000;
OCRAM_S_code      = 0x00000000;
/* ... */
  m_interrupts  (RX)  : ORIGIN = OCRAM_S_code,  LENGTH = 0x00000240
  m_text        (RX)  : ORIGIN = TCML_code,     LENGTH = 0x00008000
  m_data        (RW)  : ORIGIN = TCMU_system,   LENGTH = 0x00008000

It now turned out that older versions of the toolchain cannot handle this properly.

The solution is either using a newer toolchain as you did, or replace the symbols OCRAM_S_code etc. by the numbers specified above.

I’m not sure what exactly you mean with the “sudo apt-get stuff”.
sudo apt-get is the standard command to download and install software packages in Ubuntu, or update already-installed software packages. I guess you used this to install the (new version of the) arm compiler/linker toolchain in your Ubuntu virtual machine.

Regards, Andy

Thanks very much.