Part Number:TMS320F28377D
ram地址只有在分配为bss段的情况下,才会有少量的已初始化不为零的数据。在不分配段的情况下,理论上应该都是默认清零且没有任何数据。但是我观察memory,debug后,地址中存在大量数据,为什么?地址0xD000~0xF000之间我是没有使用的。
shuaitongchen:
没有人知道原因么?
,
Ben Qin:
你好,GSxRAMs在CPU1和CPU2的子系统之间是共享的,有可能是这个问题,您是否使用了两个CPU?
,
shuaitongchen:
只用了cpu1,没有使用cpu2
,
Ben Qin:
好的,我咨询一下资深工程师,一旦有回复立即回复给您。
,
shuaitongchen:
好的,谢谢!顺便说一下,刚上电的时候(不进行debug),将0xD000~0xF000之间的数据串口打印出来,里面的数据也是不全部为零,但是比debug时候少了很多,只有几十个字节不为零。但是不管什么模式,理论上应该全部为0才对。
,
Ben Qin:
你好,根据您附加的链接器命令文件图片,.bss 段似乎从0xF000开始、长度为0x7000。 您的存储器浏览器图像显示了0xD000处的内容。 能否附加完整的链接器命令文件?
,
shuaitongchen:
MEMORY{PAGE 0 : /* Program Memory */ /* Memory (RAM/FLASH) blocks can be moved to PAGE1 for data allocation */ /* BEGIN is used for the "boot to Flash" bootloader mode */
BEGIN : origin = 0x080000, length = 0x000002 //RAMM0 : origin = 0x000122, length = 0x0002DE RAMD0 : origin = 0x00B000, length = 0x000800 //RAMLS0 : origin = 0x008000, length = 0x000800 //RAMLS1 : origin = 0x008800, length = 0x000800 //RAMLS2 : origin = 0x009000, length = 0x000800 //RAMLS3 : origin = 0x009800, length = 0x000800 RAMLS : origin = 0x008000, length = 0x002000
RAMLS4 : origin = 0x00A000, length = 0x000800 RunRAMGS : origin = 0x017000, length = 0x005000 //RAMGS14 : origin = 0x01A000, length = 0x001000 // RAMGS15 : origin = 0x01B000, length = 0x001000 RESET : origin = 0x3FFFC0, length = 0x000002 // 向量表首地址 /* Flash sectors */ // FLASHA : origin = 0x080002, length = 0x001FFE/* on-chip Flash */ //FLASHB : origin = 0x082000, length = 0x002000 /* on-chip Flash */ //FLASHC : origin = 0x084000, length = 0x002000 /* on-chip Flash */ // FLASHD : origin = 0x086000, length = 0x002000 /* on-chip Flash */ //FLASHE : origin = 0x088000, length = 0x008000 /* on-chip Flash */ // FLASHF : origin = 0x090000, length = 0x008000 /* on-chip Flash */ // FLASHG : origin = 0x098000, length = 0x008000 /* on-chip Flash */ // FLASHH : origin = 0x0A0000, length = 0x008000 /* on-chip Flash */ // FLASHI : origin = 0x0A8000, length = 0x008000 /* on-chip Flash */ // FLASHJ : origin = 0x0B0000, length = 0x008000 /* on-chip Flash */ // FLASHK : origin = 0x0B8000, length = 0x002000 /* on-chip Flash */ // FLASHL : origin = 0x0BA000, length = 0x002000 /* on-chip Flash */ // FLASHM : origin = 0x0BC000, length = 0x002000 /* on-chip Flash */ // FLASHN : origin = 0x0BE000, length = 0x002000 /* on-chip Flash */
BOOTLoader : origin = 0x080002, length = 0x07FFE /* BOOTLoader */ /* 32K*/ UserAPP : origin = 0x088000, length = 0x018000 /* UserAPP */ /* 96K */ BackupAPP : origin = 0x0A0000, length = 0x018000 /* BackupAPP */ /* 96K */ UserDATA : origin = 0x0B8000, length = 0x08000 /* UserDATA */ /* 32K */
PAGE 1 : /* Data Memory */ /* Memory (RAM/FLASH) blocks can be moved to PAGE0 for program allocation */
BOOT_RSVD : origin = 0x000002, length = 0x000120 /* Part of M0, BOOT rom will use this for stack */ //RAMM1 : origin = 0x000400, length = 0x000400 /* on-chip RAM block M1 */ StackRAM : origin = 0x000122, length = 0x0006DE RAMD1 : origin = 0x00B800, length = 0x000800
RAMLS5 : origin = 0x00A800, length = 0x000800
RAMGS01 : origin = 0x00C000, length = 0x001000 //RAMGS0 : origin = 0x00C000, length = 0x001000 //RAMGS1 : origin = 0x00D000, length = 0x001000 //RAMGS2 : origin = 0x00E000, length = 0x001000 BssRAMGS : origin = 0x00F000, length = 0x007000 //RAMGS3 : origin = 0x00F000, length = 0x001000 //RAMGS4 : origin = 0x010000, length = 0x001000 //RAMGS5 : origin = 0x011000, length = 0x001000 //RAMGS6 : origin = 0x012000, length = 0x001000 //RAMGS7 : origin = 0x013000, length = 0x001000 //RAMGS8 : origin = 0x014000, length = 0x001000 //RAMGS9 : origin = 0x015000, length = 0x001000
// RAMGS10 : origin = 0x016000, length = 0x001000 // RAMGS11 : origin = 0x017000, length = 0x001000 // RAMGS12 : origin = 0x018000, length = 0x001000 // RAMGS13 : origin = 0x019000, length = 0x001000
CPU2TOCPU1RAM : origin = 0x03F800, length = 0x000400 CPU1TOCPU2RAM : origin = 0x03FC00, length = 0x000400}
SECTIONS{ /* Allocate program areas: */ .cinit : > BOOTLoader PAGE = 0, ALIGN(4) .pinit : > BOOTLoader, PAGE = 0, ALIGN(4) .text : >> BOOTLoader PAGE = 0, ALIGN(4) codestart : > BEGIN PAGE = 0, ALIGN(4) /* ramfuncs : LOAD = BOOTLoader, RUN = RunRAMLS, LOAD_START(_RamfuncsLoadStart), LOAD_SIZE(_RamfuncsLoadSize), LOAD_END(_RamfuncsLoadEnd), RUN_START(_RamfuncsRunStart), RUN_SIZE(_RamfuncsRunSize), RUN_END(_RamfuncsRunEnd), PAGE = 0, ALIGN(4) */
ramfuncs { -l F021_API_F2837xD_FPU32.lib }
LOAD = BOOTLoader, RUN = RunRAMGS, LOAD_START(_RamfuncsLoadStart), LOAD_SIZE(_RamfuncsLoadSize), LOAD_END(_RamfuncsLoadEnd), RUN_START(_RamfuncsRunStart), RUN_SIZE(_RamfuncsRunSize), RUN_END(_RamfuncsRunEnd), PAGE = 0,ALIGN(4)
/* Allocate uninitalized data sections: */ .stack : > StackRAM PAGE = 1 //.stack : > RAMM1 PAGE = 1 //.ebss : >> RAMLS5 | RAMGS0 | RAMGS1 PAGE = 1 .ebss : >> BssRAMGS PAGE = 1 .esysmem : > RAMLS5 PAGE = 1
/* Initalized sections go in Flash */ .econst : >> BOOTLoader PAGE = 0, ALIGN(4) .switch : > BOOTLoader PAGE = 0, ALIGN(4) // .reset : > RESET, PAGE = 0, TYPE = DSECT /* not used, */
Filter_RegsFile : > RAMGS01, PAGE = 1 SHARERAMGS0 : > RAMGS01, PAGE = 1 SHARERAMGS1 : > RAMGS01, PAGE = 1 ramgs0 : > RAMGS01, PAGE = 1 ramgs1 : > RAMGS01, PAGE = 1 /* Flash Programming Buffer */ BufferDataSection : > RAMD1, PAGE = 1, ALIGN(4)
#ifdef __TI_COMPILER_VERSION #if __TI_COMPILER_VERSION >= 15009000 .TI.ramfunc : {} LOAD = FLASHD, RUN = RAMLS0 | RAMLS1 | RAMLS2 |RAMLS3, LOAD_START(_RamfuncsLoadStart), LOAD_SIZE(_RamfuncsLoadSize), LOAD_END(_RamfuncsLoadEnd), RUN_START(_RamfuncsRunStart), RUN_SIZE(_RamfuncsRunSize), RUN_END(_RamfuncsRunEnd), PAGE = 0, ALIGN(4) #endif#endif //Inter-Process Communication处理器间通信 /* The following section definitions are required when using the IPC API Drivers */ GROUP : > CPU1TOCPU2RAM, PAGE = 1 { PUTBUFFER PUTWRITEIDX GETREADIDX } GROUP : > CPU2TOCPU1RAM, PAGE = 1 { GETBUFFER : TYPE = DSECT GETWRITEIDX : TYPE = DSECT PUTREADIDX : TYPE = DSECT } //专为电机模块设计的SDFM滤波模块 /* The following section definition are for SDFM examples */ Filter1_RegsFile : > RAMGS01, PAGE = 1, fill=0x1111 Filter2_RegsFile : > RAMGS01, PAGE = 1, fill=0x2222 Filter3_RegsFile : > RAMGS01, PAGE = 1, fill=0x3333 Filter4_RegsFile : > RAMGS01, PAGE = 1, fill=0x4444 Difference_RegsFile : >RAMGS01, PAGE = 1, fill=0x3333 }
,
Ben Qin:
你好,未使用的段在复位时可能不会被初始化为零。 如果要对其进行零初始化,可以在链接器 cmd 文件中使用 FILL=0。
,
shuaitongchen:
其实刚开始0xD000~0xF000是使用的,就是因为发现代码运行有异常,进一步排查发现这个地址ram复位不全部为零,我才避开这一段空间
,
shuaitongchen:
而且,我还特别将0xD000~0XF000地址的数据与flash里面代码对比,发现一大段数据来自flash
,
Ben Qin:
你好,
shuaitongchen 说:发现一大段数据来自flash
您是想问为什么是吗?
,
shuaitongchen:
是的,fllash的数据怎么会跑到这段地址的。
,
Ben Qin:
你好,闪存工具使用 RAM 下载闪存 API 和应用程序映像,然后从 RAM 执行闪存 API,将应用程序映像编程到闪存中。 闪存编程结束后,调试复位应使 GEL 文件清除 RAM,因为它在复位函数中包含 RAM 初始化序列。
同时,请检查您的应用以确保所有变量都已初始化。 完成此操作后,您不应看到类似这样的问题。
闪存插件本身不会在闪存编程结束时调用 RAM 初始化序列,因为它不需要用于生产编程(对它们来说时间更短更好)-而且对于开发,您应该知道的,只要链接器命令文件中的所有已初始化段都映射到闪存,并且应用程序中的所有变量都已初始化,就不会出现任何问题。
如果您有更进一步的问题,请告诉我们。
,
shuaitongchen:
MEMORY{PAGE 0 : /* Program Memory */ /* Memory (RAM/FLASH) blocks can be moved to PAGE1 for data allocation */ /* BEGIN is used for the "boot to Flash" bootloader mode */
BEGIN : origin = 0x080000, length = 0x000002 RAMM0 : origin = 0x000122, length = 0x0002DE RAMD0 : origin = 0x00B000, length = 0x000800 RAMLS0 : origin = 0x008000, length = 0x000800 RAMLS1 : origin = 0x008800, length = 0x000800 RAMLS2 : origin = 0x009000, length = 0x000800 RAMLS3 : origin = 0x009800, length = 0x000800 RAMLS4 : origin = 0x00A000, length = 0x000800 RAMGS14 : origin = 0x01A000, length = 0x001000 /* Only Available on F28379D, F28377D, F28375D devices. Remove line on other devices. */ RAMGS15 : origin = 0x01B000, length = 0x001000 /* Only Available on F28379D, F28377D, F28375D devices. Remove line on other devices. */ RESET : origin = 0x3FFFC0, length = 0x000002
/* Flash sectors */ FLASHA : origin = 0x080002, length = 0x001FFE /* on-chip Flash */ FLASHB : origin = 0x082000, length = 0x002000 /* on-chip Flash */ FLASHC : origin = 0x084000, length = 0x002000 /* on-chip Flash */ FLASHD : origin = 0x086000, length = 0x002000 /* on-chip Flash */ FLASHE : origin = 0x088000, length = 0x008000 /* on-chip Flash */ FLASHF : origin = 0x090000, length = 0x008000 /* on-chip Flash */ FLASHG : origin = 0x098000, length = 0x008000 /* on-chip Flash */ FLASHH : origin = 0x0A0000, length = 0x008000 /* on-chip Flash */ FLASHI : origin = 0x0A8000, length = 0x008000 /* on-chip Flash */ FLASHJ : origin = 0x0B0000, length = 0x008000 /* on-chip Flash */ FLASHK : origin = 0x0B8000, length = 0x002000 /* on-chip Flash */ FLASHL : origin = 0x0BA000, length = 0x002000 /* on-chip Flash */ FLASHM : origin = 0x0BC000, length = 0x002000 /* on-chip Flash */ FLASHN : origin = 0x0BE000, length = 0x002000 /* on-chip Flash */
PAGE 1 : /* Data Memory */ /* Memory (RAM/FLASH) blocks can be moved to PAGE0 for program allocation */
BOOT_RSVD : origin = 0x000002, length = 0x000120 /* Part of M0, BOOT rom will use this for stack */ RAMM1 : origin = 0x000400, length = 0x000400 /* on-chip RAM block M1 */ RAMD1 : origin = 0x00B800, length = 0x000800
RAMLS5 : origin = 0x00A800, length = 0x000800
RAMGS0 : origin = 0x00C000, length = 0x001000 RAMGS1 : origin = 0x00D000, length = 0x001000 RAMGS2 : origin = 0x00E000, length = 0x001000 RAMGS3 : origin = 0x00F000, length = 0x001000 RAMGS4 : origin = 0x010000, length = 0x001000 RAMGS5 : origin = 0x011000, length = 0x001000 RAMGS6 : origin = 0x012000, length = 0x001000 RAMGS7 : origin = 0x013000, length = 0x001000 RAMGS8 : origin = 0x014000, length = 0x001000 RAMGS9 : origin = 0x015000, length = 0x001000 RAMGS10 : origin = 0x016000, length = 0x001000 RAMGS11 : origin = 0x017000, length = 0x001000 RAMGS12 : origin = 0x018000, length = 0x001000 /* Only Available on F28379D, F28377D, F28375D devices. Remove line on other devices. */ RAMGS13 : origin = 0x019000, length = 0x001000 /* Only Available on F28379D, F28377D, F28375D devices. Remove line on other devices. */
CPU2TOCPU1RAM : origin = 0x03F800, length = 0x000400 CPU1TOCPU2RAM : origin = 0x03FC00, length = 0x000400}
SECTIONS{ /* Allocate program areas: */ .cinit : > FLASHB PAGE = 0, ALIGN(4) .pinit : > FLASHB, PAGE = 0, ALIGN(4) .text : >> FLASHB | FLASHC | FLASHD | FLASHE PAGE = 0, ALIGN(4) codestart : > BEGIN PAGE = 0, ALIGN(4)
/* Allocate uninitalized data sections: */ .stack : > RAMM1 PAGE = 1 .ebss : >> RAMLS5 | RAMGS0 | RAMGS1 PAGE = 1 .esysmem : > RAMLS5 PAGE = 1
/* Initalized sections go in Flash */ .econst : >> FLASHF | FLASHG | FLASHH PAGE = 0, ALIGN(4) .switch : > FLASHB PAGE = 0, ALIGN(4)
.reset : > RESET, PAGE = 0, TYPE = DSECT /* not used, */
Filter_RegsFile : > RAMGS0, PAGE = 1
SHARERAMGS0 : > RAMGS0, PAGE = 1 SHARERAMGS1 : > RAMGS1, PAGE = 1 ramgs0 : > RAMGS0, PAGE = 1 ramgs1 : > RAMGS1, PAGE = 1/*#ifdef __TI_COMPILER_VERSION__ #if __TI_COMPILER_VERSION__ >= 15009000 .TI.ramfunc : {} LOAD = FLASHD, RUN = RAMLS0 | RAMLS1 | RAMLS2 |RAMLS3, LOAD_START(_RamfuncsLoadStart), LOAD_SIZE(_RamfuncsLoadSize), LOAD_END(_RamfuncsLoadEnd), RUN_START(_RamfuncsRunStart), RUN_SIZE(_RamfuncsRunSize), RUN_END(_RamfuncsRunEnd), PAGE = 0, ALIGN(4)// #else*/ ramfuncs : LOAD = FLASHD, RUN = RAMLS0 | RAMLS1 | RAMLS2 |RAMLS3, LOAD_START(_RamfuncsLoadStart), LOAD_SIZE(_RamfuncsLoadSize), LOAD_END(_RamfuncsLoadEnd), RUN_START(_RamfuncsRunStart), RUN_SIZE(_RamfuncsRunSize), RUN_END(_RamfuncsRunEnd), PAGE = 0, ALIGN(4) // #endif//#endif
/* The following section definitions are required when using the IPC API Drivers */ GROUP : > CPU1TOCPU2RAM, PAGE = 1 { PUTBUFFER PUTWRITEIDX GETREADIDX }
GROUP : > CPU2TOCPU1RAM, PAGE = 1 { GETBUFFER : TYPE = DSECT GETWRITEIDX : TYPE = DSECT PUTREADIDX : TYPE = DSECT }
/* The following section definition are for SDFM examples */ Filter1_RegsFile : > RAMGS1, PAGE = 1, fill=0x1111 Filter2_RegsFile : > RAMGS2, PAGE = 1, fill=0x2222 Filter3_RegsFile : > RAMGS3, PAGE = 1, fill=0x3333 Filter4_RegsFile : > RAMGS4, PAGE = 1, fill=0x4444 Difference_RegsFile : >RAMGS5, PAGE = 1, fill=0x3333}
/*//===========================================================================// End of file.//===========================================================================*/
,
shuaitongchen:
这是我临时编写的测试用例,cmd几乎没动,程序也很简单,但是0xD000~0xF000依然在debug时有大量数据
,
Ben Qin:
shuaitongchen 说:.cinit : > FLASHB PAGE = 0, ALIGN(4)
你好,FLASHB后是否少了一个逗号。
,
shuaitongchen:
吧里有人知道为什么吗?????等待大神,请确实知道原因且经过测试的人帮忙解答,谢谢!
,
Ben Qin:
你好,我已将问题升级到英文论坛,工程师正在跟进并尝试解决您的问题,请给我们进一步的信息以帮助我们更好的解决您的问题。
Ben Qin 说:你好,FLASHB后是否少了一个逗号。
这是工程师的回复。查看最新进展您可以访问:e2e.ti.com/…/tms320f28377d-ram-addresses-0xd000-to-0xf000-size-is-0x2000-why-did-power-on-debug-just-reset-have-a-lot-of-data
,
shuaitongchen:
你好,flashB后面加一个逗号后,观察memory现象还和以前一样
,
Ben Qin:
你好,调试复位会清除里面的内容吗,请试一下。
,
Ben Qin:
你好,请问问题解决了吗?您还有其他问题吗?