手机开发实战184——Scatter file介绍5
2016-06-14 20:28
225 查看
分散加载文件中定义如下:
Exec_Sram 0x80000000 0x40000
{
* (sram)
}
“PI” 属性使用示例:
LR_1 0x010000 PI ; The first load region is at 0x010000.
{
ER_RO +0 ; The PI attribute is inherited from parent.
; The default execution address is 0x010000, but the code can be moved.
{
*(+RO) ; All the RO sections go here.
}
ER_RW +0 ABSOLUTE ; PI attribute is overridden by ABSOLUTE.
{
*(+RW) ; The RW sections are placed next. They cannot be moved.
}
ER_ZI +0 ; ER_ZI region placed after ER_RW region.
{
*(+ZI) ; All the ZI sections are placed consecutively here.
}
}
LR_1 0x010000 ; The first load region is at 0x010000.
{
ER_RO +0 ; Default ABSOLUTE attribute is inherited from parent. The execution address
; is 0x010000. The code and ro data cannot be moved.
{
*(+RO) ; All the RO sections go here.
}
ER_RW 0x018000 PI ; PI attribute overrides ABSOLUTE
{
*(+RW) ; The RW sections are placed at 0x018000 and they can be moved.
}
ER_ZI +0 ; ER_ZI region placed after ER_RW region.
{
*(+ZI) ; All the ZI sections are placed consecutively here.
}
}
程序中对某区域地址等的引用方法:
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.
Load: 加载区,即存放地址;
Image: 执行区,即运行地址;
Base: 区首地址;
Limit: 区尾地址;
Length: 区长度;
region_name: RO、RW、ZI、load_region_name、execution_region_name;
例如:
“RAM1”区域的首地址: Image$RAM1$Base
上例中“sram”段首地址: sram$Base
汇编引用示例:
IMPORT |Load$Exec_RAM1$Base| // Exec_RAM1 为“RW”段
IMPORT |Image$Exec_RAM1$Base|
IMPORT |Image$Exec_RAM1$Length|
IMPORT |Image$Exec_RAM1$Limit|
LDR R0, =|Load$Exec_RAM1$Base|
LDR R1, =|Image$Exec_RAM1$Base|
LDR R2, =|Image$Exec_RAM1$Limit|
0
CMP R1, R2
LDRCC R3, [R0], #4
STRCC R3, [R1], #4
BCC %b0
C 引用:
extern unsigned char Load$Exec_RAM1$Base;
extern unsigned char Image$Exec_RAM1$Base;
extern unsigned char Image$Exec_RAM1$Length;
void MoveRO(void)
{
unsigned char * psrc, *pdst;
unsigned int count;
count = (unsigned int) &Image$Exec_RAM1$Length;
psrc = (unsigned char *)&Load$Exec_RAM1$Base;
pdst = (unsigned char *)&Image$Exec_RAM1$Base;
while (count--) {
*pdst++ = *psrc++;
}
}
Exec_Sram 0x80000000 0x40000
{
* (sram)
}
“PI” 属性使用示例:
LR_1 0x010000 PI ; The first load region is at 0x010000.
{
ER_RO +0 ; The PI attribute is inherited from parent.
; The default execution address is 0x010000, but the code can be moved.
{
*(+RO) ; All the RO sections go here.
}
ER_RW +0 ABSOLUTE ; PI attribute is overridden by ABSOLUTE.
{
*(+RW) ; The RW sections are placed next. They cannot be moved.
}
ER_ZI +0 ; ER_ZI region placed after ER_RW region.
{
*(+ZI) ; All the ZI sections are placed consecutively here.
}
}
LR_1 0x010000 ; The first load region is at 0x010000.
{
ER_RO +0 ; Default ABSOLUTE attribute is inherited from parent. The execution address
; is 0x010000. The code and ro data cannot be moved.
{
*(+RO) ; All the RO sections go here.
}
ER_RW 0x018000 PI ; PI attribute overrides ABSOLUTE
{
*(+RW) ; The RW sections are placed at 0x018000 and they can be moved.
}
ER_ZI +0 ; ER_ZI region placed after ER_RW region.
{
*(+ZI) ; All the ZI sections are placed consecutively here.
}
}
程序中对某区域地址等的引用方法:
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.
Load: 加载区,即存放地址;
Image: 执行区,即运行地址;
Base: 区首地址;
Limit: 区尾地址;
Length: 区长度;
region_name: RO、RW、ZI、load_region_name、execution_region_name;
例如:
“RAM1”区域的首地址: Image$RAM1$Base
上例中“sram”段首地址: sram$Base
汇编引用示例:
IMPORT |Load$Exec_RAM1$Base| // Exec_RAM1 为“RW”段
IMPORT |Image$Exec_RAM1$Base|
IMPORT |Image$Exec_RAM1$Length|
IMPORT |Image$Exec_RAM1$Limit|
LDR R0, =|Load$Exec_RAM1$Base|
LDR R1, =|Image$Exec_RAM1$Base|
LDR R2, =|Image$Exec_RAM1$Limit|
0
CMP R1, R2
LDRCC R3, [R0], #4
STRCC R3, [R1], #4
BCC %b0
C 引用:
extern unsigned char Load$Exec_RAM1$Base;
extern unsigned char Image$Exec_RAM1$Base;
extern unsigned char Image$Exec_RAM1$Length;
void MoveRO(void)
{
unsigned char * psrc, *pdst;
unsigned int count;
count = (unsigned int) &Image$Exec_RAM1$Length;
psrc = (unsigned char *)&Load$Exec_RAM1$Base;
pdst = (unsigned char *)&Image$Exec_RAM1$Base;
while (count--) {
*pdst++ = *psrc++;
}
}
相关文章推荐
- 如何优化sql语句
- 手机开发实战183——Scatter file介绍4
- CoreData使用
- PHP-FPM参数优化
- 32. Longest Valid Parentheses
- 手机开发实战182——Scatter file介绍3
- spring错误汇总
- java工具类之将map范型集合转化为list的有序集合工具类
- NSTimer定时器
- 图书馆系统
- 手机开发实战181——Scatter file介绍2
- 架构结构
- leetcode笔记—最小路径数和
- MiniSQL编写收获
- Android多用户模式下开发不得不知的注意事项
- 套接字IO超时设置和使用select实现超时管理
- 如何配置pl/sql (本地客户端)连接远程oracle服务器
- centos java配置
- 手机开发实战180——Scatter file介绍1
- <OJ_Sicily>Inversion Number