Using Memory Sections
The C/C++ run-time environment requires that a specific set of memory section names are used for placing code in memory. In assembly language files, these names are used as labels for the .SECTION directive. In the .ldf file, these names are used as labels for the output section names within the SECTIONS{} command. For information on the LDF syntax and other information on the linker, see the VisualDSP++ 5.0 Linker and Utilities Manual .
Code Storage
The code section, program , is where the compiler puts all the program instructions that it generates when compiling the program. The cplb_code section exists so that memory protection management routines can be placed into sections of memory that are always configured as being available. A noncache_code section is mapped to memory that cannot be configured as cache. The noncache_code section is used by the RTL. The noncache_code section exists to allow placement of code into a section that cannot be configured as cache. This is required by some run-time library routines.
Data Storage
The data section, data1 , is where the compiler puts global and static data in memory. The data section, constdata , is where the compiler puts data that has been declared as const . By default, the compiler places global zero-initialized data into a “BSS-style” section, called bsz , unless the compiler is invoked with the -no-bss option (click here ). The cplb_data section exists so that configuration tables used to manage memory protection can be placed in memory areas that are always flagged as accessible.
Run-Time Stack
The run-time stack is positioned in memory section stack and is required for the run-time environment to function. The section must be mapped in the .ldf file.
The run-time stack is a 32-bit wide structure, growing from high memory to low memory. The compiler uses the run-time stack as the storage area for local variables and return addresses. See "Managing the Stack" for more information.
Run-Time Heap Storage
The run-time heap section, heap , is where the compiler puts the run-time heap in memory. When linking, use your .ldf file to map the heap section. To dynamically allocate and deallocate memory at run-time, the C run-time library includes four functions:
malloc() calloc() realloc() free()
Additionally, the C++ new and delete operators are available to allocate and free memory from the run-time heap. By default, all heap allocations are from the heap section of memory. The .ldf file must define symbolic constants ldf_heap_space , ldf_heap_end and ldf_heap_length to allow the heap management routines to function.