存储空间关键宏定义
CONFIG_SPL_TEXT_BASE 0x402F0400
CONFIG_SPL_MAX_SIZE (101 * 1024)
CONFIG_SPL_BSS_START_ADDR 0x80000000
CONFIG_SPL_BSS_MAX_SIZE 0x80000 /* 512 KB */
CONFIG_SPL_STACK
CONFIG_SYS_INIT_SP_ADDR
链接脚本
MEMORY { .sram : ORIGIN =CONFIG_SPL_TEXT_BASE,\
LENGTH= CONFIG_SPL_MAX_SIZE }
MEMORY { .sdram : ORIGIN =CONFIG_SPL_BSS_START_ADDR, \
LENGTH= CONFIG_SPL_BSS_MAX_SIZE }
Text>.sram
*(.vectors)
arch/arm/cpu/armv7/start.o
*(.text*)
Rodata>.sram
*(SORT_BY_ALIGNMENT(.rodata*))
Data>.sram
*(SORT_BY_ALIGNMENT(.data*))
u_boot_list>.sram
KEEP(*(SORT(.u_boot_list*)))
__image_copy_end= .
End>.sram
Bss> sdram
__bss_start= .;
*(.bss*)
__bss_end= .;
reset(arch\arm\cpu\armv7\start.S)
禁止中断,设置CPU为SVC32模式
禁用MMU
设置中断vector (_start ) arch\arm\lib\vector.S定义的
cpu_init_cp15 TLB/MMU/Cache设置
cpu_init_crit pll,mux,memory设置
lowlevel_init spl(arch\arm\cpu\armv7\lowlevel_init.S???)
* Setup a temporary stack.Global data is not available yet.
* Set up global data for boardsthat still need it. This will be removed soon.
Gdata在哪里定义的?
*s_init do only the absolute bare minimumto get started
s_init (arch\arm\ cpu\armv7\am33xx\board.c) serial port?
rtc_only rtc寄存器(0x44E3E000)操作
sdram_init
watchdog_disable 禁止watchdog(0x44E35000)
set_uart_mux_conf 串口uart引脚初始化
setup_clocks_for_console cmwkup寄存器操作(uart时钟使能)
_main (arch\arm\lib\crt0.S)
* 1. Set upinitial environment for calling board_init_f().This environment only provides a stack and a place tostore the GD ('global data')structure, both located in some readily available RAM (SRAM, lockedcache...). In this context, VARIABLE global data, initialized or not (BSS), are UNAVAILABLE; only CONSTANT initialized data are available.
* 2. Call board_init_f(). This function prepares the hardware for execution from system RAM (DRAM, DDR...) As system RAM may not be available yet, , board_init_f() must usethe current GD to store any data which must be passed on to later stages. Thesedata include the relocation destination, the future stack, and the future GD location.
board_init_f spl (spl\arch\arm\lib\spl.c)
uboot (arch\arm\ cpu\armv7\am33xx\board.c)
prcm_init 时钟初始化
enable_basic_clocks();
scale_vcores();
setup_dplls();
set_mux_conf_regs 引脚初始化
enable_board_pin_mux(header);
sdram_init 根据板类型初始化ddr
* (the following applies only tonon-SPL builds)
* 3. Set up intermediate environment where the stack and GD are the ones allocatedby board_init_f() in system RAM, but BSS and initialized non-const data are still not available.
* 4. Call relocate_code().This function relocates U-Boot from its current location into the relocationdestination computed by board_init_f().
relocate_code (arch\arm\lib\relocate.S)
relocate_vectors
* 5. Set up final environment for callingboard_init_r(). This environment has BSS (initialized to 0), initializednon-const data (initialized to their intended value), and stack in system RAM. GD has retained values set byboard_init_f(). Some CPUs have some work left to do at this point regardingmemory, so call c_runtime_cpu_setup.
c_runtime_cpu_setup (arch\arm\cpu\armv7\start.S)
spl_relocate_stack_gd (spl\common\spl\spl.c)
* 6. Branch to board_init_r().
board_init_r spl (spl\common\spl\spl.c)
spl_board_init (arch\arm\cpu\armv7\omap-common\boot-common.c)
save_omap_boot_params
preloader_console_init
am33xx_spl_board_init
spl_boot_device (arch\arm\cpu\armv7\omap-common\boot-common.c)
board_init_r uboot (common\board_r.o)
initcall_run_list(init_sequence_r)
//preloader_console_init
U-Boot SPL 2015.01-00001-gb2412df (Jan 29 2015 - 15:01:06)
//board_init_f
//display_banner
U-Boot 2015.01-00001-gb2412df (Jan 29 2015 - 15:01:06),Build: jenkins-github_Bootloader-Builder-105
Watchdogenabled(init_func_watchdog_init common/board_f.c)
//init_func_i2c
I2C: ready
//display_dram_config
DRAM: 512 MiB
//board_init_r
MMC: OMAP SD/MMC: 0,OMAP SD/MMC: 1
//set_default_env
Using default environment
Net:
cpsw
Hit any key to stop autoboot: 0
U-Boot#