Using Memory Sections

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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值