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

在之前的版本中,如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.
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值