我们逐步分析README 里面的内容
Board Initialisation Flow:
1:
2: Board Initialisation Flow:(开发板初始化)
3: --------------------------
4:
5: This is the intended start-up flow for boards. This should apply for both
6: SPL and U-Boot proper (i.e. they both follow the same rules). At present SPL
7: mostly uses a separate code path, but the funtion names and roles of each
8: function are the same. Some boards or architectures may not conform to this.
9: At least most ARM boards which use CONFIG_SPL_FRAMEWORK conform to this.
10:
11: Execution starts with start.S with three functions called during init after
12: that. The purpose and limitations of each is described below.
13:
14: lowlevel_init():
15: - purpose: essential init to permit execution to reach board_init_f()
16: - no global_data or BSS
17: - there is no stack (ARMv7 may have one but it will soon be removed)
18: - must not set up SDRAM or use console
19: - must only do the bare minimum to allow execution to continue to
20: board_init_f()
21: - this is almost never needed
22: - return normally from this function
23:
24: board_init_f():
25: - purpose: set up the machine ready for running board_init_r():
26: i.e. SDRAM and serial UART
27: - global_data is available
28: - stack is in SRAM
29: - BSS is not available, so you cannot use global/static variables,
30: only stack variables and global_data
31:
32: Non-SPL-specific notes:
33: - dram_init() is called to set up DRAM. If already done in SPL this
34: can do nothing
35:
36: SPL-specific notes:
37: - you can override the entire board_init_f() function with your own
38: version as needed.
39: - preloader_console_init() can be called here in extremis
40: - should set up SDRAM, and anything needed to make the UART work
41: - these is no need to clear BSS, it will be done by crt0.S
42: - must return normally from this function (don't call board_init_r()
43: directly)
44:
45: Here the BSS is cleared. For SPL, if CONFIG_SPL_STACK_R is defined, then at
46: this point the stack and global_data are relocated to below
47: CONFIG_SPL_STACK_R_ADDR. For non-SPL, U-Boot is relocated to run at the top of
48: memory.
49:
50: board_init_r():
51: - purpose: main execution, common code
52: - global_data is available
53: - SDRAM is available
54: - BSS is available, all static/global variables can be used
55: - execution eventually continues to main_loop()
56:
57: Non-SPL-specific notes:
58: - U-Boot is relocated to the top of memory and is now running from
59: there.
60:
61: SPL-specific notes:
62: - stack is optionally in SDRAM, if CONFIG_SPL_STACK_R is defined and
63: CONFIG_SPL_STACK_R_ADDR points into SDRAM
64: - preloader_console_init() can be called here - typically this is
65: done by defining CONFIG_SPL_BOARD_INIT and then supplying a
66: spl_board_init() function containing this call
67: - loads U-Boot or (in falcon mode) Linux
68:
这段话的意思就是开发板初始化必须初始化的三个初始化函数:
lowlevel_init();board_init_f();board_init_r();