TI论坛
直播中

杨帆

7年用户 1403经验值
私信 关注
[问答]

请问cmd中heap默认在哪个secion哦?

我cmd文件分配如下,请问:
1 stack分配是根据在子函数中用到的最大的局部变量,比如数组大小来分配的么?而heap分配是根据malloc分配内存的和来计算得么?
2stack可以定位到段.stack,但是heap为啥没有在section中定位,或者他默认定位在哪里?(这样我知道heap是分配咋哪个section了)
3比如我分配动态分配内存用的形式是 "ping = (Uint16*)MEM_alloc()DDR2HEAP,sizeof(Uint16)*roLength,32)", 所以第一个参数需要指定heap位置,如果2中没有指定位置,我第一个参数该怎么写

谢谢大神解答


-stack 0x00001800 /* Stack Size */
-heap 0x00001800 /* Heap Size */
MEMORY
[
L2RAM: o = 0x10800000 l = 0x00020000
DDR2: o = 0x80000000 l = 0x10000000
Flash: o = 0x90000000 l = 0x00400000
]
SECTIONS
[
.bss > L2RAM
.cinit > L2RAM
.cio > L2RAM
.const > L2RAM
.data > L2RAM
.far > L2RAM
.stack > DDR2
.switch > L2RAM
.sysmem > L2RAM
.text > L2RAM
.ddr2 > DDR2
.buffer > DDR2
]
/*
SECTIONS
[
.bss > DDR2
.cinit > DDR2
.cio > DDR2
.const > DDR2
.data > DDR2
.far > DDR2
.stack > DDR2
.switch > DDR2
.sysmem > DDR2
.text > DDR2
]
*/

回帖(2)

刘丽艳

2020-8-4 08:33:32
memory section manager
mem_alloc第一个参数指定的是内存分配的位置,其值与系统内存heap的定义相关。
Q: Why users are not allowed to call MEM functions (MEM_alloc, MEM_stat etc) from an HWI or SWI?

Memory management functions ( MEM_alloc(), MEM_stat(), MEM_free()) are blocking calls. This is because the functions require the caller to acquire a lock to the memory before proceeding. In case the MEM functions fail to get a lock to the memory, there is a context switch. A call to a SWI or HWI routine should be non-blocking in nature and hence TI recommends that customer should not call MEM functions inside a SWI or HWI. In case the user makes blocking calls (MEM calls) inside a SWI or HWI, the behavior is not guaranteed. Making any blocking calls from a HWI or SWI can affect the real time response of the system.
                                                                         Holly
举报

余少虹

2020-8-4 08:51:05
引用: ctx1129 发表于 2020-8-4 08:33
memory section manager
mem_alloc第一个参数指定的是内存分配的位置,其值与系统内存heap的定义相关。
Q: Why users are not allowed to call MEM functions (MEM_alloc, MEM_stat etc) from an HWI or SWI?

同帖http://www.deyisupport.com/question_answer/dsp_arm/c5000/f/48/t/140267.aspx
举报

更多回帖

发帖
×
20
完善资料,
赚取积分