GCC compilation of mbed-rtos example fails

29 Aug 2012

System

Procedure

  1. Import rtos_basic from http://mbed.org/handbook/RTOS
  2. Export to GCC (Arm Embedded) target
  3. Unzip
  4. Edit Makefile, set GCC_BIN to bin directory of extracted archive B
  5. type make

Output

[ash@nost rtos_basic]$ make
/home/ash/arm_compiler/bin/arm-none-eabi-as  -c -Os -fno-common -fmessage-length=0 -Wall -fno-exceptions -mcpu=cortex-m3 -mthumb -ffunction-sections -fdata-sections  -DTARGET_LPC1768 -DTOOLCHAIN_GCC_ARM -DNDEBUG -o mbed-rtos/rtx/LPC1768/GCC_ARM/SVC_Table.o mbed-rtos/rtx/LPC1768/GCC_ARM/SVC_Table.s
/home/ash/arm_compiler/bin/arm-none-eabi-as: unrecognized option '-Os'
make: *** [mbed-rtos/rtx/LPC1768/GCC_ARM/SVC_Table.o] Error 1
[ash@nost rtos_basic]$ 

Removing the option results in further errors. Cannot get it to compile.

Do you only support a particular version of the toolchain?

Regards

Ashley

29 Aug 2012

Hi Ashley,

Ashley Mills wrote:

Do you only support a particular version of the toolchain?

I am sorry, you stumbled upon a bug!

Until recently we were providing the mbed-rtos as a binary precompiled with our multi-target and multi-toolchain internal build system.

Since we released the mbed-rtos sources we did not test the build with the Makefiles generated by the exporter in the IDE. Thank you for reporting this issue.

We will fix it, but the fix will take a bit of time to appear live online, in the mean time you can patch your Makefile like this:

* Remove $(CC_FLAGS) and $(CC_SYMBOLS) from the ".s.o:" rule
* Add -D__CORTEX_M3 to CC_SYMBOLS

HTH, Emilio

29 Aug 2012

Hi Ashley, another note, the new "mbed-rtos" memory model (main stack not fixed size, but sharing all the available RAM with the heap), is not tested with the GCC toolchain. I would avoid using the latest two "mbed-rtos" releases with a GCC toolchain at the moment.

Cheers, Emilio

29 Aug 2012

Thanks,

Adding

-D__CORTEX_M3

Gave

Error: selected processor does not support requested special purpose register -- `msr PSP,R0'
...

Because I don't think the processor is being specified in that case, because the CC_SYMBOLS was removed as instructed.

But even adding

-D__CORTEX_M3

To the .s.o rule produces:

unrecognized option '-__CORTEX_M3'

What does work, is adding:

-mcpu=cortex-m3

To the .s.o rule. This allowed it to compile without error.

I guess something has changed in the way flags are interpreted somewhere.

Ashley

27 Apr 2013

Hello, I can't succeed using rtos with gcc-arm(see http://mbed.org/questions/911/programm-rtos_basic-doesnt-work-using-of/). Anybody have an idea ? Cheers

31 May 2013

In [Revision 12] of the mbed-rtos we added back the support for the GCC_ARM toolchain.

Cheers, Emilio