3.1.1.1. General Information¶
3.1.1.1.1. Getting the U-Boot Source Code¶
The GIT repo URL, branch and commit id can be found in the release-specific-build-information-u-boot section of the release notes.
3.1.1.1.2. Build U-Boot¶
Note
The following commands are intended to be run from the root of the U-Boot tree unless otherwise specified. The root of the U-Boot tree is the top-level directory and can be identified by looking for the “MAINTAINERS” file.
Several prebuilt images are required from the TI Processor SDK for building U-Boot on K3 based platforms.
TI-u-boot is included in the SDK in <path to tisdk>/board-support. Ensure that the u-boot version matches the release-specific-build-information-u-boot.
Setting the tool chain path
Setting the toolchain path is no longer required for Yocto but still required for standalone builds. We strongly recommend using the toolchain that comes with the Processor SDK. The location of the toolchain can be found here: Location in SDK. If the Processor SDK is not used, the toolchain will need to be downloaded and toolchain path will need to be set, more information can be found here: Download ARM toolchains.
Compiling R5 and ARM64 images
Use the following table to determine what defconfig to use to configure with:
Board
SD/eMMC Boot
UART boot
OSPI boot
Hyper Flash
USB DFU
AM65x EVM/IDK
am65x_evm_r5_defconfig am65x_evm_a53_defconfig
am65x_evm_r5_defconfig am65x_evm_a53_defconfig
am65x_evm_r5_defconfig am65x_evm_a53_defconfig
AM65x HS EVM/IDK
am65x_hs_evm_r5_defconfig am65x_hs_evm_a53_defconfig
am65x_hs_evm_r5_defconfig am65x_hs_evm_a53_defconfig
am65x_hs_evm_r5_defconfig am65x_hs_evm_a53_defconfig
on GP
R5 $ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- am65x_evm_r5_defconfig O=<output directory>/r5 $ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- O=<output directory>/r5 BINMAN_INDIRS=<path to tisdk>/board-support/prebuilt-images A53 $ make ARCH=arm CROSS_COMPILE=aarch64-none-linux-gnu- am65x_evm_a53_defconfig O=<output directory>/a53 $ make ARCH=arm CROSS_COMPILE=aarch64-none-linux-gnu- BL31=<path to tisdk>/board-support/prebuilt-images/bl31.bin TEE=<path to tisdk>/board-support/prebuilt-images/bl32.bin O=<output directory>/a53 BINMAN_INDIRS=<path to tisdk>/board-support/prebuilt-imageson HS
R5 $ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- am65x_hs_evm_r5_defconfig O=<output directory>/r5 $ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- O=<output directory>/r5 BINMAN_INDIRS=<path to tisdk>/board-support/prebuilt-images A53 $ make ARCH=arm CROSS_COMPILE=aarch64-none-linux-gnu- am65x_hs_evm_a53_defconfig O=<output directory>/a53 $ make ARCH=arm CROSS_COMPILE=aarch64-none-linux-gnu- BL31=<path to tisdk>/board-support/prebuilt-images/bl31.bin TEE=<path to tisdk>/board-support/prebuilt-images/bl32.bin O=<output directory>/a53 BINMAN_INDIRS=<path to tisdk>/board-support/prebuilt-images
Note
BINMAN_INDIRS is used to fetch the DM binary from board-support/prebuilt-images/ti-dm/ and SYSFW binaries from board-support/prebuilt-images/ti-sysfw/. If not using the SDK, BINMAN_INDIRS can point to either ti-linux-firmware or any folder where DM is located in <path to folder>/ti-dm/ and SYSFW binaries are present in <path to folder>/ti-sysfw/. Please make sure to use the absolute path.
Target Images
Copy the below images to the boot partition of an SD card and boot. Instructions to format the SD card can be found here.
GP
tiboot3-am65x_sr2-gp-evm.bin, sysfw-am65x_sr2-gp-evm.itb from <output directory>/r5
tispl.bin_unsigned, u-boot.img_unsigned from <output directory>/a53
HS
tiboot3-am65x_sr2-hs-evm.bin, sysfw-am65x_sr2-hs-evm.itb from <output directory>/r5
tispl.bin, u-boot.img from <output directory>/a53
3.1.1.1.3. Image Formats¶
tiboot3.bin
+-----------------------+ | X.509 | | Certificate | | +-------------------+ | | | | | | | R5 | | | | u-boot-spl.bin | | | | | | | +-------------------+ | | | | | | | FIT header | | | | +---------------+ | | | | | | | | | | | DTB 1...N | | | | | +---------------+ | | | +-------------------+ | +-----------------------+
tispl.bin
+-----------------------+ | | | FIT HEADER | | +-------------------+ | | | | | | | ARM64 ATF | | | +-------------------+ | | | | | | | ARM64 OPTEE | | | +-------------------+ | | | | | | | ARM64 SPL | | | +-------------------+ | | | | | | | SPL DTB 1...N | | | +-------------------+ | +-----------------------+
sysfw.itb
+-----------------------+ | | | FIT HEADER | | +-------------------+ | | | | | | | sysfw.bin | | | +-------------------+ | | | | | | | board config | | | +-------------------+ | | | | | | | PM config | | | +-------------------+ | | | | | | | RM config | | | +-------------------+ | | | | | | | Secure config | | | +-------------------+ | +-----------------------+
3.1.1.1.4. Boot Flow¶
On K3 architecture based devices, ROM supports boot only via MCU(R5). This means that bootloader has to run on R5 core. In order to meet this constraint, keeping safety in picture and to have faster boot time, the software boot architecture is designed as below:
+------------------------------------------------------------------------+
| DMSC | R5 | ARM64 |
+------------------------------------------------------------------------+
| +--------+ | | |
| | Reset | | | |
| +--------+ | | |
| : | | |
| +--------+ | +-----------+ | |
| | *ROM* |----------|-->| Reset rls | | |
| +--------+ | +-----------+ | |
| | | | : | |
| | ROM | | : | |
| |services| | : | |
| | | | +-------------+ | |
| | | | | *R5 ROM* | | |
| | | | +-------------+ | |
| | |<---------|---|Load and auth| | |
| | | | | tiboot3.bin | | |
| | | | +-------------+ | |
| | | | : | |
| | | | : | |
| | | | : | |
| | | | +-------------+ | |
| | | | | *R5 SPL* | | |
| | | | +-------------+ | |
| | | | | Load | | |
| | | | | sysfw.itb | | |
| | Start | | +-------------+ | |
| | System |<---------|---| Start | | |
| |Firmware| | | SYSFW | | |
| +--------+ | +-------------+ | |
| : | | | | |
| +---------+ | | Load | | |
| | *SYSFW* | | | system | | |
| +---------+ | | Config data | | |
| | |<--------|---| | | |
| | | | +-------------+ | |
| | | | | | | |
| | | | | DDR | | |
| | | | | config | | |
| | | | +-------------+ | |
| | | | | | | |
| | |<--------|---| Start A53 | | |
| | | | | and Reset | | |
| | | | +-------------+ | |
| | | | | +-----------+ |
| | |---------|-----------------------|---->| Reset rls | |
| | | | | +-----------+ |
| | DMSC | | | : |
| |Services | | | +-----------+ |
| | |<--------|-----------------------|---->|*ATF/OPTEE*| |
| | | | | +-----------+ |
| | | | | : |
| | | | | +-----------+ |
| | |<--------|-----------------------|---->| *A53 SPL* | |
| | | | | +-----------+ |
| | | | | | Load | |
| | | | | | u-boot.img| |
| | | | | +-----------+ |
| | | | | : |
| | | | | +-----------+ |
| | |<--------|-----------------------|---->| *U-Boot* | |
| | | | | +-----------+ |
| | | | | | prompt | |
| | | | | +-----------+ |
| +---------+ | | |
| | | |
+------------------------------------------------------------------------+
Here DMSC acts as master and provides all the critical services. R5/ARM64 requests DMSC to get these services done as shown in the above diagram.
3.1.1.1.5. U-Boot Environment¶
Note
SDK 9.0 will not default to the environments that are saved on the boards, It will default to the ones that are given with the particular uboot in the release.
By default the SDK builds will have the default environments whenever being run, to have some custom environments, one needs to rely on uEnv.txt file.
The added benefit of using uEnv.txt is that it is more granular than the saveenv counterpart as we can choose to store the variables that are actually being set during the development workflow.
Writing to MMC/EMMC
=> env export -t $loadaddr <list of variables>
=> fatwrite mmc ${mmcdev} ${loadaddr} ${bootenvfile} ${filesize}
The following will update the uEnv.txt file on the bootmedia and then whenever “run envboot” is run on the board, uEnv.txt will be read based on mmcdev value to be read either from emmc/sd card.
You can specifically choose the variables that you are changing in your development process so that the other variables are not affected due to the whole environment being saved. Optionally, one can save the full environment too in uEnv.txt by not specifying <list of variables> this will have some issues with the ethernet mac addresses not being overridden but other things will be set.
Reading from MMC/EMMC
By default run envboot will read it from the MMC/EMMC partition ( based on mmcdev) and set the environments.
If manually needs to be done then the environment can be read from the filesystem and then imported
=> fatload mmc ${mmcdev} ${loadaddr} ${bootenvfile}
=> env import -t ${loadaddr} ${filesize}
For production environments if one needs to rely on saveenv counterpart then they can always refer to the commit
Networking Environment
When using a USB-Ethernet dongle a valid MAC address must be set in the environment. To create a valid address please read **this page**. Then issue the following command:
=> setenv usbethaddr value:from:link:above
You can use the printenv command to see if usbethaddr is already set.
Then start the USB subsystem:
=> usb start
The default behavior of U-Boot is to utilize all information that a DHCP server passes to us when the user issues the dhcp command. This will include the dhcp parameter next-server which indicates where to fetch files from via TFTP. There may be times however where the dhcp server on your network provides incorrect information and you are unable to modify the server. In this case the following steps can be helpful:
=> setenv autoload no
=> dhcp
=> setenv serverip correct.server.ip
=> tftp
Another alternative is to utilize the full syntax of the tftp command:
=> setenv autoload no
=> dhcp
=> tftp ${loadaddr} server.ip:fileName
3.1.1.1.6. Available RAM for image download¶
To know the amount of RAM available for downloading images or for other
usage, use bdinfo
command.
=> bdinfo
arch_number = 0x00000000
boot_params = 0x80000100
DRAM bank = 0x00000000
-> start = 0x80000000
-> size = 0x7F000000
baudrate = 115200 bps
TLB addr = 0xFEFF0000
relocaddr = 0xFEF30000
reloc off = 0x7E730000
irq_sp = 0xFCEF8880
sp start = 0xFCEF8870
Early malloc usage: 890 / 2000
After booting, U-Boot relocates itself (along with its various reserved
RAM areas) and places itself at end of available RAM (starting at
relocaddr
in bdinfo
output above). Only the stack is located
just before that area. The address of top of the stack is in
sp start
in bdinfo
output and it grows downwards. Users should
reserve at least about 1MB for stack, so in the example output above,
RAM in the range of [0x80000000, 0xFCE00000]
is safely available for
use.
3.1.1.1.7. Device Trees¶
A note about device trees. Now all supported boards are required to use a device tree to boot. To facilitate this in supported platforms, a command in U-Boot environment findfdt is available that will set the fdtfile variable to the name of the device tree to use, as found with the kernel sources. In the Keystone-2 family devices (K2H/K/E/L/G), it is specified by name_fdt variable for each platform. The device tree is expected to be loaded from the same media as the kernel, and from the same relative path.
3.1.1.1.8. SRAM memory Layout during R5 SPL bootloader stage¶
The SRAM memory layout explains the memory used for Bootloader’s operation.