【原创】TI C2833x编程环境介绍---(10)cmd文件的具体描述
0赞- 【原创】TI C2833x编程环境介绍---(10)cmd文件的具体描述
The linker concatenates each section from all input files, allocating memory to each section based on its length and location as specified by the MEMORY and SECTIONS commands in the linker command file.链接器将输入文件中的每一个段链接起来,然后根据CMD文件中的MEMORY与SECTIONS命令的参数,将相应位置、长度的存储空间分配给段。其图示如图1所示。
图1 链接的示意图
存储器映射的描述
存储段描述了目标系统中不同存储空间的分配情况,其格式为:Name: origin = 0x????, length = 0x????。(?代表十六进制的书,从0到F)。例如,我们想定义一段FLASH存储空间,其长度为64kw,开始位置为0x300000,则其格式为
MEMORY
{
FLASH: origin = 0x300000 , length = 0x040000
}
需要说明的是:这里描述存储空间大小的时候用到了kw这个单位,即kilo-word(千字)。与通常我们32位PC上一个“字”是8bit不同,我们32位DSP里面一个word是32个bit。理解起来倒不会有难度,因为我们目前的C2833x DSP都是32位字长的。
用类似的格式,我们可以定义RAM空间的划分,例如M0SARAM、M1SARAM,则有
MEMORY
{
M0SARAM: origin = 0x000000 , length = 0x0400
M1SARAM: origin = 0x000400 , length = 0x0400
}
再回忆一下前面的内容,我们知道2833x的存储空间分为数据空间与程序空间,这样就产生了“页(page)”的概念。按照TI公司的规范,我们一般命名Page 0为程序空间,Page 1为数据空间。通常我们用到的2833x的存储空间划分可以如下面的例子所示:
MEMORY
{
PAGE 0 :
/* BEGIN is used for the "boot to SARAM" bootloader mode */
/* BOOT_RSVD is used by the boot ROM for stack. */
/* This section is only reserved to keep the BOOT ROM from */
/* corrupting this area during the debug process */
BEGIN : origin = 0x000000, length = 0x000002 /* Boot to M0 will go here */
BOOT_RSVD : origin = 0x000002, length = 0x00004E /* Part of M0, BOOT rom will use this for stack */
RAMM0 : origin = 0x000050, length = 0x0003B0
RAML0 : origin = 0x008000, length = 0x001000
RAML1 : origin = 0x009000, length = 0x002000 /* length = 0x001000*/
/*RAML2 : origin = 0x00A000, length = 0x001000 */
RAML3 : origin = 0x00B000, length = 0x001000
ZONE7A : origin = 0x200000, length = 0x00FC00 /* XINTF zone 7 - program space */
CSM_RSVD : origin = 0x33FF80, length = 0x000076 /* Part of FLASHA. Program with all 0x0000 when CSM is in use. */
CSM_PWL : origin = 0x33FFF8, length = 0x000008 /* Part of FLASHA. CSM password locations in FLASHA */
ADC_CAL : origin = 0x380080, length = 0x000009
RESET : origin = 0x3FFFC0, length = 0x000002
IQTABLES : origin = 0x3FE000, length = 0x000b50
IQTABLES2 : origin = 0x3FEB50, length = 0x00008c
FPUTABLES : origin = 0x3FEBDC, length = 0x0006A0
BOOTROM : origin = 0x3FF27C, length = 0x000D44
PAGE 1 :
RAMM1 : origin = 0x000400, length = 0x000400 /* on-chip RAM block M1 */
RAML4 : origin = 0x00C000, length = 0x001000
RAML5 : origin = 0x00D000, length = 0x001000
RAML6 : origin = 0x00E000, length = 0x001000
RAML7 : origin = 0x00F000, length = 0x001000
ZONE7B : origin = 0x20FC00, length = 0x000400 /* XINTF zone 7 - data space */
}