10 years, 4 months ago.

Updated mbed and rtos error on compilation


I just updated the mbed and rtos libraries for a project and get the following error:

"Identifier "WORDS_STACK_SIZE" is undefined" in file "mbed-rtos/rtxRTX_CM_lib.h", Line: 120, Col: 1

This compiled fine before the libraries were updated. I am compiling for 1768 target.

What has happened?



I am in the same boat


posted by Kevin Braun 06 Aug 2013

2 Answers

10 years, 4 months ago.

Looks like there is something not working in mbed-rtos/rtx/cmsis-os.h, lines 117 to 123:

offending code

// The stack space occupied is mainly dependent on the underling C standard library
#if defined(TOOLCHAIN_GCC) || defined(TOOLCHAIN_ARM_STD)
#    define WORDS_STACK_SIZE   512
#elif defined(TOOLCHAIN_ARM_MICRO)
#    define WORDS_STACK_SIZE   128

If I define WORDS_STACK_SIZE below this code then everything compiles.

Are the TOOLCHAIN_ defines being set correctly?



10 years, 4 months ago.

Hi Andrew, thank you for reporting this issue. It should be fixed now.

In parallel to these new revisions of the mbed_official code, for the first time since the beginning of mbed, we have changed:

  • the building conventions
  • the build system (from a PHP codebase, to a Python codebase)

This should have been completely transparent to the mbed users, because our new online build system does handle both the new and old conventions.

We tested very well the build system with the old conventions, but there was not enough code online using the new conventions and we missed a bug: certain new symbols were not defined properly.

In the following days I will write a handbook page about the set of build conventions we are using.

Regarding this specific bug,

in the new conventions, a build using the ARMCC compiler with:

  • the ARM C Standard Library defines these symbols: (TOOLCHAIN_ARM, TOOLCHAIN_ARM_STD)
  • microlib defines these symbols: (TOOLCHAIN_ARM, TOOLCHAIN_ARM_MICRO).

in the old conventions, a build using the ARMCC compiler with:

  • the ARM C Standard Library defines these symbols: (TOOLCHAIN_ARM)
  • microlib defines these symbols: (TOOLCHAIN_uARM).

In other words, we now have one reference symbol for the compiler and one for the (compiler, standard library) tuple.

In the mbed online IDE we are using microlib for the most memory constrained target microcontrollers and that is why we choose a different stack size depending on its presence, or not.

The cause of this bug was that neither TOOLCHAIN_ARM_STD, nor TOOLCHAIN_ARM_MICRO got defined, therefore WORDS_STACK_SIZE remained undefined.

Cheers, Emilio

Hi Emilio,

Is this bug fixed? I try to compile RTOS library for LPC1768 with IAR and I have next error:

[Error] RTX_CM_lib.h@120: [Pe020]: identifier "WORDS_STACK_SIZE" is undefined [Error] RTX_CM_lib.h@120: [Pe028]: expression must have a constant value [Error] RTX_CM_lib.h@277: [Pe020]: identifier "HEAP_START" is undefined

I type next command from cmd line: python.exe workspace_tools/build.py -m LPC1768 -t IAR -r -o debug-info

Best regards Milan Stevanovic

posted by Milan Stevanovic 07 Oct 2014