CMD文件编写
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
F2812的CMD文件的编写
CMD文件里包含三部分内容:
1)输入/输出定义:
.obj文件:链接器要链接的目标文件;
.lib文件:链接器要链接的库文件;
.map文件:链接器生成的交叉索引文件;
.out文件:链接器生成的可执行代码;
链接器选项
2)MEMORY命令:描述系统实际的硬件资源
3)SECTIONS命令:描述“段”如何定位
F2812的CMD文件只包含后两部分,现对它的编写做一下总结:
(一)用于调试时用,取名为SRAM.CMD
(二)用于烧写到FLASH中时用,取名为FLASH.CMD
FLASH.CMD与SRAM.CMD基本一样,只是有两处改动:一是MEMORY中将你的程序代码部分映射到FLASH空间里;二是在SECTIONS中添加一个用户定义的起始段,起始段的代码如下:
//User Defined Sections , Used by file DSP28_CodeStartBranch.asm
codestart : > BEGIN, PAGE = 0
其中DSP28_CodeStartBranch.asm中的关键代码为:
.ref _c_int00
.sect “codestart”
Code_start:
LB _c_int00
.end
这里有个比较标准的F2812的CMD文件,可以供大家借鉴使用:
MEMORY
{s
PAGE 0:
ZONE0 : origin = 0x002000, length = 0x002000
ZONE1 : origin = 0x004000, length = 0x002000
RAML0 : origin = 0x008000, length = 0x001000
ZONE2 : origin = 0x080000, length = 0x080000
ZONE6 : origin = 0x100000, length = 0x080000
OTP: origin = 0x3D7800, length = 0x000800
FLASHJ : origin = 0x3D8000, length = 0x002000
FLASHI : origin = 0x3DA000, length = 0x002000
FLASHH : origin = 0x3DC000, length = 0x004000
FLASHG : origin = 0x3E0000, length = 0x004000
FLASHF : origin = 0x3E4000, length = 0x004000
FLASHE : origin = 0x3E8000, length = 0x004000
FLASHD : origin = 0x3EC000, length = 0x004000
FLASHC : origin = 0x3F0000, length = 0x004000 FLASHA: origin = 0x3F6000, length = 0x002000 BEGIN_H0 : origin = 0x3F8000, length = 0x000002 BEGIN_FLASH : origin = 0x3F7FF6, length = 0x000002 PRAMH0 : origin = 0x3F8002, length = 0x001FFE ZONE7 : origin = 0x3FC000, length = 0x003FC0 ROM : origin = 0x3FF000, length = 0x000FC0 RESET : origin = 0x3FFFC0, length = 0x000002 VECTORS : origin = 0x3FFFC2, length = 0x00003E PAGE 1 :
R AMM0 : origin = 0x000000, length = 0x000400 RAMM1 : origin = 0x000400, length = 0x000400
DEV_EMU : origin = 0x000880, length = 0x000180 FLASH_REGS : origin = 0x000A80, length = 0x000060 CSM : origin = 0x000AE0, length = 0x000010
XINTF : origin = 0x000B20, length = 0x000020 CPU_TIMER0 : origin = 0x000C00, length = 0x000008 CPU_TIMER1 : origin = 0x000C08, length = 0x000008 CPU_TIMER2 : origin = 0x000C10, length = 0x000008 PIE_CTRL : origin = 0x000CE0, length = 0x000020 PIE_VECT : origin = 0x000D00, length = 0x000100 ECAN_A: origin = 0x006000, length = 0x000100 ECAN_AMBOX : origin = 0x006100, length = 0x000100
SYSTEM : origin = 0x007010, length = 0x000020 SPI_A: origin = 0x007040, length = 0x000010
SCI_A: origin = 0x007050, length = 0x000010 XINTRUPT : origin = 0x007070, length = 0x000010 GPIOMUX : origin = 0x0070C0, length = 0x000020 GPIODA T : origin = 0x0070E0, length = 0x000020 ADC : origin = 0x007100, length = 0x000020
EV_A: origin = 0x007400, length = 0x000040
EV_B : origin = 0x007500, length = 0x000040
SCI_B : origin = 0x007750, length = 0x000010 MCBSP_A: origin = 0x007800, length = 0x000040
RAML1 : origin = 0x009000, length = 0x001000 FLASHB : origin = 0x3F4000, length = 0x002000 CSM_PWL : origin = 0x3F7FF8, length = 0x000008 DRAMH0 : origin = 0x3f9000, length = 0x001000
}
SECTIONS
{