Two stage U-Boot design

In AM335x the ROM code serves as the bootstrap loader, sometimes referred to as the Initial Program Loader (IPL)
or the Primary Program Loader (PPL). The booting is completed in two consecutive stages by U-Boot [1] binaries.
The binary for the 1st U-Boot stage is referred to as the Secondary Program Loader (SPL) or the MLO. The binary
for the 2nd U-Boot stage is simply referred to as U-Boot. SPL is a non-interactive loader and is a specially built
version of U-Boot. It is built concurrently when building U-Boot.

This section gives an overview of the two stage U-Boot approach adopted for TI814X and TI813X.
The size of the internal RAM in TI814X is 128KB out of which 18KB at the end is used by the ROM code. This
placed a limit of 110KB on the size of the U-Boot binary which the ROM code can transfer to the internal RAM.
U-Boot also requires some space for the stack, heap and global data during executing and this region currently needs
to be setup before the TEXT_BASE of U-Boot.
Since it is not possible to squeeze in all the functionality that is normally expected from U-Boot in < 110KB (after
setting aside some space for stack, heap etc) a two stage approach has been adopted.
The first stage (or rather the 2nd stage if the ROM code is also considered) is built using a minimal configuration and
has an embedded ENV. The purpose of this stage is to initialize the necessary peripherals, especially DDR, so that a
full fledged U-Boot can be transferred to DDR from NAND/SPI/SD/UART/NOR and then control passed to it.
The boot command that the minimal U-Boot uses for fetching the larger U-Boot will not change for a particular boot
mode as long as the same layout is used and is hence fixed. If any other behavior required then the minimal U-Boot
stage can be interrupted and a different command issued.
The minimal U-Boot binary also has a hole at the top which is used as the space for stack, heap and global data.
After some analysis the size of the hole has currently been set as 12KB.

Note
To avoid over-writing U-Boot when it is executing make sure that an address greater than 0x80800000 is used when
downloading the kernel and/or filesystem images

参考:

AM335x U-Boot User's Guide

TI81XX PSP UBOOT User Guide

原文地址:https://www.cnblogs.com/embedded-linux/p/5927874.html