在之前的版本中,如v3.5,栈和堆是在ldf中独立分配的。在v5中,为了更有效的利用内存,会在连接时变大以利用所有剩余的空间。
默认的堆栈大小是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.
本文介绍VisualDSP++ v5中对于ADSP-210xx、2116x和2126x处理器的栈和堆内存分配进行了优化,通过链接时动态调整以更有效地使用内存。在之前的版本中,栈和堆是分开分配的,而在新版本中,它们被合并到同一内存区域,并且可以根据剩余空间进行扩展。
4069

被折叠的 条评论
为什么被折叠?



