最近在看4412移植视频,刚开始介绍了uboot,所以想了解下uboot的启动过程,所以从uboot.lds看起
1.arch/arm/cpu/armv7/start.S
.globl _start
_start: b reset
ldr pc, _undefined_instruction
ldr pc, _software_interrupt
ldr pc, _prefetch_abort
ldr pc, _data_abort
ldr pc, _not_used
ldr pc, _irq
ldr pc, _fiq
eset:
/*
* set the cpu to SVC32 mode
*/
mrs r0, cpsr
bic r0, r0, #0x1f
orr r0, r0, #0xd3
msr cpsr,r0
#ifndef CONFIG_SKIP_LOWLEVEL_INIT
**bl cpu_init_crit**
#endif
call_board_init_f:
ldr sp, =(CONFIG_SYS_INIT_SP_ADDR)
bic sp, sp, #7 /* 8-byte alignment for ABI compliance */
ldr r0,=0x00000000
bl board_init_f
relocate_code:
mov r4, r0 /* save addr_sp */
mov r5, r1 /* save addr of gd */
mov r6, r2 /* save addr of destination */
jump_2_ram:
ldr r0, _board_init_r_ofs
adr r1, _start
add lr, r0, r1
@ add lr, lr, r9
/* setup parameters for board_init_r */
mov r0, r5 /* gd_t */
mov r1, r6 /* dest_addr */
/* jump to it ... */
mov pc, lr
1.1 cpu_init_crit
*Invalidate L1 I/D‘
*disable MMU stuff and caches
bl lowlevel_init @ go setup pll,mux,memory
1.1.1 board/samsung/tiny4412/lowlevel_init.S
/* init system clock */
bl system_clock_init
/* Memory initialize */
bl mem_ctrl_asm_init
/* init uart for debug */
bl uart_asm_init
1.2 board_init_f (board\samsung\tiny4412)
大部分初始化
1.3 relocate_code
自搬移
1.4 board_init_r (board\samsung\tiny4412)
main_loop();
启动流程和以前几乎保持不变。
2:一个阶段汇编,一个c阶段
2:1次自搬移 1次内核搬移
2:1次小部分初始化,一次大部分初始化