Chinaunix首页 | 论坛 | 博客
  • 博客访问: 723854
  • 博文数量: 124
  • 博客积分: 3156
  • 博客等级: 中校
  • 技术积分: 1584
  • 用 户 组: 普通用户
  • 注册时间: 2008-08-02 10:29
文章分类

全部博文(124)

文章存档

2012年(3)

2011年(2)

2010年(61)

2009年(34)

2008年(24)

我的朋友

分类: LINUX

2008-11-24 15:30:08

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);


汇编中这类变量也是这样声明和应用的:
  1. __ro_start:
  2.     // disable watch-dog
  3.     mov r1, #0x53000000
  4.     mov r2, #0x0
  5.     str r2, [r1]
  6.     // initialize stack pointer
  7.     mov sp, #0x32000000
  8.     mov r0, #0
  9.     bl main
  10.     1:  b 1b  // halt
  11. __ro_end:

  1. extern Uint32  __ro_start;
  2. extern Uint32  __ro_end;

  3. int main()
  4. {
  5.     int size;
  6.     size = &__ro_end - &__ro_start;
  7.     // __ro_start is expected to be 0x30000000, and __ro_end to be 0x3000001c (0x30000000+ 7*4)
  8.     return size;
  9.     // return the size, just for test
  10. }


 
阅读(1275) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~