ENTRY(boot)
SECTIONS {
. = 0x80000000;
__CS2start = .;
__NORFlash = .;//这些变量不占用内存
__NANDFlash = 0x02000000;
.boot : AT ( 0x0)
{
*(.boot)
. = ALIGN(4);
}
.selfcopy : AT (LOADADDR(.boot) + SIZEOF(.boot))
{
*(.selfcopy)
. = ALIGN(256);
}
__selfcopysrc = .;
__IVT = 0x00008000;
__selfcopydest = 0x00008020;
....
}
extern Uint32 __selfcopysrc, __selfcopydest, __selfcopydestend;//声明
VUint32* src = &(__selfcopysrc);//应用
VUint32* src = __selfcopysrc;//错误
VUint32* dest = &(__selfcopydest);
VUint32* destend = &(__selfcopydestend);
汇编中这类变量也是这样声明和应用的:
- __ro_start:
-
- mov r1, #0x53000000
- mov r2, #0x0
- str r2, [r1]
-
- mov sp, #0x32000000
- mov r0, #0
- bl main
- 1: b 1b
- __ro_end:
- extern Uint32 __ro_start;
- extern Uint32 __ro_end;
- int main()
- {
- int size;
- size = &__ro_end - &__ro_start;
-
- return size;
-
- }
阅读(1314) | 评论(0) | 转发(0) |