下表展示TMS320F2808的存储器映射:

TMS320F28xxx系列控制器内置RAM,可以被分配为一个单独的段,或者更多的段,因为它是连续的存储器映射。如上图所示,F2808有映射到存储器空间的L0,L1和H0 SARAMs,允许生成一个大的内存块,这个块可以被CMD文件的MEMORY部分如下定义:
其余的也可以定义在MEMORY部分,完整的内存分配,请参见相关文件中的CMD文件。
链接器命令文件的第二部分是SECTIONS。这是实际编译器把段连接到的存储区。所有DSP28xxx_CodeStartBranch.asm 和 DSP28xxx_SectionCopy_nonBIOS.asm的段都被装载到flash中运行,这部分如下所示分配:
codestart : > BEGIN_FLASH, PAGE = 0 /* Used by file CodeStartBranch.asm */
wddisable : > FLASH_AB, PAGE = 0 /* Used by file CodeStartBranch.asm */
copysections : > FLASH_AB, PAGE = 0 /* Used by file SectionCopy.asm */
codestart : > BEGIN_FLASH, PAGE = 0 /* Used by file CodeStartBranch.asm */
wddisable : > FLASH_AB, PAGE = 0 /* Used by file CodeStartBranch.asm */
copysections : > FLASH_AB, PAGE = 0 /* Used by file SectionCopy.asm */
其他被初始化的段被下载到flash,但是在ram中运行。这是通过load和run指令来实现。下面展示一个例子:
.text : LOAD = FLASH_AB, PAGE = 0 /* Load section to Flash */
RUN = RAM_H0L0L1,PAGE = 0 /* Run section from RAM */
LOAD_START(_text_loadstart),
RUN_START(_text_runstart),
SIZE(_text_size)
.text : LOAD = FLASH_AB, PAGE = 0 /* Load section to Flash */
RUN = RAM_H0L0L1,PAGE = 0 /* Run section from RAM */
LOAD_START(_text_loadstart),
RUN_START(_text_runstart),
SIZE(_text_size)
为了获得与一个段相关联的特定地址,如上所示,使用了LOAD_START, RUN_START, 和SIZE指令。这些指令的地址和大小在DSP28xxx_SectionCopy_nonBIOS.asm文件使用到,用以在复制过程中指向正确的地址。DSP28xxx_SectionCopy_nonBIOS.asm把这些创建为全局变量,如下图所示
.global _cinit_loadstart, _cinit_runstart, _cinit_size
.global _const_loadstart, _const_runstart, _const_size
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/ruanjian/article-33664-5.html
中国必须时刻准备着
小王子