Hello everyone!
In this document you'll find an example on how to build your own flash.bin for i.MX93 low power mode where only the Cortex-M33 rom is running after Power-On Reset, the following table provides the boot devices supported for LP boot:
In LP boot, up to three containers (NXP and OEM containers) are expected to be handled by CM33 ROM code.
• NXP container (optional): EdgeLock Enclave FW only (must-have in case NXP container present)
• OEM container (mandatory), contains:
— CM33 FW (must-have)
— FCB Region Copy Image (optional)
Requirements:
Ubuntu 20.04 or later host PC
i.MX93 EVK
UUU Tool
ARM GNU Toolchain (arm-gnu-toolchain-12.3.rel1-x86_64-aarch64-none-linux-gnu)
SDK package (SDK_2_16_000_MCIMX93-EVK)
Build procedure:
Clone imx-mkimage, it is better to use the same SW version for each source we are working with, please refer to i.MX Linux Release Notes document, table 3. BSP and multimedia standard packages for this information.
$ git clone https://github.com/nxp-imx/imx-mkimage -b lf-6.6.52-2.2.0
Decompress the GNU toolchain into a path in local disk, in this guide would be /opt
$ sudo tar -xvJf arm-gnu-toolchain-12.3.rel1-x86_64-aarch64-none-linux-gnu.tar.xz -C /opt
Clone and build Uboot
$ git clone https://github.com/nxp-imx/uboot-imx -b lf-6.6.52-2.2.0
$ cd uboot-imx
$ make -j $(nproc --all) clean
$ make -j$(nproc --all) ARCH=arm CROSS_COMPILE=/opt/arm-gnu-toolchain-12.3.rel1-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu- imx93_11x11_evk_defconfig
$ make -j $(nproc --all) ARCH=arm CROSS_COMPILE=/opt/arm-gnu-toolchain-12.3.rel1-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu-
Download and extract i.MX firmware
$ cd ..
$ wget https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-ele-imx-1.3.0-17945fc.bin
$ chmod +x firmware-ele-imx-1.3.0-17945fc.bin
$ ./firmware-ele-imx-1.3.0-17945fc.bin --auto-accept
Optional if using AHAB FW
$ wget https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-8.26-d4c33ab.bin
$ chmod +x firmware-imx-8.26-d4c33ab.bin
$ ./firmware-imx-8.26-d4c33ab.bin --auto-accept
Clone and build ATF
$ git clone https://github.com/nxp-imx/imx-atf -b lf-6.6.52-2.2.0
$ cd imx-atf
$ make -j $(nproc --all) PLAT=imx93 bl31 CROSS_COMPILE=/opt/arm-gnu-toolchain-12.3.rel1-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu-
Build M33 code, in this example we are using hello world from the i.MX SDK package.
$ cd ..
$ tar -xvzf SDK_2_16_000_MCIMX93-EVK.tar.gz
$ cd SDK_2_16_000_MCIMX93-EVK/boards/mcimx93evk/demo_apps/hello_world/armgcc
$ export ARMGCC_DIR=~/gcc-arm-none-eabi-10.3-2021.10
$ export PATH=$PATH:~/gcc-arm-none-eabi-10.3-2021.10
$ ./build_release.sh
Copy the resulting binaries to imx-mkimage
$ cp ~/imx-atf/build/imx93/release/bl31.bin ~/imx-mkimage/iMX93
$ cp ~/uboot-imx/u-boot.bin ~/imx-mkimage/iMX93
$ cp ~/uboot-imx/spl/u-boot-spl.bin ~/imx-mkimage/iMX93
$ cp release/sdk20-app.bin ~/imx-mkimage/iMX93/m33_image.bin
Copy i.MX firmware to imx-mkimage
$ cd ..
$ cp firmware-imx-8.26-d4c33ab/firmware/ddr/synopsys/lpddr4_imem_1d_v202201.bin ~/imx-mkimage/iMX93
$ cp firmware-imx-8.26-d4c33ab/firmware/ddr/synopsys/lpddr4_dmem_1d_v202201.bin ~/imx-mkimage/iMX93
$ cp firmware-imx-8.26-d4c33ab/firmware/ddr/synopsys/lpddr4_dmem_2d_v202201.bin ~/imx-mkimage/iMX93
$ cp firmware-imx-8.26-d4c33ab/firmware/ddr/synopsys/lpddr4_imem_2d_v202201.bin ~/imx-mkimage/iMX93
$ cp firmware-ele-imx-1.3.0-17945fc/mx93a1-ahab-container.img ~/imx-mkimage/iMX93
Build the flash.bin using mkimage, we have different target memory options for lpboot
$ cd imx-mkimage
eMMC/SD
eMMC/SD no AHAB
$ make SOC=iMX9 REV=A1 flash_lpboot_no_ahabfw
Flexspi
$ make SOC=iMX9 REV=A1 flash_lpboot_flexspi
Flexspi no AHAB
$ make SOC=iMX9 REV=A1 flash_lpboot_flexspi_no_ahabfw
Flexspi XiP
$ make SOC=iMX9 REV=A1 flash_lpboot_flexspi_xip
Change the binary name so we can identify and it is easier when flashing
$ mv flash.bin flash_m33_lpboot.bin
Also, build singleboot flashbin so we can use it to run UUU and flash the lpboot binary
$ make SOC=iMX9 REV=A1 flash_singleboot
$ mv flash.bin flash_UUU.bin
Set SW1301 for serial download on the EVK (0011), connect debug, download and power cables and turn on the EVK.
Flash the resulting binary into the EVK for the respective target (SD/eMMC/FSPI)
$ uuu -b sd flash_UUU.bin flash_m33_lpboot.bin
$ uuu -b emmc flash_UUU.bin flash_m33_lpboot.bin
$ uuu -b qspi flash_UUU.bin lash_m33_lpboot.bin
Once it is done change SW1301 to the respective bootmedia
SD Low power boot (1010)
eMMC Low power boot (1000)
FlexSPI NOR Low power boot* (1101)
*Note M.2 QSPI card is required for FlexSPI Boot option, since QSPI memory is not populated into the EVK
Power on the board, and the example should be running on the Cortex-M33 terminal only.
Hope everyone finds this useful!
For any question regarding this document, please create a community thread and tag me if needed.
Saludos/Regards,
Aldo.