Define Heap Size (--heap_size Option)

The C/C++ compiler uses an uninitialized section called .esysmem for the C run-time memory pool used by malloc(). You can set the size of this memory pool at link time by using the --heap_size option. The syntax for the --heap_size option is:

--heap_size=size

The size must be a constant. This example defines a 4K word heap:

cl2000 --run_linker --heap_size=0x1000 /* defines a 4k heap (.esysmem section)*/

The linker creates the .esysmem section only if there is a .esysmem section in an input file.

The linker also creates a global symbol, __SYSMEM_SIZE (for COFF) or __TI_SYSMEM_SIZE (for EABI), and assigns it a value equal to the size of the heap. The default size is 1K words. See Section 8.6.1 for information about referring to linker symbols in C/C++ code. For more about C/C++ linking, see Section 8.11.