Other Parts Discussed in Thread:SYSBIOS
请问一下,利用如下代码在cfg文件分配BIOS.heapSize时候,会跳出一条警告,然后我用的malloc函数也算不能使用的,执行程序就会跳入exit.c不知道什么原因
/*
* The BIOS module will create the default heap for the system.
* Specify the size of this default heap.
*/
BIOS.heapSize =0x00100000;
BIOS.heapSection = "systemHeap";
产生的warning如下:
Description Resource Path Location Type
#10247-D null: creating output section "systemHeap" without a SECTIONS specification 716_algorithm C/C++ Problem
Shine:
从报错信息看,cmd文件里没有定义systemHeap,请检查一下您的cmd文件。
,
user6520474:
cmd文件如下,显示 .sysmem: load > DDR
SECTIONS
{.text: load >> DDR.ti.decompress: load > DDR.stack: load > DDRGROUP: load > DDR{.bss:.neardata:.rodata:}.cinit: load > DDR.pinit: load >> DDR.init_array: load > DDR.const: load >> DDR.data: load >> DDR.fardata: load >> DDR.switch: load >> DDR.sysmem: load > DDR.far: load >> DDR.args: load > DDR align = 0x4, fill = 0 {_argsize = 0x0; }.cio: load >> DDR.ti.handler_table: load > DDR.c6xabi.exidx: load > DDR.c6xabi.extab: load >> DDR.vecs: load > DDRxdc.meta: load > DDR, type = COPY}
然后在map文件里面,
systemHeap
*01170000000100000UNINITIALIZED1170000000100000app_pe674.oe674 (systemHeap)
但是一执行malloc就出错
,
user6520474:
SEGMENT ALLOCATION MAP
run originload originlengthinit length attrs members
——————— ———- ———– —– ——-
11700000117000000010000000000000rw-11700000117000000010000000000000rw- systemHeap
c0000000c00000000005e4b400000000rw-c0000000c00000000005e4b400000000rw- .far
c005e4b8c005e4b80000000800000008r–c005e4b8c005e4b80000000800000008r– .const.1
c005e4c0c005e4c00004fb4e0004fb4er-xc005e4c0c005e4c00004bae00004bae0r-x .textc00a9fa0c00a9fa00000406e0000406er– .const.2
c00ae010c00ae01000004b0400000000rw-c00ae010c00ae0100000280000000000rw- .stackc00b0810c00b08100000230400000000rw- .fardata
c00b2b14c00b2b140000038800000388r–c00b2b14c00b2b140000038800000388r– .switch
c00b2ea0c00b2ea00000026c00000000rw-c00b2ea0c00b2ea00000008400000000rw- .bssc00b2f28c00b2f28000001e400000000rw- .neardata
c00b3110c00b31100000005000000000r–c00b3110c00b31100000005000000000r– .rodata
c00b3160c00b31600000012000000000rw-c00b3160c00b31600000012000000000rw- .cio
c00b3400c00b340000001fa800001fa8r-xc00b3400c00b34000000020000000200r-x .vecsc00b3600c00b360000001da800001da8r– .cinitsystemHeap被分配到了L2ROM里面,可是L2ROM用户自己不是没法使用嘛,而且我的平台配置文件都是把程序数据堆栈都放到了DDR里面,但是systemHeap怎么跑到L2ROM里面去了呢?
,
Shine:
在cmd文件里没看到分配systemHeap,在cfg文件里分配systemHeap试试。
Program.sectMap["systemHeap"] = "DDR2";
,
user6520474:
感谢,systemHeap已经分配到DDR里面了systemHeap: load > DDR
map文件中也有了相应的段,但是我单步调试malloc函数还是会调进exit.c,console提示ti.sysbios.gates.GateMutex: line 99: assertion failure: A_badContext: bad calling context. See GateMutex API doc for details.我的malloc函数是在串口中断的中断服务函数里面写的
xdc.runtime.Error.raise: terminating executionsystemHeap
*0c000000000100000UNINITIALIZEDc000000000100000app_pe674.oe674 (systemHeap)
,
Shine:
请问malloc函数放在中断外会有这个问题吗?