您的位置:首页 > 其它

21161的内存分配方法在visualdsp 5 中的改变

2009-11-24 11:00 169 查看
在之前的版本中,如v3.5,栈和堆是在ldf中独立分配的。在v 5中,为了更有效的利用内存,会在连接时变大以利用所有剩余的空间。

默认的堆栈大小是8K,可以在下面第一句改变大小,以增加dmda实际可用内存。

seg_dmda
{
RESERVE(heaps_and_stack, heaps_and_stack_length = 8K, 2)
INPUT_SECTIONS( $OBJECTS(seg_dmda) $LIBRARIES(seg_dmda))
RESERVE_EXPAND(heaps_and_stack, heaps_and_stack_length, 0, 2)
ldf_stack_space = heaps_and_stack;
ldf_stack_end = (ldf_stack_space + ((heaps_and_stack_length * 6K) / 8K) - 2) & 0xfffffffe;
ldf_stack_length = ldf_stack_end - ldf_stack_space;
ldf_heap_space = ldf_stack_end + 2;
ldf_heap_end = ldf_heap_space + ((heaps_and_stack_length * 2K) / 8K) - 2;
ldf_heap_length = ldf_heap_end - ldf_heap_space;
} >seg_dmda

Memory Allocation for Stack and Heap on ADSP-2106x, 2116x and 2126x Processors

In previous releases of VisualDSP++, the default stack and heap were allocated separate memory sections in the LDFs. In VisualDSP++ 5.0, for ADSP-210xx, 2116x and 2126x processors, the allocation of memory for stacks and heaps is performed by the linker at link-time, resulting in more efficient memory use. (For ADSP-213xx processors, the stack and heap allocation remains the same because of the increased number of memory blocks.)
The memory for the stack and heap is allocated as follows:

An area of memory in one of the default memory areas (for example, seg_dmda) is reserved for the stack and heap, using the RESERVE() command.

Memory is allocated to data that must be placed in this section (for example, global variables and static variables).

The RESERVE_EXPAND() command is used to claim any unused space in the default memory area and allocate it to the stack and heap. The ratio of memory allocated to the stack and heap can be adjusted if necessary.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: