Uboot机制详细理解分析(6):Uboot移植
一、Uboot主要内容:
-
初始化硬件
-
bootloader比较大,需要重定位到SRAM或者DDR上
-
将内核重定位到SRAN或者DDR上
-
给内核传入参数
-
跳转启动内核
二、解读与修改:
中断异常向量
set the cpu to SVC32 mode
turn off the watchdog
mask all IRQS
设置时钟分频系数
cpu_init_crit
刷新 I/D cache
进行MMU的disable
lowlevel_init:进行SDRAM控制器的配置和BOOTLOADER代码段的拷贝
call_board_init_f
设置SP指针
board_init_f
做多种硬件的初始化
gd = (gd_t *)
((CONFIG_SYS_INIT_SP_ADDR) & ~0x07);
for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
if ((*init_fnc_ptr)() != 0) {
hang ();
}
}
init_sequence这个数组中包含了各个硬件设备初始化的函数指针。