Some time ago I read the uboot source code and forgot about it after a while. Some comments are made to facilitate future study.
Stage 1CodeMainly in start. S. The process is as follows:
1. Set the interrupt vector table.
2. Set CPU to administrator mode.
3. Disable dogs.
4. disconnection.
5. Set the system clock.
6. Jump to cpu_init_crit. (Note that BL commands are relatively redirected. mov LR and PC are used for absolute redirection. Because the code in this phase is location-independent code, you must carefully understand the details of the jump)
. Make the cache invalid.
. Disable MMU and cache.
. Jump to lowlevel_init to set the memory clock.
The specific analysis of this function can be referred here: http://blog.csdn.net/xautfengzi/article/details/6306436
7. initialize the NAND controller.
8. Set the stack, FP pointer, Ro, R1, and R2 registers as real parameters.
9. Jump to nand_read_ii and copy uboot to SDRAM.
10. Compare the content of the first 4 K copied to SDRAM with that in steppingstone.
11. Set the SP pointer to clear the BSS segment.
12. Jump to start_armboot, that is, the second stage.
Distribution in memory at the end of the first phase is shown in the figure: this graph is transferred from http://my.unix-center.net /~ Xiaoshe/2010/01/03/U-boot % E7 % 9A % 84% E5 % 86% E5 % ad % 85% E5 % 98% E5 % B8 % 88% E5 % 86% 8C % E5 % 85% A8 % E5 % B1 % 80% E6 % 95% B0 % E6 % 8d % AE % E7 % BB % 93% E6 % 9e % 84/