From: Neha Malcom Francis Date: Fri, 21 Jul 2023 18:44:43 +0000 (+0530) Subject: doc: board: ti: Update documentation for binman flow X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=1ee652ab2f356c8a775bc4878f32f26f29a4c941;p=u-boot.git doc: board: ti: Update documentation for binman flow Earlier documentation specified builds for generating bootloader images using an external TI repository k3-image-gen and core-secdev-k3. Modify this to using the binman flow so that user understands how to build the final boot images. Reviewed-by: Simon Glass Signed-off-by: Neha Malcom Francis --- diff --git a/board/ti/am65x/README b/board/ti/am65x/README deleted file mode 100644 index 67081ce349..0000000000 --- a/board/ti/am65x/README +++ /dev/null @@ -1,350 +0,0 @@ -Introduction: -------------- -The AM65x family of SoCs is the first device family from K3 Multicore -SoC architecture, targeted for broad market and industrial control with -aim to meet the complex processing needs of modern embedded products. - -The device is built over three domains, each containing specific processing -cores, voltage domains and peripherals: -1. Wake-up (WKUP) domain: - - Device Management and Security Controller (DMSC) -2. Microcontroller (MCU) domain: - - Dual Core ARM Cortex-R5F processor -3. MAIN domain: - - Quad core 64-bit ARM Cortex-A53 - -More info can be found in TRM: http://www.ti.com/lit/pdf/spruid7 - -Boot Flow: ----------- -On AM65x family devices, ROM supports boot only via MCU(R5). This means that -bootloader has to run on R5 core. In order to meet this constraint, and for -the following reasons the boot flow is designed as mentioned: -1. Need to move away from R5 asap, so that we want to start *any* -firmware on the r5 cores like.... autosar can be loaded to receive CAN -response and other safety operations to be started. This operation is -very time critical and is applicable for all automotive use cases. -2. U-Boot on A53 should start other remotecores for various -applications. This should happen before running Linux. -3. In production boot flow, we might not like to use full u-boot, -instead use Flacon boot flow to reduce boot time. - -+------------------------------------------------------------------------+ -| DMSC | R5 | A53 | -+------------------------------------------------------------------------+ -| +--------+ | | | -| | 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/A53 -requests DMSC to get these services done as shown in the above diagram. - -Sources: --------- -1. SYSFW: - Tree: git://git.ti.com/k3-image-gen/k3-image-gen.git - Branch: master - -2. ATF: - Tree: https://github.com/ARM-software/arm-trusted-firmware.git - Branch: master - -3. OPTEE: - Tree: https://github.com/OP-TEE/optee_os.git - Branch: master - -4. U-Boot: - Tree: http://git.denx.de/u-boot.git - Branch: master - -Build procedure: ----------------- -1. SYSFW: -$ make CROSS_COMPILE=arm-linux-gnueabihf- - -2. ATF: -$ make CROSS_COMPILE=aarch64-linux-gnu- ARCH=aarch64 PLAT=k3 TARGET_BOARD=generic SPD=opteed - -3. OPTEE: -$ make PLATFORM=k3-am65x CFG_ARM64_core=y - -4. U-Boot: - -4.1. R5: -$ make CROSS_COMPILE=arm-linux-gnueabihf- am65x_evm_r5_defconfig O=/tmp/r5 -$ make CROSS_COMPILE=arm-linux-gnueabihf- O=/tmp/r5 - -4.2. A53: -$ make CROSS_COMPILE=aarch64-linux-gnu- am65x_evm_a53_defconfig O=/tmp/a53 -$ make CROSS_COMPILE=aarch64-linux-gnu- ATF=/build/k3/generic/release/bl31.bin TEE=/out/arm-plat-k3/core/tee-pager_v2.bin O=/tmp/a53 - -Target Images --------------- -Copy the below images to an SD card and boot: -- sysfw.itb from step 1 -- tiboot3.bin from step 4.1 -- tispl.bin, u-boot.img from 4.2 - -Image formats: --------------- - -- tiboot3.bin: - +-----------------------+ - | X.509 | - | Certificate | - | +-------------------+ | - | | | | - | | R5 | | - | | u-boot-spl.bin | | - | | | | - | +-------------------+ | - | | | | - | | FIT header | | - | | +---------------+ | | - | | | | | | - | | | DTB 1...N | | | - | | +---------------+ | | - | +-------------------+ | - +-----------------------+ - -- tispl.bin - +-----------------------+ - | | - | FIT HEADER | - | +-------------------+ | - | | | | - | | A53 ATF | | - | +-------------------+ | - | | | | - | | A53 OPTEE | | - | +-------------------+ | - | | | | - | | A53 SPL | | - | +-------------------+ | - | | | | - | | SPL DTB 1...N | | - | +-------------------+ | - +-----------------------+ - -- sysfw.itb - +-----------------------+ - | | - | FIT HEADER | - | +-------------------+ | - | | | | - | | sysfw.bin | | - | +-------------------+ | - | | | | - | | board config | | - | +-------------------+ | - | | | | - | | PM config | | - | +-------------------+ | - | | | | - | | RM config | | - | +-------------------+ | - | | | | - | | Secure config | | - | +-------------------+ | - +-----------------------+ - -eMMC: ------ -ROM supports booting from eMMC from boot0 partition offset 0x0 - -Flashing images to eMMC: - -The following commands can be used to download tiboot3.bin, tispl.bin, -u-boot.img, and sysfw.itb from an SD card and write them to the eMMC boot0 -partition at respective addresses. - -=> mmc dev 0 1 -=> fatload mmc 1 ${loadaddr} tiboot3.bin -=> mmc write ${loadaddr} 0x0 0x400 -=> fatload mmc 1 ${loadaddr} tispl.bin -=> mmc write ${loadaddr} 0x400 0x1000 -=> fatload mmc 1 ${loadaddr} u-boot.img -=> mmc write ${loadaddr} 0x1400 0x2000 -=> fatload mmc 1 ${loadaddr} sysfw.itb -=> mmc write ${loadaddr} 0x3600 0x800 - -To give the ROM access to the boot partition, the following commands must be -used for the first time: -=> mmc partconf 0 1 1 1 -=> mmc bootbus 0 1 0 0 - -To create a software partition for the rootfs, the following command can be -used: -=> gpt write mmc 0 ${partitions} - -eMMC layout: - - boot0 partition (8 MB) user partition - 0x0+----------------------------------+ 0x0+-------------------------+ - | tiboot3.bin (512 KB) | | | - 0x400+----------------------------------+ | | - | tispl.bin (2 MB) | | | -0x1400+----------------------------------+ | rootfs | - | u-boot.img (4 MB) | | | -0x3400+----------------------------------+ | | - | environment (128 KB) | | | -0x3500+----------------------------------+ | | - | backup environment (128 KB) | | | -0x3600+----------------------------------+ | | - | sysfw (1 MB) | | | -0x3E00+----------------------------------+ +-------------------------+ - -Kernel image and DT are expected to be present in the /boot folder of rootfs. -To boot kernel from eMMC, use the following commands: -=> setenv mmcdev 0 -=> setenv bootpart 0 -=> boot - -OSPI: ------ -ROM supports booting from OSPI from offset 0x0. - -Flashing images to OSPI: - -Below commands can be used to download tiboot3.bin, tispl.bin, u-boot.img, -and sysfw.itb over tftp and then flash those to OSPI at their respective -addresses. - -=> sf probe -=> tftp ${loadaddr} tiboot3.bin -=> sf update $loadaddr 0x0 $filesize -=> tftp ${loadaddr} tispl.bin -=> sf update $loadaddr 0x80000 $filesize -=> tftp ${loadaddr} u-boot.img -=> sf update $loadaddr 0x280000 $filesize -=> tftp ${loadaddr} sysfw.itb -=> sf update $loadaddr 0x6C0000 $filesize - -Flash layout for OSPI: - - 0x0 +----------------------------+ - | ospi.tiboot3(512K) | - | | - 0x80000 +----------------------------+ - | ospi.tispl(2M) | - | | - 0x280000 +----------------------------+ - | ospi.u-boot(4M) | - | | - 0x680000 +----------------------------+ - | ospi.env(128K) | - | | - 0x6A0000 +----------------------------+ - | ospi.env.backup (128K) | - | | - 0x6C0000 +----------------------------+ - | ospi.sysfw(1M) | - | | - 0x7C0000 +----------------------------+ - | padding (256k) | - 0x800000 +----------------------------+ - | ospi.rootfs(UBIFS) | - | | - +----------------------------+ - -Kernel Image and DT are expected to be present in the /boot folder of UBIFS -ospi.rootfs just like in SD card case. U-Boot looks for UBI volume named -"rootfs" for rootfs. - -To boot kernel from OSPI, at the U-Boot prompt: -=> setenv boot ubi -=> boot - -UART: ------ -ROM supports booting from MCU_UART0 via X-Modem protocol. The entire UART-based -boot process up to U-Boot (proper) prompt goes through different stages and uses -different UART peripherals as follows: - - WHO | Loading WHAT | HW Module | Protocol -----------+---------------+-------------+------------ -Boot ROM | tiboot3.bin | MCU_UART0 | X-Modem(*) -R5 SPL | sysfw.itb | MCU_UART0 | Y-Modem(*) -R5 SPL | tispl.bin | MAIN_UART0 | Y-Modem -A53 SPL | u-boot.img | MAIN_UART0 | Y-Modem - -(*) Note that in addition to X/Y-Modem related protocol timeouts the DMSC - watchdog timeout of 3min (typ.) needs to be observed until System Firmware - is fully loaded (from sysfw.itb) and started. - -Example bash script sequence for running on a Linux host PC feeding all boot -artifacts needed to the device: - -MCU_DEV=/dev/ttyUSB1 -MAIN_DEV=/dev/ttyUSB0 - -stty -F $MCU_DEV 115200 cs8 -cstopb -parenb -stty -F $MAIN_DEV 115200 cs8 -cstopb -parenb - -sb --xmodem tiboot3.bin > $MCU_DEV < $MCU_DEV -sb --ymodem sysfw.itb > $MCU_DEV < $MCU_DEV -sb --ymodem tispl.bin > $MAIN_DEV < $MAIN_DEV -sleep 1 -sb --xmodem u-boot.img > $MAIN_DEV < $MAIN_DEV diff --git a/doc/board/ti/am62x_sk.rst b/doc/board/ti/am62x_sk.rst index 8642bdf16d..3a122b0756 100644 --- a/doc/board/ti/am62x_sk.rst +++ b/doc/board/ti/am62x_sk.rst @@ -90,9 +90,9 @@ Below is the pictorial representation of boot flow: | | |----------|-----------------------|---->| Reset rls | | | | | | | +-----------+ | | | TIFS | | | : | - | |Services| | | +-----------+ | - | | |<---------|-----------------------|---->|*ATF/OPTEE*| | - | | | | | +-----------+ | + | |Services| | | +-------------+ | + | | |<---------|-----------------------|---->|*TF-A/OP-TEE*| | + | | | | | +-------------+ | | | | | | : | | | | | | +-----------+ | | | |<---------|-----------------------|---->| *A53 SPL* | | @@ -115,65 +115,76 @@ Below is the pictorial representation of boot flow: Sources: -------- -1. SYSFW: - Tree: git://git.ti.com/k3-image-gen/k3-image-gen.git - Branch: master - -2. ATF: - Tree: https://github.com/ARM-software/arm-trusted-firmware.git +1. Trusted Firmware-A: + Tree: https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/ Branch: master -3. OPTEE: +2. OP-TEE: Tree: https://github.com/OP-TEE/optee_os.git Branch: master -4. U-Boot: +3. U-Boot: Tree: https://source.denx.de/u-boot/u-boot Branch: master -5. TI Linux Firmware: +4. TI Linux Firmware: Tree: git://git.ti.com/processor-firmware/ti-linux-firmware.git Branch: ti-linux-firmware Build procedure: ---------------- -1. ATF: +1. Trusted Firmware-A: -.. code-block:: text +.. code-block:: bash - $ make CROSS_COMPILE=aarch64-none-linux-gnu- ARCH=aarch64 PLAT=k3 TARGET_BOARD=lite SPD=opteed + $ make CROSS_COMPILE=aarch64-none-linux-gnu- ARCH=aarch64 PLAT=k3 \ + TARGET_BOARD=lite SPD=opteed -2. OPTEE: +2. OP-TEE: -.. code-block:: text +.. code-block:: bash - $ make PLATFORM=k3 CFG_ARM64_core=y CROSS_COMPILE=arm-none-linux-gnueabihf- CROSS_COMPILE64=aarch64-none-linux-gnu- + $ make PLATFORM=k3 CFG_ARM64_core=y CROSS_COMPILE=arm-none-linux-gnueabihf- \ + CROSS_COMPILE64=aarch64-none-linux-gnu- 3. U-Boot: * 3.1 R5: -.. code-block:: text - - $ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- am62x_evm_r5_defconfig O=/tmp/r5 - $ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- O=/tmp/r5 - $ cd - $ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- SOC=am62x SBL=/tmp/r5/spl/u-boot-spl.bin SYSFW_PATH=/ti-sysfw/ti-fs-firmware-am62x-gp.bin +.. code-block:: bash -Use the tiboot3.bin generated from last command + $ make ARCH=arm am62x_evm_r5_defconfig + $ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- \ + BINMAN_INDIRS= * 3.2 A53: -.. code-block:: text +.. code-block:: bash - $ make ARCH=arm CROSS_COMPILE=aarch64-none-linux-gnu- am62x_evm_a53_defconfig O=/tmp/a53 - $ make ARCH=arm CROSS_COMPILE=aarch64-none-linux-gnu- ATF=/build/k3/lite/release/bl31.bin TEE=/out/arm-plat-k3/core/tee-pager_v2.bin DM=/ti-dm/am62xx/ipc_echo_testb_mcu1_0_release_strip.xer5f O=/tmp/a53 + $ make ARCH=arm am62x_evm_a53_defconfig + $ make ARCH=arm CROSS_COMPILE=aarch64-none-linux-gnu- \ + BL31=/build/k3/lite/release/bl31.bin \ + TEE=/out/arm-plat-k3/core/tee-raw.bin \ + BINMAN_INDIRS= Target Images -------------- Copy the below images to an SD card and boot: - - tiboot3.bin from step 3.1 - - tispl.bin, u-boot.img from 3.2 + + - GP + + * tiboot3-am62x-gp-evm.bin from step 3.1 + * tispl.bin_unsigned, u-boot.img_unsigned from step 3.2 + + - HS-FS + + * tiboot3-am62x-hs-fs-evm.bin from step 3.1 + * tispl.bin, u-boot.img from step 3.2 + + - HS-SE + + * tiboot3-am62x-hs-evm.bin from step 3.1 + * tispl.bin, u-boot.img from step 3.2 Image formats: -------------- @@ -214,10 +225,10 @@ Image formats: | FIT HEADER | | +-------------------+ | | | | | - | | A53 ATF | | + | | A53 TF-A | | | +-------------------+ | | | | | - | | A53 OPTEE | | + | | A53 OP-TEE | | | +-------------------+ | | | | | | | R5 DM FW | | diff --git a/doc/board/ti/am65x_evm.rst b/doc/board/ti/am65x_evm.rst new file mode 100644 index 0000000000..300cd3e9b9 --- /dev/null +++ b/doc/board/ti/am65x_evm.rst @@ -0,0 +1,420 @@ +.. SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause +.. sectionauthor:: Neha Francis + +AM65x Platforms +=============== + +Introduction: +------------- +The AM65x family of SoCs is the first device family from K3 Multicore +SoC architecture, targeted for broad market and industrial control with +aim to meet the complex processing needs of modern embedded products. + +The device is built over three domains, each containing specific processing +cores, voltage domains and peripherals: + +1. Wake-up (WKUP) domain: + * Device Management and Security Controller (DMSC) + +2. Microcontroller (MCU) domain: + * Dual Core ARM Cortex-R5F processor + +3. MAIN domain: + * Quad core 64-bit ARM Cortex-A53 + +More info can be found in TRM: http://www.ti.com/lit/pdf/spruid7 + +Boot Flow: +---------- +On AM65x family devices, ROM supports boot only via MCU(R5). This means that +bootloader has to run on R5 core. In order to meet this constraint, and for +the following reasons the boot flow is designed as mentioned: + +1. Need to move away from R5 asap, so that we want to start *any* +firmware on the R5 cores for example autosar can be loaded to receive CAN +response and other safety operations to be started. This operation is +very time critical and is applicable for all automotive use cases. + +2. U-Boot on A53 should start other remotecores for various +applications. This should happen before running Linux. + +3. In production boot flow, we might not like to use full U-Boot, +instead use Falcon boot flow to reduce boot time. + +.. code-block:: text + + +------------------------------------------------------------------------+ + | DMSC | R5 | A53 | + +------------------------------------------------------------------------+ + | +--------+ | | | + | | 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/OP-TEE*| | + | | | | | +------------+ | + | | | | | : | + | | | | | +-----------+ | + | | |<--------|-----------------------|---->| *A53 SPL* | | + | | | | | +-----------+ | + | | | | | | Load | | + | | | | | | u-boot.img| | + | | | | | +-----------+ | + | | | | | : | + | | | | | +-----------+ | + | | |<--------|-----------------------|---->| *U-Boot* | | + | | | | | +-----------+ | + | | | | | | prompt | | + | | | | | +-----------+ | + | +---------+ | | | + | | | | + +------------------------------------------------------------------------+ + +- Here DMSC acts as master and provides all the critical services. R5/A53 + requests DMSC to get these services done as shown in the above diagram. + +Sources: +-------- +1. Trusted Firmware-A: + Tree: https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/ + Branch: master + +2. OP-TEE: + Tree: https://github.com/OP-TEE/optee_os.git + Branch: master + +3. U-Boot: + Tree: https://source.denx.de/u-boot/u-boot + Branch: master + +4. TI Linux Firmware: + Tree: git://git.ti.com/processor-firmware/ti-linux-firmware.git + Branch: ti-linux-firmware + +Build procedure: +---------------- +1. Trusted Firmware-A: + +.. code-block:: bash + + $ make CROSS_COMPILE=aarch64-linux-gnu- ARCH=aarch64 PLAT=k3 \ + TARGET_BOARD=generic SPD=opteed + +2. OP-TEE: + +.. code-block:: bash + + $ make PLATFORM=k3-am65x CFG_ARM64_core=y + +3. U-Boot: + +* 4.1 R5: + +.. code-block:: bash + + $ make am65x_evm_r5_defconfig + $ make CROSS_COMPILE=arm-linux-gnueabihf- \ + BINMAN_INDIRS= + +* 4.2 A53: + +.. code-block:: bash + + $ make am65x_evm_a53_defconfig + $ make CROSS_COMPILE=aarch64-linux-gnu- \ + BL31=/build/k3/generic/release/bl31.bin \ + TEE=/out/arm-plat-k3/core/tee-raw.bin \ + BINMAN_INDIRS= + +Target Images +-------------- +Copy the below images to an SD card and boot: + +- GP + + * tiboot3-am65x_sr2-gp-evm.bin, sysfw-am65x_sr2-gp-evm.itb from step 4.1 + * tispl.bin_unsigned, u-boot.img_unsigned from step 4.2 + +- HS + + * tiboot3-am65x_sr2-hs-evm.bin, sysfw-am65x_sr2-hs-evm.itb from step 4.1 + * tispl.bin, u-boot.img from step 4.2 + +Image formats: +-------------- + +- tiboot3.bin: + +.. code-block:: text + + +-----------------------+ + | X.509 | + | Certificate | + | +-------------------+ | + | | | | + | | R5 | | + | | u-boot-spl.bin | | + | | | | + | +-------------------+ | + | | | | + | | FIT header | | + | | +---------------+ | | + | | | | | | + | | | DTB 1...N | | | + | | +---------------+ | | + | +-------------------+ | + +-----------------------+ + +- tispl.bin + +.. code-block:: text + + +-----------------------+ + | | + | FIT HEADER | + | +-------------------+ | + | | | | + | | A53 ATF | | + | +-------------------+ | + | | | | + | | A53 OP-TEE | | + | +-------------------+ | + | | | | + | | A53 SPL | | + | +-------------------+ | + | | | | + | | SPL DTB 1...N | | + | +-------------------+ | + +-----------------------+ + +- sysfw.itb + +.. code-block:: text + + +-----------------------+ + | | + | FIT HEADER | + | +-------------------+ | + | | | | + | | sysfw.bin | | + | +-------------------+ | + | | | | + | | board config | | + | +-------------------+ | + | | | | + | | PM config | | + | +-------------------+ | + | | | | + | | RM config | | + | +-------------------+ | + | | | | + | | Secure config | | + | +-------------------+ | + +-----------------------+ + +eMMC: +----- +ROM supports booting from eMMC from boot0 partition offset 0x0 + +Flashing images to eMMC: + +The following commands can be used to download tiboot3.bin, tispl.bin, +u-boot.img, and sysfw.itb from an SD card and write them to the eMMC boot0 +partition at respective addresses. + +.. code-block:: text + + => mmc dev 0 1 + => fatload mmc 1 ${loadaddr} tiboot3.bin + => mmc write ${loadaddr} 0x0 0x400 + => fatload mmc 1 ${loadaddr} tispl.bin + => mmc write ${loadaddr} 0x400 0x1000 + => fatload mmc 1 ${loadaddr} u-boot.img + => mmc write ${loadaddr} 0x1400 0x2000 + => fatload mmc 1 ${loadaddr} sysfw.itb + => mmc write ${loadaddr} 0x3600 0x800 + +To give the ROM access to the boot partition, the following commands must be +used for the first time: + +.. code-block:: text + + => mmc partconf 0 1 1 1 + => mmc bootbus 0 1 0 0 + +To create a software partition for the rootfs, the following command can be +used: + +.. code-block:: text + + => gpt write mmc 0 ${partitions} + +eMMC layout: + +.. code-block:: text + + boot0 partition (8 MB) user partition + 0x0+----------------------------------+ 0x0+-------------------------+ + | tiboot3.bin (512 KB) | | | + 0x400+----------------------------------+ | | + | tispl.bin (2 MB) | | | + 0x1400+----------------------------------+ | rootfs | + | u-boot.img (4 MB) | | | + 0x3400+----------------------------------+ | | + | environment (128 KB) | | | + 0x3500+----------------------------------+ | | + | backup environment (128 KB) | | | + 0x3600+----------------------------------+ | | + | sysfw (1 MB) | | | + 0x3E00+----------------------------------+ +-------------------------+ + +Kernel image and DT are expected to be present in the /boot folder of rootfs. +To boot kernel from eMMC, use the following commands: + +.. code-block:: text + + => setenv mmcdev 0 + => setenv bootpart 0 + => boot + +OSPI: +----- +ROM supports booting from OSPI from offset 0x0. + +Flashing images to OSPI: + +Below commands can be used to download tiboot3.bin, tispl.bin, u-boot.img, +and sysfw.itb over tftp and then flash those to OSPI at their respective +addresses. + +.. code-block:: text + + => sf probe + => tftp ${loadaddr} tiboot3.bin + => sf update $loadaddr 0x0 $filesize + => tftp ${loadaddr} tispl.bin + => sf update $loadaddr 0x80000 $filesize + => tftp ${loadaddr} u-boot.img + => sf update $loadaddr 0x280000 $filesize + => tftp ${loadaddr} sysfw.itb + => sf update $loadaddr 0x6C0000 $filesize + +Flash layout for OSPI: + +.. code-block:: text + + 0x0 +----------------------------+ + | ospi.tiboot3(512K) | + | | + 0x80000 +----------------------------+ + | ospi.tispl(2M) | + | | + 0x280000 +----------------------------+ + | ospi.u-boot(4M) | + | | + 0x680000 +----------------------------+ + | ospi.env(128K) | + | | + 0x6A0000 +----------------------------+ + | ospi.env.backup (128K) | + | | + 0x6C0000 +----------------------------+ + | ospi.sysfw(1M) | + | | + 0x7C0000 +----------------------------+ + | padding (256k) | + 0x800000 +----------------------------+ + | ospi.rootfs(UBIFS) | + | | + +----------------------------+ + +Kernel Image and DT are expected to be present in the /boot folder of UBIFS +ospi.rootfs just like in SD card case. U-Boot looks for UBI volume named +"rootfs" for rootfs. + +To boot kernel from OSPI, at the U-Boot prompt: + +.. code-block:: text + + => setenv boot ubi + => boot + +UART: +----- +ROM supports booting from MCU_UART0 via X-Modem protocol. The entire UART-based +boot process up to U-Boot (proper) prompt goes through different stages and uses +different UART peripherals as follows: + +.. code-block:: text + + +---------+---------------+-------------+------------+ + | WHO | Loading WHAT | HW Module | Protocol | + +---------+---------------+-------------+------------+ + |Boot ROM | tiboot3.bin | MCU_UART0 | X-Modem(*)| + |R5 SPL | sysfw.itb | MCU_UART0 | Y-Modem(*)| + |R5 SPL | tispl.bin | MAIN_UART0 | Y-Modem | + |A53 SPL | u-boot.img | MAIN_UART0 | Y-Modem | + +---------+---------------+-------------+------------+ + +Note that in addition to X/Y-Modem related protocol timeouts the DMSC +watchdog timeout of 3min (typ.) needs to be observed until System Firmware +is fully loaded (from sysfw.itb) and started. + +Example bash script sequence for running on a Linux host PC feeding all boot +artifacts needed to the device: + +.. code-block:: text + + MCU_DEV=/dev/ttyUSB1 + MAIN_DEV=/dev/ttyUSB0 + + stty -F $MCU_DEV 115200 cs8 -cstopb -parenb + stty -F $MAIN_DEV 115200 cs8 -cstopb -parenb + + sb --xmodem tiboot3.bin > $MCU_DEV < $MCU_DEV + sb --ymodem sysfw.itb > $MCU_DEV < $MCU_DEV + sb --ymodem tispl.bin > $MAIN_DEV < $MAIN_DEV + sleep 1 + sb --xmodem u-boot.img > $MAIN_DEV < $MAIN_DEV diff --git a/doc/board/ti/j7200_evm.rst b/doc/board/ti/j7200_evm.rst index 0d3a526516..5e3d75059c 100644 --- a/doc/board/ti/j7200_evm.rst +++ b/doc/board/ti/j7200_evm.rst @@ -83,9 +83,9 @@ Below is the pictorial representation of boot flow: | | |---------|-----------------------|---->| Reset rls | | | | | | | | +-----------+ | | | | TIFS | | | : | | - | |Services | | | +-----------+ | | - | | |<--------|-----------------------|---->|*ATF/OPTEE*| | | - | | | | | +-----------+ | | + | |Services | | | +-------------+ | | + | | |<--------|-----------------------|---->|*TF-A/OP-TEE*| | | + | | | | | +-------------+ | | | | | | | : | | | | | | | +-----------+ | | | | |<--------|-----------------------|---->| *A72 SPL* | | | @@ -120,68 +120,74 @@ Below is the pictorial representation of boot flow: Sources: -------- -1. SYSFW: - Tree: git://git.ti.com/k3-image-gen/k3-image-gen.git +1. Trusted Firmware-A: + Tree: https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/ Branch: master -2. ATF: - Tree: https://github.com/ARM-software/arm-trusted-firmware.git +2. OP-TEE: + Tree: https://github.com/OP-TEE/optee_os.git Branch: master -3. OPTEE: - Tree: https://github.com/OP-TEE/optee_os.git +3. U-Boot: + Tree: https://source.denx.de/u-boot/u-boot Branch: master -4. DM Firmware: +4. TI Linux Firmware: Tree: git://git.ti.com/processor-firmware/ti-linux-firmware.git Branch: ti-linux-firmware -5. U-Boot: - Tree: https://source.denx.de/u-boot/u-boot - Branch: master - Build procedure: ---------------- -1. SYSFW: +1. Trusted Firmware-A: .. code-block:: bash - make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- SOC=j7200 SBL=u-boot-spl.bin SYSFW_PATH=/ti-fs-firmware-j7200-gp.bin - u-boot-spl.bin is generated at step 4. + $ make CROSS_COMPILE=aarch64-linux-gnu- ARCH=aarch64 PLAT=k3 TARGET_BOARD=generic SPD=opteed -2. ATF: +2. OP-TEE: .. code-block:: bash - make CROSS_COMPILE=aarch64-linux-gnu- ARCH=aarch64 PLAT=k3 TARGET_BOARD=generic SPD=opteed + $ make PLATFORM=k3-j7200 CFG_ARM64_core=y -3. OPTEE: - -.. code-block:: bash - - make PLATFORM=k3-j7200 CFG_ARM64_core=y - -4. U-Boot: +3. U-Boot: * 4.1 R5: .. code-block:: bash - make CROSS_COMPILE=arm-linux-gnueabihf- j7200_evm_r5_defconfig O=build/r5 - make CROSS_COMPILE=arm-linux-gnueabihf- O=build/r5 + $ make CROSS_COMPILE=arm-linux-gnueabihf- j7200_evm_r5_defconfig O=build/r5 + $ make CROSS_COMPILE=arm-linux-gnueabihf- \ + BINMAN_INDIRS= * 4.2 A72: .. code-block:: bash - make CROSS_COMPILE=aarch64-linux-gnu- j7200_evm_a72_defconfig O=build/a72 - make CROSS_COMPILE=aarch64-linux-gnu- ATF=/build/k3/generic/release/bl31.bin TEE=/out/arm-plat-k3/core/tee-pager_v2.bin DM=/ti-dm/j7200/ipc_echo_testb_mcu1_0_release_strip.xer5f O=build/a72 + $ make CROSS_COMPILE=aarch64-linux-gnu- j7200_evm_a72_defconfig O=build/a72 + $ make CROSS_COMPILE=aarch64-linux-gnu- \ + BL31=/build/k3/generic/release/bl31.bin \ + TEE=/out/arm-plat-k3/core/tee-raw.bin \ + BINMAN_INDIRS= Target Images -------------- Copy the below images to an SD card and boot: - - tiboot3.bin from step 1 - - tispl.bin, u-boot.img from 4.2 + + - GP + + * tiboot3-j7200-gp-evm.bin from step 4.1 + * tispl.bin_unsigned, u-boot.img_unsigned from step 4.2 + + - HS-FS + + * tiboot3-j7200_sr2-hs-fs-evm.bin from step 4.1 + * tispl.bin, u-boot.img from step 4.2 + + - HS-SE + + * tiboot3-j7200_sr2-hs-evm.bin from step 4.1 + * tispl.bin, u-boot.img from step 4.2 Image formats: -------------- @@ -236,10 +242,10 @@ Image formats: | FIT HEADER | | +-------------------+ | | | | | - | | A72 ATF | | + | | A72 TF-A | | | +-------------------+ | | | | | - | | A72 OPTEE | | + | | A72 OP-TEE | | | +-------------------+ | | | | | | | R5 DM FW | | diff --git a/doc/board/ti/j721e_evm.rst b/doc/board/ti/j721e_evm.rst index feaa2da5e9..46244197f3 100644 --- a/doc/board/ti/j721e_evm.rst +++ b/doc/board/ti/j721e_evm.rst @@ -90,9 +90,9 @@ support. Below is the pictorial representation of boot flow: | | |---------|-----------------------|---->| Reset rls | | | | | | | | +-----------+ | | | | TIFS | | | : | | - | |Services | | | +-----------+ | | - | | |<--------|-----------------------|---->|*ATF/OPTEE*| | | - | | | | | +-----------+ | | + | |Services | | | +-------------+ | | + | | |<--------|-----------------------|---->|*TF-A/OP-TEE*| | | + | | | | | +-------------+ | | | | | | | : | | | | | | | +-----------+ | | | | |<--------|-----------------------|---->| *A72 SPL* | | | @@ -130,68 +130,75 @@ support. Below is the pictorial representation of boot flow: Sources: -------- -1. SYSFW: - Tree: git://git.ti.com/k3-image-gen/k3-image-gen.git +1. Trusted Firmware-A: + Tree: https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/ Branch: master -2. ATF: - Tree: https://github.com/ARM-software/arm-trusted-firmware.git +2. OP-TEE: + Tree: https://github.com/OP-TEE/optee_os.git Branch: master -3. OPTEE: - Tree: https://github.com/OP-TEE/optee_os.git +3. U-Boot: + Tree: https://source.denx.de/u-boot/u-boot Branch: master -4. DM Firmware: +4. TI Linux Firmware: Tree: git://git.ti.com/processor-firmware/ti-linux-firmware.git Branch: ti-linux-firmware -5. U-Boot: - Tree: https://source.denx.de/u-boot/u-boot - Branch: master - Build procedure: ---------------- -1. SYSFW: +1. Trusted Firmware-A: .. code-block:: bash - make CROSS_COMPILE=arm-linux-gnueabihf- SOC=j721e + $ make CROSS_COMPILE=aarch64-linux-gnu- ARCH=aarch64 PLAT=k3 \ + TARGET_BOARD=generic SPD=opteed -2. ATF: +2. OP-TEE: .. code-block:: bash - make CROSS_COMPILE=aarch64-linux-gnu- ARCH=aarch64 PLAT=k3 TARGET_BOARD=generic SPD=opteed + $ make PLATFORM=k3-j721e CFG_ARM64_core=y -3. OPTEE: - -.. code-block:: bash - - make PLATFORM=k3-j721e CFG_ARM64_core=y - -4. U-Boot: +3. U-Boot: * 4.1 R5: .. code-block:: bash - make CROSS_COMPILE=arm-linux-gnueabihf- j721e_evm_r5_defconfig O=build/r5 - make CROSS_COMPILE=arm-linux-gnueabihf- O=build/r5 + $ make j721e_evm_r5_defconfig + $ make CROSS_COMPILE=arm-linux-gnueabihf- \ + BINMAN_INDIRS= * 4.2 A72: .. code-block:: bash - make CROSS_COMPILE=aarch64-linux-gnu- j721e_evm_a72_defconfig O=build/a72 - make CROSS_COMPILE=aarch64-linux-gnu- ATF=/build/k3/generic/release/bl31.bin TEE=/out/arm-plat-k3/core/tee-pager_v2.bin DM=/ti-dm/j721e/ipc_echo_testb_mcu1_0_release_strip.xer5f O=build/a72 + $ make j721e_evm_a72_defconfig + $ make CROSS_COMPILE=aarch64-linux-gnu- \ + BL31=/build/k3/generic/release/bl31.bin \ + TEE=/out/arm-plat-k3/core/tee-raw.bin \ + BINMAN_INDIRS= Target Images -------------- Copy the below images to an SD card and boot: - - sysfw.itb from step 1 - - tiboot3.bin from step 4.1 - - tispl.bin, u-boot.img from 4.2 + + - GP + + * tiboot3-j721e-gp-evm.bin, sysfw-j721e-gp-evm.itb from step 4.1 + * tispl.bin_unsigned, u-boot.img_unsigned from step 4.2 + + - HS-FS + + * tiboot3-j721e_sr2-hs-fs-evm.bin, sysfw-j721e_sr2-hs-fs-evm.itb from step 4.1 + * tispl.bin, u-boot.img from step 4.2 + + - HS-SE + + * tiboot3-j721e_sr2-hs-evm.bin, sysfw-j721e_sr2-hs-evm.itb from step 4.1 + * tispl.bin, u-boot.img from step 4.2 Image formats: -------------- @@ -227,10 +234,10 @@ Image formats: | FIT HEADER | | +-------------------+ | | | | | - | | A72 ATF | | + | | A72 TF-A | | | +-------------------+ | | | | | - | | A72 OPTEE | | + | | A72 OP-TEE | | | +-------------------+ | | | | | | | R5 DM FW | | diff --git a/doc/board/ti/k3.rst b/doc/board/ti/k3.rst index 2b2f4bb8bb..7390e0305e 100644 --- a/doc/board/ti/k3.rst +++ b/doc/board/ti/k3.rst @@ -33,6 +33,7 @@ K3 Based SoCs j721e_evm j7200_evm am62x_sk + am65x_evm Boot Flow Overview ------------------ @@ -53,13 +54,13 @@ The wakeup SPL, running on a wakeup domain core, will initialize DDR and any peripherals needed load the larger binaries inside the `tispl.bin` into DDR. Once loaded the wakeup SPL will start one of the 'big' application cores inside the main domain to initialize the main domain, -starting with ARM Trusted Firmware (ATF), before moving on to start -OPTEE and the main domain's U-Boot SPL. +starting with Trusted Firmware-A (TF-A), before moving on to start +OP-TEE and the main domain's U-Boot SPL. .. code-block:: text | WKUP Domain | Main Domain -> - ROM -> WKUP SPL -> ATF -> OPTEE -> Main SPL + ROM -> WKUP SPL -> TF-A -> OP-TEE -> Main SPL The main domain's SPL, running on a 64bit application core, has virtually unlimited space (billions of bytes now that DDR is working) to @@ -70,7 +71,7 @@ finally prepare the main domain to run Linux. .. code-block:: text | WKUP Domain | Main Domain -> - ROM -> WKUP SPL -> ATF -> OPTEE -> Main SPL -> UBoot -> Linux + ROM -> WKUP SPL -> TF-A -> OP-TEE -> Main SPL -> UBoot -> Linux This is the typical boot flow for all K3 based SoCs, however this flow offers quite a lot in the terms of flexibility, especially on High @@ -115,17 +116,12 @@ online | **source:** https://source.denx.de/u-boot/u-boot.git | **branch:** master -* **K3 Image Gen** +* **Trusted Firmware-A (TF-A)** - | **source:** https://git.ti.com/git/k3-image-gen/k3-image-gen.git + | **source:** https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/ | **branch:** master -* **ARM Trusted Firmware (ATF)** - - | **source:** https://github.com/ARM-software/arm-trusted-firmware.git - | **branch:** master - -* **Open Portable Trusted Execution Environment (OPTEE)** +* **Open Portable Trusted Execution Environment (OP-TEE)** | **source:** https://github.com/OP-TEE/optee_os.git | **branch:** master @@ -135,11 +131,6 @@ online | **source:** https://git.ti.com/git/processor-firmware/ti-linux-firmware.git | **branch:** ti-linux-firmware -* **TI's Security Development Tools** - - | **source:** https://git.ti.com/git/security-development-tools/core-secdev-k3.git - | **branch:** master - Build Procedure --------------- @@ -161,54 +152,37 @@ All of that to say you will need both a 32bit and 64bit cross compiler .. code-block:: bash - export CC32=arm-linux-gnueabihf- - export CC64=aarch64-linux-gnu- + $ export CC32=arm-linux-gnueabihf- + $ export CC64=aarch64-linux-gnu- Building tiboot3.bin ^^^^^^^^^^^^^^^^^^^^^ 1. To generate the U-Boot SPL for the wakeup domain, use the following commands, substituting :code:`{SOC}` for the name of your device (eg: - am62x) - -.. code-block:: bash - - # inside u-boot source - make ARCH=arm O=build/wkup CROSS_COMPILE=$CC32 {SOC}_evm_r5_defconfig - make ARCH=arm O=build/wkup CROSS_COMPILE=$CC32 + am62x) to package the various firmware and the wakeup UBoot SPL into + the final `tiboot3.bin` binary. (or the `sysfw.itb` if your device + uses the split binary flow) -2. Next we will use the K3 Image Gen scripts to package the various - firmware and the wakeup UBoot SPL into the final `tiboot3.bin` - binary. (or the `sysfw.itb` if your device uses the split binary - flow) .. code-block:: bash - # inside k3-image-gen source - make CROSS_COMPILE=$CC32 SOC={SOC} SOC_TYPE={hs,gp} \ - TI_SECURE_DEV_PKG= \ - SYSFW_PATH= \ - SYSFW_HS_INNER_CERT_PATH= + $ # inside u-boot source + $ make ARCH=arm {SOC}_evm_r5_defconfig + $ make ARCH=arm CROSS_COMPILE=$CC32 \ + BINMAN_INDIRS= At this point you should have all the needed binaries to boot the wakeup domain of your K3 SoC. **Combined Binary Boot Flow** (eg: am62x, am64x, ... ) - `k3-image-gen/tiboot3-{SOC}-{hs,gp}-evm.bin` + `tiboot3-{SOC}-{gp/hs-fs/hs}.bin` **Split Binary Boot Flow** (eg: j721e, am65x) - | `u-boot/build/wkup/tiboot3.bin` - | `k3-image-gen/sysfw-{SOC}-evm.bin` + | `tiboot3-{SOC}-{gp/hs-fs/hs}.bin` + | `sysfw-{SOC}-{gp/hs-fs/hs}-evm.itb` .. note :: @@ -223,53 +197,47 @@ The `tispl.bin` is a standard fitImage combining the firmware need for the main domain to function properly as well as Device Management (DM) firmware if your device using a split firmware. -3. We will first need ATF, as it's the first thing to run on the 'big' +2. We will first need TF-A, as it's the first thing to run on the 'big' application cores on the main domain. .. code-block:: bash - # inside arm-trusted-firmware source - make CROSS_COMPILE=$CC64 ARCH=aarch64 PLAT=k3 \ - TARGET_BOARD={lite|generic} \ - SPD=opteed \ + $ # inside trusted-firmware-a source + $ make CROSS_COMPILE=$CC64 ARCH=aarch64 PLAT=k3 \ + TARGET_BOARD={lite|generic|j784s4} \ + SPD=opteed -Typically all `j7*` devices will use `TARGET_BOARD=generic` while all -Sitara (`am6*`) devices use the `lite` option. +Typically all `j7*` devices will use `TARGET_BOARD=generic` or `TARGET_BOARD +=j784s4` (if it is a J784S4 device), while all Sitara (`am6*`) devices +use the `lite` option. -4. The Open Portable Trusted Execution Environment (OPTEE) is designed +3. The Open Portable Trusted Execution Environment (OP-TEE) is designed to run as a companion to a non-secure Linux kernel for Cortex-A cores using the TrustZone technology built into the core. .. code-block:: bash - # inside optee_os source - make CROSS_COMPILE=$CC32 CROSS_COMPILE64=$CC64 \ + $ # inside optee_os source + $ make CROSS_COMPILE=$CC32 CROSS_COMPILE64=$CC64 \ PLATFORM=k3 CFG_ARM64_core=y -5. Finally, after ATF has initialized the main domain and OPTEE has +4. Finally, after TF-A has initialized the main domain and OP-TEE has finished, we can jump back into U-Boot again, this time running on a 64bit core in the main domain. .. code-block:: bash - # inside u-boot source - make ARCH=arm O=build/main CROSS_COMPILE=$CC64 {SOC}_evm_a{53,72}_defconfig - make ARCH=arm O=build/main CROSS_COMPILE=$CC64 \ - ATF= + $ # inside u-boot source + $ make ARCH=arm {SOC}_evm_a{53,72}_defconfig + $ make ARCH=arm CROSS_COMPILE=$CC64 \ + BINMAN_INDIRS= \ + BL31=/build/k3/generic/release/bl31.bin \ + TEE=/out/arm-plat-k3/core/tee-raw.bin At this point you should have every binary needed initialize both the wakeup and main domain and to boot to the U-Boot prompt **Main Domain Bootloader** - | `u-boot/build/main/tispl.bin` - | `u-boot/build/main/u-boot.img` + | `tispl.bin` for HS devices or `tispl.bin_unsigned` for GP devices + | `u-boot.img` for HS devices or `u-boot.img_unsigned` for GP devices