首页 > 代码库 > u-boot-2014.10移植第12天----深入分析代码(七)
u-boot-2014.10移植第12天----深入分析代码(七)
c_runtime_cpu_setup函数在arch/arm/cpu/arm920t/start.S文件中:
.globl c_runtime_cpu_setup
c_runtime_cpu_setup:
mov pc, lr //没做什么就返回了
回到arch/arm/lib/crt0.S文件中:
bl c_runtime_cpu_setup /* we still call old routine here */
//bss段清零
ldr r0, =__bss_start /* this is auto-relocated! */
ldr r1, =__bss_end /* this is auto-relocated! */
mov r2, #0x00000000 /* prepare zero to clear BSS */
clbss_l:cmp r0, r1 /* while not at end of BSS */
strlo r2, [r0] /* clear 32-bit BSS word */
addlo r0, r0, #4 /* move to next */
blo clbss_l
bl coloured_LED_init
//coloured_LED_init函数在文件common/board_f.c中
/*
* sjg: IMO this code should be
* refactored to a single function, something like:
*
* void led_set_state(enum led_colour_t colour, int on);
*/
/************************************************************************
* Coloured LED functionality
************************************************************************
* May be supplied by boards if desired
*/
__weak void coloured_LED_init(void) {}
__weak void red_led_on(void) {}
应该是没有实现的。
bl red_led_on
/* call board_init_r(gd_t *id, ulong dest_addr) */
mov r0, r9 /* gd_t */ //r0 放GD头指针
ldr r1, [r9, #GD_RELOCADDR] /* dest_addr */ r1放目的地址
/* call board_init_r */
ldr pc, =board_init_r /* this is auto-relocated! */
board_init_r 函数在arch/arm/lib/board.c中,明天继续
/* we should not return here. */
#endif
ENDPROC(_main)
u-boot-2014.10移植第12天----深入分析代码(七)