SLAU131Y October 2004 – June 2021
The MSP430 C/C++ compiler uses an uninitialized section, .stack, to allocate space for the run-time stack. You can set the size of this section in bytes at link time with the --stack_size option. The syntax for the --stack_size option is:
--stack_size= size
The size must be a constant and is in bytes. This example defines a 4K byte stack:
cl430 --run_linker --stack_size=0x1000 /* defines a 4K heap (.stack section)*/
If you specified a different stack size in an input section, the input section stack size is ignored. Any symbols defined in the input section remain valid; only the stack size is different.
When the linker defines the .stack section, it also defines a global symbol, __TI_STACK_SIZE, and assigns it a value equal to the size of the section. The default software stack size is 128 bytes. See Section 9.7.1 for information about referring to linker symbols in C/C++ code.