Chinaunix首页 | 论坛 | 博客
  • 博客访问: 143994
  • 博文数量: 29
  • 博客积分: 717
  • 博客等级: 上士
  • 技术积分: 352
  • 用 户 组: 普通用户
  • 注册时间: 2011-05-16 16:17
文章分类

全部博文(29)

文章存档

2013年(4)

2012年(4)

2011年(21)

我的朋友

分类: LINUX

2011-05-17 20:23:05

uboot生产的文件的地址分布入下
  1. . = 0x00000000;
  2. . = ALIGN(4);
  3. .text :
  4. {
  5. cpu/arm920t/start.o (.text)
  6. *(.text)
  7. }
  8. ......
  9. ......
链接的起始地址是0x00000000,而且对start.o文件进行反汇编如下,此时没有链接
  1. ./cpu/arm920t/start.o: file format elf32-littlearm
  2. Disassembly of section .text:
  3. 00000000 <_start>:
  4. 0: ea000012 b 50
  5. 4: e59ff014 ldr pc, [pc, #20] ; 20 <_undefined_instruction>
  6. 8: e59ff014 ldr pc, [pc, #20] ; 24 <_software_interrupt>
  7. ......
  8. ......
  9. 00000050 :
  10. 50: e10f0000 mrs r0, CPSR
  11. 54: e3c0001f bic r0, r0, #31 ; 0x1f
  12. 58: e38000d3 orr r0, r0, #211 ; 0xd3
  13. 5c: e129f000 msr CPSR_fc, r0
  14. 60: e3a00453 mov r0, #1392508928 ; 0x53000000
  15. ......
  16. ......
对uboot进行反汇编
  1. .globl _start
  2. _start: b reset
  3. 33f80000: ea000012 b 33f80050
  4. ldr pc, _undefined_instruction
  5. 33f80004: e59ff014 ldr pc, [pc, #20] ; 33f80020 <_undefined_instruction>
  6. ldr pc, _software_interrupt
  7. 33f80008: e59ff014 ldr pc, [pc, #20] ; 33f80024 <_software_interrupt>
链接完成后的地址并不是0x00000000,而是0x33f80000,当然机器码没有改变。
至于TEXT_BASE的定义是在board/***/config.mk文件里
uboot根目录下config.mk文件中
 LDFLAGS += -Bstatic -T $(LDSCRIPT) -Ttext $(TEXT_BASE)
将链接的地址改为0x33f80000



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