SBL OSPI Linux Multistage

Note

The load address of resource table for R5 and M4 cores must be consistant with the address in the Linux dts file.

Introduction

This is a bootloader example, which shows an example of booting Linux on A53 core and RTOS/NORTOS applications on WKUP R5, MCU R5 cores.

The booting is done in 2 stages(2 bootloader applications). - The stage1 of the bootloader runs from the HSM RAM. It initializes the DDR. Then it loads the stage2 of the bootloader with Device Manager to DDR and stats running it. - Stage2 is a multithreaded application which boots HSM-M4, RTOS on MCU-R5F, Linux on A53 in bootloader therad and sciserver will be running in another thread.

The SBL uses 5 appimages

  • A Linux appimage containing the Linux binaries (ATF, OPTEE, A53 SPL).

  • tiboot3.bin with SBL stage1, TIFS, BoardConfig

  • Appimage for WKUP R5 with SBL stage2

  • Appimage for MCU R5

  • Appimage for HSM M4

Refer SBL Booting Linux From OSPI for more details on the OSPI boot loader.

Note

The default appimages in the SDK are built with authentication type 0 and load address 0x84000000. The gAppimage section in the bootloader application also has to be linked to the same address (0x84000000). If gAppimage section address is changed or multiple gAppimage buffers are used in the bootloader application, please ensure application’s makefile is also updated with the corresponding load address.

In order to boot faster,

  • Linux appimage can be packaged with the Linux kernel and DTB in falcon mode (Linux Appimage Generator Tool). Refer to Processor SDK Linux for more information on how to create a buildable Kernel and DTB

  • This example reuses the OSPI initialization already performed at SBL stage 1 instead of reprogramming it. This is done by enabling the Skip OSPI Programming option in SBL stage 2 sysconfig

Refer Enabling DDR inline ECC enablig inline ECC

Supported Combinations

Parameter

Value

CPU + OS

wkup-r5fss0-0 nortos

Toolchain

ti-arm-clang

Board

am62px-sk

Example folder

examples/drivers/boot/sbl_ospi_linux_multistage

Steps to Run the Example

Build the example

  • When using CCS projects to build, import the CCS project for the required combination and build it using the CCS project menu (see Using SDK with CCS Projects).

  • When using makefiles to build, note the required combination and build using make command (see Using SDK with Makefiles)

Create Linux Appimage

Note

Change DEVICE_TYPE to HS in ${SDK_INSTALL_PATH}/devconfig/devconfig.mak and then generate Linux Appimage for HS-SE device.

  • Create a Linux Appimage containing the Linux binaries (ATF, OPTEE, A53 SPL) or (ATF, OPTEE, Kernel, DTB) in case of falcon mode.

  • This can be done by running the makefile at {SDK_INSTALL_PATH}/tools/boot/linuxAppimageGen after setting the PSDK path in file config.mak

  • Refer Linux Appimage Generator Tool for more details

Create HSM Appimage

Note

Change DEVICE_TYPE to HS in ${SDK_INSTALL_PATH}/devconfig/devconfig.mak and then generate Linux Appimage for HS-SE device.

  • Create a HSM Appimage

  • This can be done by running the makefile at {SDK_INSTALL_PATH}/tools/boot/HSMAppimageGen

  • Refer HSM Appimage Generator Tool for more details

Run the example

  • This example is the SBL which needs to be flashed on the EVM flash, along with sample application images for WKUP R5, MCU R5 CPUs and Linux Appimage.

  • There is a default flash config file as shown below which flashes this SBL and the IPC RPMsg Linux echo applications

      ${SDK_INSTALL_PATH}/tools/boot/sbl_prebuilt/{{ VAR_BOARD_NAME_LOWER }}/default_sbl_ospi_linux.cfg
    
  • For HS-FS device, use default_sbl_ospi_linux_hs_fs.cfg as the cfg file.

  • Make sure IPC rpmsg linux echo application is built before running the flash script. (see IPC RP Message Linux Echo)

Note

For IPC rpmsg linux echo, the resource table entity must be placed at the beginning of remoteproc memory section as mentoined in Linux dts file.

  • If only stage 2 bootloader with Device Manager is required on wkup-r5 core, update the wkup-r5 image in the flash config with sbl_ospi_linux_stage2 image

      # 2nd stage bootloader with DM is flashed at 0x80000 or to whatever offset your bootloader is configured for
      --file=../../examples/drivers/boot/sbl_ospi_linux_multistage/sbl_ospi_linux_stage2/am62px-sk/wkup-r5fss0-0_freertos/ti-arm-clang/sbl_ospi_linux_stage2.release.appimage --operation=flash --flash-offset=0x80000
    

Note

For early splash and display sharing on HLOS with SBL on HS-FS device, use default_sbl_ospi_linux_hs_fs_splash_screen.cfg as the cfg file.

  • To flash to the EVM, refer to Flash a Hello World example . Only when giving the flash config file, point to the default_sbl_ospi_linux.cfg shown above.

  • Example, assuming SDK is installed at C:/ti/mcu_plus_sdk and this example and IPC application is built using makefiles, and Linux Appimage is already created, in Windows,

cd C:/ti/mcu_plus_sdk/tools/boot
python uart_uniflash.py -p COM13 --cfg=C:/ti/mcu_plus_sdk/tools/boot/sbl_prebuilt/{{ VAR_BOARD_NAME_LOWER }}/default_sbl_ospi_linux.cfg
  • If Linux PC is used, assuming SDK is installed at ~/ti/mcu_plus_sdk

cd ~/ti/mcu_plus_sdk
python uart_uniflash.py -p /dev/ttyUSB0 --cfg=~/ti/mcu_plus_sdk/tools/boot/sbl_prebuilt/{{ VAR_BOARD_NAME_LOWER }}/default_sbl_ospi_linux.cfg
  • Boot the EVM in OSPI NOR boot mode.

Note

The above config file will flash till u-boot on the OSPI NOR bootmedia. U-Boot can load kernel from any bootmedia, refer to Processor SDK Linux user guide for more details.

See Also

Sample Output

After flashing and booting the EVM, you will see below output on the UART console (Complete log is not shown)

   [KPI] Boot Media       : FLASH
   [KPI] Boot Media Clock : 166.667 MHz
   [KPI] Boot Image Size  : 180 KB
   [KPI] Cores present    :
   wkup-r5f0-0
   [KPI] System_init                      :      38923us
   [KPI] Drivers_open                     :          0us
   [KPI] SBL Drivers_open                 :        150us
   [KPI] Board_driversOpen                :         10us
   [KPI] SBL Board_driversOpen            :      21978us
   [KPI] App_loadSelfcoreImage            :       5611us
   [KPI] SBL Total Time Taken             :      66674us

   Image loading done, switching to application ...
   Starting 2nd stage bootloader
   [KPI] Boot Media       : FLASH
   [KPI] Boot Media Clock : 166.667 MHz
   [KPI] Boot Image Size  : 853 KB
   [KPI] Cores present    :
   hsm-m4f0-0
   mcu-r5f0-0
   a530-0
   [KPI] System_init                      :       2305us
   [KPI] Board_init                       :          0us
   [KPI] SciserverInit                    :      16144us
   [KPI] SBL Drivers_open                 :        359us
   [KPI] SBL Board_driversOpen            :      22009us
   [KPI] App_loadImages                   :       1829us
   [KPI] App_loadMCUImages                :       3521us
   [KPI] App_loadLinuxImages              :      19311us
   [KPI] SBL Total Time Taken             :      65479us

   Image loading done, switching to application ...
   Starting linux and RTOS/Baremetal applications
   NOTICE:  BL31: v2.9(release):v2.9.0-dirty
   NOTICE:  BL31: Built : 14:12:59, May 22 2023

   U-Boot SPL 2023.04-g48c1296285 (Sep 14 2023 - 21:24:43 +0000)
   SYSFW ABI: 3.1 (firmware rev 0x0009 '9.0.6--w09.00.04-am62p (Kool Ko')
   Trying to boot from SPI
   Authentication passed
   Authentication passed


   U-Boot 2023.04-g48c1296285 (Sep 14 2023 - 21:24:43 +0000)

   SoC:   AM62PX SR1.0 HS-FS
   Model: Texas Instruments AM62P5 SK
   DRAM:  2 GiB (effective 8 GiB)
   .
   .
   .
   .
   .
   .


   _____                    _____           _         _

| _ |___ ___ ___ ___ | _ |___ ___ ||__ __| | | |—|—| | _ | .’ | | __ | __ | | ___ | ___ |

   Arago Project am62pxx-evm -

   Arago 2023.04 am62pxx-evm -

   am62pxx-evm login: