This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

cmd中heap默认是在哪个段分配呢,动态分配段名是什么?

Other Parts Discussed in Thread: TMS320C6748

我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
}
*/

  • 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.

  • 1.stack,heap大小的要求请参考下面的wiki网站。
    http://processors.wiki.ti.com/index.php/Stack_and_Heap_size_requirements

    2. 3. heap对应.sysmem。请看下面的编译器手册。
    Table 6-2. Uninitialized Sections Created by the Compiler (continued)
    http://www.ti.com/lit/ug/sprui04b/sprui04b.pdf

  • 大哥,虽然是个连接,你这回答到点上了,谢谢,满分

  • 你们找这些在线的手册是咋找的,哪个页面有目录么,还是直接在哪检索

  • 直接search,或者到对应的器件的产品文件夹网站上的technical documents里找。
    http://www.ti.com/product/TMS320C6748/technicaldocuments

    还有一个比较有用的wiki网站。
    http://processors.wiki.ti.com/index.php/Main_Page