ADS下的分散加载文件应用实例
2008-07-06 12:20
267 查看
ADS下的分散加载文件应用实例
load_region_name start_address | "+"offset [attributes] [max_size]
{
execution_region_name start_address | "+"offset [attributes][max_size]
{
module_select_pattern ["("
("+" input_section_attr | input_section_pattern)
([","] "+" input_section_attr | "," input_section_pattern)) *
")"]
}
}
加载区(load_region):指用来保存永久性数据(程序和只读变量)的区域;
执行区(execution_region):程序执行时所表现出来的区域;程序执行时,从加载区域将数据复制到执行区;
load_region_name(加载区域名): 用于Linker区别不同的加载区域,最多31个字符;
start_address:起始地址;
+offset:前一个加载区域尾地址+offset,做为当前的起始地址,且offset为0或4的倍数;
attributes: PI 与地址无关
RELOC 重新部署
OVERLAY 覆盖,允许多个可执行区域在同一个地址,ADS不支持
ABSOLUTE 绝对地址(默认) max_size:该加载区域的大小;
execution_region_name:执行区域名;
start_address:链接是目标存放的地址,必须字对齐;
+offset:同上;
attributes: PI 与地址无关
OVERLAY 覆盖
ABSOLUTE 绝对地址(默认)
FIXED 固定地址
UNINIT 不用初始化该区域的ZI段
module_select_pattern:目标文件滤波器,支持通配符“*”和“?”;*.o匹配所有目标,* (或“.ANY”)匹配所有目标文件和库。
input_section_attr:每个input_section_attr必须跟随在“+”后;且大小写不敏感;
RO-CODE或CODE
RO-DATA或CONST
RO或TEXT, selects both RO-CODE and RO-DATA
RW-DATA
RW-CODE
RW或DATA, selects both RW-CODE and RW-DATA
ZI或BSS
ENTRY, that is a section containing an ENTRY point.
FIRST,用于指定存放在一个执行区域的第一个或最后一个区域
LAST,同上
input_section_pattern:段名;
汇编中指定段:
AREA vectors, CODE, READONLY
C中指定段:
#pragma arm section [sort_type[[=]"name"]] [,sort_type="name"]*
sort_type: code
rwdata
rodata
zidata
如果“sort_type”指定了但没有指定“name”,那么之前的修改的段名将被恢复成默认值。
#pragma arm section将恢复所有段名为默认值。
一般应用:
#pragma arm section rodata = "sram", code ="sram"
此时“rodata”和“code”将定位在“sram”段中。
#pragma arm section
程序中对某区域的引用方法:
Load$$region_name$$Base Load address of the region.
Image$$region_name$$Base Execution address of the region.
Image$$region_name$$Length Execution region length in bytes (multiple of 4).
Image$$region_name$$Limit Address of the byte beyond the end of the execution region.
Image$$region_name$$ZI$$Base Execution address of the ZI output section in this region.
Image$$region_name$$ZI$$Length Length of the ZI output section in bytes (multiple of 4).
Image$$region_name$$ZI$$Limit Address of the byte beyond the end of the ZI output sectionin the execution region.
SectionName$$Base Input Address of the start of the consolidated section called SectionName.
SectionName$$Limit Input Address of the byte beyond the end of the consolidated section called SectionName.
Base:首地址;
Limit:尾地址;
region_name:RO、RW、ZI、load_region_name、execution_region_name;
例如: RAM1区域的首地址:Image$$RAM1$$Base sram段首地址: sram$$Base 注意:“sram$$Base”不一定等于“Image$$RAM2$$Base”;
实例一:
起始地址 大小
ROM: 0x00000000 256K 0x1fc 保留为加密字
RAM 0x40000000 16K
SRAM 0x80000000 512K
程序在ROM中运行; RAM主要用于程序堆栈及优先用于存放部分变量; SRAM速度慢,主要用于存放大的数据表。
LOAD_ROM1 0x00000000 ; 指定该加载区域首地址
{
EXEC_ROM1 +0 0x1f8 ; 没有前一加载区域,所以该执行区域首地址为加载去首地址 ; 并指定该区域长度
{
Startup.o (vectors, +FIRST) ; 目标文件的vectors段放在该执行区域的第一段
irq.o (+RO) ; 目标文件的所有 RO段放在该执行区域
swi.o (+RO)
}
}
LOAD_ROM2 0x00000200 ; 第二个加载区域
{
EXEC_ROM2 +0 0x3e600
{
* (+RO) ; 所有目标文件和库文件中的 RO段存放在该区域
}
RAM1 0x40000000 0x4000
{
* (+RW, +ZI) ; 所有目标文件和库文件的 RW和 ZI段存放在该区域
}
SRAM2 0x80000000 0x80000
{ * (sram) ; 所有目标文件中的 sram段存放在该区域
}
}
实例二:
Load_region1 0x00000000 0x1fc
{ EXEC_ROM1 +0
{
Startup.o (vectors, +FIRST)
irq.o (+RO)
}
}
Load_region2 0x00000200 0x3e600
{
EXEC_ROM2 +0
{
* (+RO)
}
Exec_RAM1 0x40000000 OVERLAY 0x4000 ; 覆盖,所以必须自己初始化RW和ZI区域
{
* (+RW, +ZI)
}
Exec_IAP 0x40000000 OVERLAY 0x80000 ; 覆盖,所以执行前应该COPY到执行区
{
iap.o (+RO)
}
}
此例中iap.o定义在 RAM中运行,在调用iap.c中函数之前应该将其从Load$$region_name$$Base复制到Image$$region_name$$Base区域,而在系统启动前也应该将RW和ZI初始化好(__main不无效了)。
load_region_name start_address | "+"offset [attributes] [max_size]
{
execution_region_name start_address | "+"offset [attributes][max_size]
{
module_select_pattern ["("
("+" input_section_attr | input_section_pattern)
([","] "+" input_section_attr | "," input_section_pattern)) *
")"]
}
}
加载区(load_region):指用来保存永久性数据(程序和只读变量)的区域;
执行区(execution_region):程序执行时所表现出来的区域;程序执行时,从加载区域将数据复制到执行区;
load_region_name(加载区域名): 用于Linker区别不同的加载区域,最多31个字符;
start_address:起始地址;
+offset:前一个加载区域尾地址+offset,做为当前的起始地址,且offset为0或4的倍数;
attributes: PI 与地址无关
RELOC 重新部署
OVERLAY 覆盖,允许多个可执行区域在同一个地址,ADS不支持
ABSOLUTE 绝对地址(默认) max_size:该加载区域的大小;
execution_region_name:执行区域名;
start_address:链接是目标存放的地址,必须字对齐;
+offset:同上;
attributes: PI 与地址无关
OVERLAY 覆盖
ABSOLUTE 绝对地址(默认)
FIXED 固定地址
UNINIT 不用初始化该区域的ZI段
module_select_pattern:目标文件滤波器,支持通配符“*”和“?”;*.o匹配所有目标,* (或“.ANY”)匹配所有目标文件和库。
input_section_attr:每个input_section_attr必须跟随在“+”后;且大小写不敏感;
RO-CODE或CODE
RO-DATA或CONST
RO或TEXT, selects both RO-CODE and RO-DATA
RW-DATA
RW-CODE
RW或DATA, selects both RW-CODE and RW-DATA
ZI或BSS
ENTRY, that is a section containing an ENTRY point.
FIRST,用于指定存放在一个执行区域的第一个或最后一个区域
LAST,同上
input_section_pattern:段名;
汇编中指定段:
AREA vectors, CODE, READONLY
C中指定段:
#pragma arm section [sort_type[[=]"name"]] [,sort_type="name"]*
sort_type: code
rwdata
rodata
zidata
如果“sort_type”指定了但没有指定“name”,那么之前的修改的段名将被恢复成默认值。
#pragma arm section将恢复所有段名为默认值。
一般应用:
#pragma arm section rodata = "sram", code ="sram"
此时“rodata”和“code”将定位在“sram”段中。
#pragma arm section
程序中对某区域的引用方法:
Load$$region_name$$Base Load address of the region.
Image$$region_name$$Base Execution address of the region.
Image$$region_name$$Length Execution region length in bytes (multiple of 4).
Image$$region_name$$Limit Address of the byte beyond the end of the execution region.
Image$$region_name$$ZI$$Base Execution address of the ZI output section in this region.
Image$$region_name$$ZI$$Length Length of the ZI output section in bytes (multiple of 4).
Image$$region_name$$ZI$$Limit Address of the byte beyond the end of the ZI output sectionin the execution region.
SectionName$$Base Input Address of the start of the consolidated section called SectionName.
SectionName$$Limit Input Address of the byte beyond the end of the consolidated section called SectionName.
Base:首地址;
Limit:尾地址;
region_name:RO、RW、ZI、load_region_name、execution_region_name;
例如: RAM1区域的首地址:Image$$RAM1$$Base sram段首地址: sram$$Base 注意:“sram$$Base”不一定等于“Image$$RAM2$$Base”;
实例一:
起始地址 大小
ROM: 0x00000000 256K 0x1fc 保留为加密字
RAM 0x40000000 16K
SRAM 0x80000000 512K
程序在ROM中运行; RAM主要用于程序堆栈及优先用于存放部分变量; SRAM速度慢,主要用于存放大的数据表。
LOAD_ROM1 0x00000000 ; 指定该加载区域首地址
{
EXEC_ROM1 +0 0x1f8 ; 没有前一加载区域,所以该执行区域首地址为加载去首地址 ; 并指定该区域长度
{
Startup.o (vectors, +FIRST) ; 目标文件的vectors段放在该执行区域的第一段
irq.o (+RO) ; 目标文件的所有 RO段放在该执行区域
swi.o (+RO)
}
}
LOAD_ROM2 0x00000200 ; 第二个加载区域
{
EXEC_ROM2 +0 0x3e600
{
* (+RO) ; 所有目标文件和库文件中的 RO段存放在该区域
}
RAM1 0x40000000 0x4000
{
* (+RW, +ZI) ; 所有目标文件和库文件的 RW和 ZI段存放在该区域
}
SRAM2 0x80000000 0x80000
{ * (sram) ; 所有目标文件中的 sram段存放在该区域
}
}
实例二:
Load_region1 0x00000000 0x1fc
{ EXEC_ROM1 +0
{
Startup.o (vectors, +FIRST)
irq.o (+RO)
}
}
Load_region2 0x00000200 0x3e600
{
EXEC_ROM2 +0
{
* (+RO)
}
Exec_RAM1 0x40000000 OVERLAY 0x4000 ; 覆盖,所以必须自己初始化RW和ZI区域
{
* (+RW, +ZI)
}
Exec_IAP 0x40000000 OVERLAY 0x80000 ; 覆盖,所以执行前应该COPY到执行区
{
iap.o (+RO)
}
}
此例中iap.o定义在 RAM中运行,在调用iap.c中函数之前应该将其从Load$$region_name$$Base复制到Image$$region_name$$Base区域,而在系统启动前也应该将RW和ZI初始化好(__main不无效了)。
相关文章推荐
- ADS下的分散加载文件应用实例
- ADS下的分散加载文件应用实例
- ADS下的分散加载文件应用实例
- 【转】ADS下的分散加载文件应用实例
- [嵌入式]ADS下的分散加载文件应用实例 [转]深思的笔记
- ADS下的分散加载文件应用实例
- ADS下的分散加载文件应用实例
- ADS分散加载文件及其应用
- keil .sct分散加载文件及其应用
- 分散加载文件及其应用(重点必看)
- ADS分散加载文件使用总结(lpc23xx)
- 分散加载描述文件 实例
- 【转载】ADS分散加载文件使用总结(lpc23xx)
- ADS下的分散加载文件讲解
- 分散加载文件 ads
- ADS 1.2 分散加载文件mem.scf 文件注释
- keil .sct分散加载文件及其应用(重点必看)
- keil分散加载文件
- Intel平台下Linux中ELF文件动态链接的加载、解析及实例分析(一): 加载
- ASP.NET中FileUpload文件上传控件应用实例