Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2896734
  • 博文数量: 674
  • 博客积分: 17881
  • 博客等级: 上将
  • 技术积分: 4849
  • 用 户 组: 普通用户
  • 注册时间: 2010-03-17 10:15
文章分类

全部博文(674)

文章存档

2013年(34)

2012年(146)

2011年(197)

2010年(297)

分类: LINUX

2010-03-31 08:35:12

 

上回书说到flashloader把bootloader load到0x0AFE0100, 然回跳了过去,
其实0x0AFE0100 就是烧在flash 0x0C000100中的真正的bootloader:

bootloader 有几个文件组成,先是START.s,也是唯一的一个汇编程序,其余的都是C写成的,START.s主要初始化堆栈:

_start:
ldr r1,=StackInit
ldr sp,[r1]
b main
//此处我们跳到了C代码的main函数,当C代码执行完后,还要调用
//下面的JumpToKernel0x跳到LINXU kernel运行

.equ StackInitValue, __end_data+0x1000 // 4K __end_data在连结脚本中指定

StackInit:
.long StackInitValue

.global JumpToKernel

JumpToKernel:
// jump to the copy code (get the arguments right)
mov pc, r0

.global JumpToKernel0x
// r0 = jump address
// r1-r4 = arguments to use (these get shifted)
JumpToKernel0x:
// jump to the copy code (get the arguments right)
mov r8, r0
mov r0, r1
mov r1, r2
mov r2, r3
mov r3, r4
mov pc, r8
.section ".data.boot"
.section ".bss.boot"

欲知bootloader中的c代码如何运行,请看Arm linux下集
阅读(1230) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~