(am335x) u-boot启动过程分析之概述

VERSION = 2014
PATCHLEVEL = 04

芯片到uboot启动流程 :ROM → MLO(SPL)→ uboot.img

第一级bootloader:引导加载程序,板子上电后会自动执行这些代码,如启动方式(SDcard、SPI、NOR),然后跳转至第二级bootloader。这些代码存放在 176KB 的 ROM 中.


(am335x) u-boot启动过程分析之概述_第1张图片

第二级bootloader:MLO(SPL),用于硬件初始化,关看门狗,关中断,设置CPU时钟频率、速度、加载uboot.img、dts等操作,然后会跳转到第三级bootloader。MLO文件应该会被映射到 64 KB的 Internal SRAM 中.

第三级bootloader:u-boot.img, C代码的入口.

其中第一级 bootloader 是板子固化的,第二级和第三级是通过编译 uboot 所得的。

这里先整体介绍u-boot的整体功能,接下来再具体展开分析。
执行流程如下:

SPL(MLO):

  • 1. reset; (@arch/arm/cpu/armv7/start.s)
    • -> @ disable interrupts (FIQ and IRQ);
    • -> @ set the cpu to SVC32 mode;
  • 2. cpu_init_cp15: (@arch/arm/cpu/armv7/start.s)
    • -> @ setup CP15 registers (cache, MMU, TLBs);
    • -> @ Invalidate L1 I/D;
    • -> @ disable MMU stuff and caches
  • 3. cpu_init_crit: (@arch/arm/cpu/armv7/start.s)
    • -> go setup pll,mux,memory;
    • -> lowlevel_init: (@arch/arm/cpu/armv7/lowlevel_init.s)
    • ----> @ Setup a temporary stack
    • ----> @ Set up global data
    • ----> s_init: (@arch/arm/cpu/armv7/am33xx/board.c)
    • -------> watchdog_disable
    • -------> timer_init
    • -------> set_uart_mux_conf
    • -------> setup_clocks_for_console
    • -------> uart_soft_reset
    • -------> preloader_console_init
    • -------> rtc32k_enable
    • -------> prcm_init
    • -------> sdram_init
  • 4. _main: (@arch/arm/lib/crt0.s)
    • -> @ Set up initial C runtime environment and call board_init_f;
    • -> board_init_f:(@arch/arm/lib/spl.c)
    • ----> @ call board_init_r;
    • ----> board_init_r:(@common/spl/spl.c)
    • -------> spl_xxx_load_image :根据不同的启动方式加载 u-boot 镜像
    • -------> jump_to_image_no_args:进入u-boot代码运行

U-BOOT:

  • 1. reset; (@arch/arm/cpu/armv7/start.s)
    • -> @ set SVC mode;
    • -> @ disable FIQ and IRQ;
  • 2. _main: (@arch/arm/lib/crt0.s)
    • -> @ Set up initial C runtime environment and call board_init_f;
    • -> board_init_f:(@arch/arm/lib/board.c)
    • ----> init_sequence:(@arch/arm/lib/board.c);
    • -> relocate_code:(@arch/arm/lib/relocate.S)
    • ----> @ 代码重定位;
    • -> board_init_r:(@arch/arm/lib/board.c)
    • ----> enable_caches;
    • ----> board_init:(@board/ti/am335x/board.c);
    • -------> @ 根据配置初始化各种外设;
    • ----> main_loop:(@common/main.c);

参考文献:
http://blog.chinaunix.net/uid-28458801-id-3486399.html

你可能感兴趣的:((am335x) u-boot启动过程分析之概述)