int main(int argc, char *argv[])
{
int ret;
GPFDAT = 0x10;
/* NB: MMU off state */
/*
* Step 1:
* print banner
*/
putstr("\r\n");
putstr(vivi_banner);
reset_handler();
/*
* Step 2:
* Board initialize
*/
ret = board_init();
GPFDAT = 0x20;
if (ret) {
putstr("Failed a board_init() procedure\r\n");
error();
}
/*
* Step 3:
* 4G linear mapping, flash mapping
* MMU on
*/
mem_map_init();
mmu_init();
putstr("Succeed memory mapping.\r\n");
/*
* Now, vivi is running on the ram. MMU is enabled.
*/
/*
* Step 4:
* dynamic memory can be used in bootloader
*/
/* initialize the heap area*/
ret = heap_init();
if (ret) {
putstr("Failed initailizing heap region\r\n");
error();
}
/* Step 5:
* MTD initialize
* read MTE partition info.
*/
ret = mtd_dev_init();
/* Step 6:
* read bootloader parameter
*/
init_priv_data();
/* Step 7:
* misc treatment
*/
misc();
init_builtin_cmds();
// putstr("Change Speed from 400Mhz to 533Mhz\r\n");
// change_sys_clks(533,5);
/* Step 8:
* boot or vivi.
*/
boot_or_vivi();
return 0;
}
|
在main函数中,条理非常的清晰,一步一步来(一共八步)
下面我们就按照main函数中的顺序来一次分析各个步骤
阅读(1625) | 评论(0) | 转发(0) |