大佬们,有2个问题求助。第一个问题:我在cfg文件里创建了BIOS.heapSize =0x00008000,名字为systemHeap,用来给malloc函数提供分配的内存。我设置platform文件把程序数据和栈都放在DDR中,在cmd文件中 显示 .sysmem: load > DDR(.sysmem不是代表malloc函数产生的内存嘛,DDR的地址是正确的),但是在map文件中,明显是把systemHeap放到了L2ROM中,这就和cmd文件里面冲突了呀,而且编译的时候提示
Description Resource Path Location Type
#10247-D null: creating output section "systemHeap" without a SECTIONS specification 716_algorithm C/C++ Problem
这是咋回事啊?
第二个问题:我写的malloc函数还不能用,设置断点看,只要执行到malloc就进入exit.c。
希望大佬们不吝赐教!
图为BIOS.heapSize配置
下面为cmd文件SECTIONS配置
SECTIONS
{
.text: load >> DDR
.ti.decompress: load > DDR
.stack: load > DDR
GROUP: 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 > DDR
xdc.meta: load > DDR, type = COPY
}
下面为map文件
SEGMENT ALLOCATION MAP
run origin load origin length init length attrs members
———- ———– ———- ———– —– ——-
11700000 11700000 00008000 00000000 rw-
11700000 11700000 00008000 00000000 rw- systemHeap
c0000000 c0000000 0005e4b4 00000000 rw-
c0000000 c0000000 0005e4b4 00000000 rw- .far
c005e4b8 c005e4b8 00000008 00000008 r–
c005e4b8 c005e4b8 00000008 00000008 r– .const.1
c005e4c0 c005e4c0 0004fb4e 0004fb4e r-x
c005e4c0 c005e4c0 0004bae0 0004bae0 r-x .text
c00a9fa0 c00a9fa0 0000406e 0000406e r– .const.2
c00ae010 c00ae010 00004b04 00000000 rw-
c00ae010 c00ae010 00002800 00000000 rw- .stack
c00b0810 c00b0810 00002304 00000000 rw- .fardata
c00b2b14 c00b2b14 00000388 00000388 r–
c00b2b14 c00b2b14 00000388 00000388 r– .switch
c00b2ea0 c00b2ea0 0000026c 00000000 rw-
c00b2ea0 c00b2ea0 00000084 00000000 rw- .bss
c00b2f28 c00b2f28 000001e4 00000000 rw- .neardata
c00b3110 c00b3110 00000050 00000000 r–
c00b3110 c00b3110 00000050 00000000 r– .rodata
c00b3160 c00b3160 00000120 00000000 rw-
c00b3160 c00b3160 00000120 00000000 rw- .cio
c00b3400 c00b3400 00001fa8 00001fa8 r-x
c00b3400 c00b3400 00000200 00000200 r-x .vecs
c00b3600 c00b3600 00001da8 00001da8 r– .cinit
SECTION ALLOCATION MAP
output attributes/
section page origin length input sections
——– —- ———- ———- —————-
.stack 0 c00ae010 00002800 UNINITIALIZED
c00ae010 00000008 boot.ae674 : boot.oe674 (.stack)
c00ae018 000027f8 –HOLE–
.bss 0 c00b2ea0 00000084 UNINITIALIZED
c00b2ea0 00000018 hal_timer_bios.ae674 : lltimer.oe674 (.bss)
c00b2eb8 00000014 stk6.ae674 : igmp.oe674 (.bss)
c00b2ecc 00000008 netctrl_min.ae674 : netctrl.oe674 (.bss)
c00b2ed4 00000008 nettool.ae674 : daemon.oe674 (.bss)
c00b2edc 00000008 stk6.ae674 : ip.oe674 (.bss)
c00b2ee4 00000004 nettool.ae674 : ipaddr.oe674 (.bss)
c00b2ee8 00000008 (.common:cexingjiao)
c00b2ef0 00000008 (.common:fangweijiao)
c00b2ef8 00000008 (.common:fitnessgbest)
c00b2f00 00000008 (.common:fuyangjiao)
c00b2f08 00000004 stk6.ae674 : ipv6_frag.oe674 (.bss)
c00b2f0c 00000004 : lli6.oe674 (.bss)
c00b2f10 00000004 : rtable.oe674 (.bss)
c00b2f14 00000004 ti.drv.omapl138.ae674 : ethdriver.oe674 (.bss)
c00b2f18 00000004 (.common:flag)
c00b2f1c 00000004 (.common:i)
c00b2f20 00000004 (.common:j)
.neardata* 0 c00b2f28 000001e4 UNINITIALIZED
c00b2f28 0000005c main.obj (.neardata)
c00b2f84 00000024 os.ae674 : mem.oe674 (.neardata)
c00b2fa8 00000020 ti.drv.omapl138.ae674 : ethdriver.oe674 (.neardata)
c00b2fc8 0000001c netctrl_min.ae674 : netctrl.oe674 (.neardata)
c00b2fe4 00000018 os.ae674 : task.oe674 (.neardata)
c00b2ffc 00000014 app_pe674.oe674 (.neardata)
c00b3010 00000014 stk6.ae674 : rtable.oe674 (.neardata)
c00b3024 00000010 UDP.obj (.neardata)
c00b3034 00000010 nettool.ae674 : daemon.oe674 (.neardata)
c00b3044 00000010 stk6.ae674 : bind6.oe674 (.neardata)
c00b3054 00000010 : igmp.oe674 (.neardata)
c00b3064 00000010 ti.drv.omapl138.ae674 : csl_emac.oe674 (.neardata)
c00b3074 0000000c stk6.ae674 : route6.oe674 (.neardata)
c00b3080 00000008 netctrl_min.ae674 : netsrv.oe674 (.neardata)
c00b3088 00000008 stk6.ae674 : exec.oe674 (.neardata)
c00b3090 00000008 : icmp.oe674 (.neardata)
c00b3098 00000008 : ip.oe674 (.neardata)
c00b30a0 00000008 : ipin.oe674 (.neardata)
c00b30a8 00000008 : ipv6_frag.oe674 (.neardata)
c00b30b0 00000008 : lli.oe674 (.neardata)
c00b30b8 00000008 : rtc.oe674 (.neardata)
c00b30c0 00000008 : tcp.oe674 (.neardata)
c00b30c8 00000008 : tcp6.oe674 (.neardata)
c00b30d0 00000008 : timer.oe674 (.neardata)
c00b30d8 00000004 Net.obj (.neardata)
c00b30dc 00000004 hal_timer_bios.ae674 : lltimer.oe674 (.neardata)
c00b30e0 00000004 nettool.ae674 : config.oe674 (.neardata)
c00b30e4 00000004 stk6.ae674 : bind.oe674 (.neardata)
c00b30e8 00000004 : ipfrag.oe674 (.neardata)
c00b30ec 00000004 : lli6.oe674 (.neardata)
c00b30f0 00000004 : lliin.oe674 (.neardata)
c00b30f4 00000004 : mld.oe674 (.neardata)
c00b30f8 00000004 : node.oe674 (.neardata)
c00b30fc 00000004 : pbm.oe674 (.neardata)
c00b3100 00000004 : sock6pcb.oe674 (.neardata)
c00b3104 00000004 : sockpcb.oe674 (.neardata)
c00b3108 00000004 ti.drv.omapl138.ae674 : csl_mdio.oe674 (.neardata)
.rodata 0 c00b3110 00000050 UNINITIALIZED
c00b3110 00000024 stk6.ae674 : ipv6.oe674 (.rodata)
c00b3134 00000020 app_pe674.oe674 (.rodata)
c00b3154 00000004 uartStdio.obj (.rodata)
c00b3158 00000008 DLX_JIESUAN.obj (.rodata)
.cinit 0 c00b3600 00001da8 c00b3600 00001c93 (.cinit..fardata.load) [load image, compression = rle]
c00b5293 00000067 (.cinit..neardata.load) [load image, compression = rle]
c00b52fa 00000053 (.cinit..rodata.load) [load image, compression = rle]
c00b534d 0000000d (.cinit..far.load) [load image, compression = rle]
c00b535a 0000000b (.cinit.systemHeap.load) [load image, compression = rle]
c00b5365 00000009 (.cinit..bss.load) [load image, compression = rle]
c00b536e 00000002 –HOLE– [fill = 0]
c00b5370 00000008 (__TI_handler_table)
c00b5378 00000030 (__TI_cinit_table)
.init_array* 0 c0000000 00000000 UNINITIALIZED
.vecs 0 c00b3400 00000200 c00b3400 00000200 app_pe674.oe674 (.vecs)
xdc.meta 0 c0000000 000000f0 COPY SECTION
c0000000 000000f0 app_pe674.oe674 (xdc.meta)
systemHeap
* 0 11700000 00008000 UNINITIALIZED
11700000 00008000 app_pe674.oe674 (systemHeap)
下图为我写的malloc函数
user6520474:
补充一下,我用的malloc函数占用的内存大约是2K
,
Nancy Wang:
需要在cmd中将systemHeap指向需要使用内存地址。
比如:
SECTIONS
{
systemHeap: load > DDR}
,
user6520474:
谢谢,可是cmd文件是自动生成的,怎么手动修改啊?
但是在map文件中,明显是把systemHeap放到了L2ROM中,L2ROM用户不是不能改嘛?
,
Nancy Wang:
可以创建自己的cmd。 7.3.3 Providing a Supplemental Linker Command File www.ti.com/…/spruex3v.pdf
map文件是根据cmd中的内存分配情况生成的,在cmd中将自定以的systemHeap重新分配内存空间就可以了。