CCS中CMD文件的作用
cmd 文件用于DSP 代码的定位。由于DSP 的编译器的编译结果是未定位的,DSP没有操作系统来定位执行代码,每个客户设计的DSP 系统的配置也不尽相同,因此需要用户自己定义代码的安装位置。安装位置是指,编译完成的代码是存放在dsp的那个位置,程序空间RAM或者数据空间RAM,起始地址以及长度。
以C5000 为例,基本格式为:
-o sample.out //生成.OUT文件
-m sample.map //生成MAP文件,MAP文件中包含程序的section信息,用于自举表信息的编写和烧写flash
-stack 100 //开辟堆栈
sample.obj meminit.obj
-l rts.lib //链接rts.lib库
MEMORY
{
PAGE 0: VECT: origin = 0xff80, length 0x80 //page0一般是程序空间,
PAGE 0: PROG: origin = 0x2000, length 0x400
PAGE 1: DATA: origin = 0x800, length 0x400 //page1一般是数据空间
}
SECTIONS
{
.vectors : {} >VECTPAGE 0 //.vectors段是中断向量表,存放在程序空间VECT部分 //
.text : {} >PROG PAGE 0 // .text 是程序段,放在程序空间 PROG部分
.data : {} >PROG PAGE 0 //.data是数据段,放在程序空间PROG部分,紧接.text 之后
.cinit : {} >PROG PAGE 0 //.cinit 段包含了变量初始化记录
.bss : {} >DATA PAGE 1 //.bss段是未初始化段,放在数据空间DATA部分
}
连接器会自动创建以下的段:
The C54x compiler creates the following sections:
初始化段包含数据和可执行代码。 The C/C++ compiler creates the following initialized seconst的作用
ctions:
.cinit section:包含变量和常量的初始化表.
.pinit section contains the table for calling global object constructors at runtime.
.const section contains string constants and data defined with the C/C++ qualifier const (provided the constant is not also defined as volatile).
The .switch section contains tables for large switch statements.
The .text section contains all the executable code as well as string literals and compiler-generated constants.
Uninitialized sections reserve space in memory (usually RAM). A program can use this space at runtime for creating and storing variables. The compiler creates the following uninitialized sections:
The .bss section reserves space for global and static variables. When you specify the -c li
nker option, at program startup, the C/C++ boot routine copies data out of the .cinit section (which can be in ROM) and stores it in the .bss section.
The .stack section allocates memory for the C/C++ system stack. This memory passes variables.
The .sysmem section reserves space for dynamic memory allocation. The reserved space is used by the malloc, calloc, and realloc functions. If a C/C++ program does not use these functions, the compiler does not create the .sysmem section.
在一般的使用中,主要会用到.cinit .bss .stack段
在自举表中,.vect .text .cinit 这三个段是必不可少的
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论