IMX8Mnano EVK/How to make QSPI booting image

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

IMX8Mnano EVK/How to make QSPI booting image

2,681 次查看
shinji_tonoshit
Contributor I

Hi all,

I want to make QSPI NOR Flash booting image for i.MX8M nano EVK(8MNANOLPD4-EVK).
I built the environment referring to IMXLXYOCTOUG (Rev. LF6.1.22_2.0.0.0 - 30 June 2023) and IMXBSPPG (Rev. LF6.1.22_2.0.0.0 - 30 June 2023).
I used the following commands to confirm that binary files are created.
1)export CROSS_COMPILE=aarch64-linux-gnu-
2)make imx8mn_ddr4_evk_defconfig
3)make
4)u-boot.bin and u-boot-spl.bin are ready.
Please let me know. I don't know how to create an image to write to flash memory.

Best Regards,
Shinji

0 项奖励
回复
10 回复数

2,402 次查看
bernhardfink
NXP Employee
NXP Employee

Hi Shinji,

I tested it again on a fresh Linux machine and it worked for me. I executed the following script on my Ubuntu 20.04 machine and the boot image was successfully created:

 

# Build script for 8M Nano boot image
# Version: 6.1.22-mickledore
# Requires ARMv8 toolchain. Please adapt path below.

mkdir firmware-imx

git clone https://github.com/nxp-imx/uboot-imx
git clone https://github.com/nxp-imx/imx-atf
git clone https://github.com/nxp-imx/imx-mkimage

cd firmware-imx
wget https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-8.20.bin
chmod a+x firmware-imx-8.20.bin
./firmware-imx-8.20.bin
cd ..

cd uboot-imx
git checkout -b lf_v2023.04 origin/lf_v2023.04

# Adapt path to your toolchain here. The toolchain was created with Yocto and provides 
# the following setup script ($ bitbake imx-image-multimedia -c populate_sdk)
# If you created it differently, please make sure you run the correct initializations.
. /opt/toolchains/imx-wayland/6.1-mickledore/environment-setup-armv8a-poky-linux


make imx8mn_evk_defconfig
make
cd ..

cd imx-atf
git checkout -b lf_v2.8 origin/lf_v2.8
unset LDFLAGS
make PLAT=imx8mn bl31
cd ..

cd imx-mkimage
cp ../uboot-imx/spl/u-boot-spl.bin iMX8M
cp ../uboot-imx/u-boot-nodtb.bin iMX8M
cp ../uboot-imx/arch/arm/dts/imx8mn-evk.dtb iMX8M
cp ../imx-atf/build/imx8mn/release/bl31.bin iMX8M
cp ../firmware-imx/firmware-imx-8.20/firmware/ddr/synopsys/lpddr4_pmu_train_* iMX8M
cp ../uboot-imx/tools/mkimage iMX8M/mkimage_uboot

# With "DEV=flexspi" a boot image for Serial Flash is built
# Default (no parameter) would build for eMMC/SD-card
make SOC=iMX8MN DEV=flexspi flash_evk
cd ..

 

 

A log file for the build is attached as well.

Regards,
Bernhard.

0 项奖励
回复

2,372 次查看
shinji_tonoshit
Contributor I

Hi Bernhard,

Thank you for your assistance with the detailed build procedure.
I followed the build procedure and the flash.bin file was created.
However, when I check the flash.bin file, there is no FlexSPI Configuration Block or IVT HEADER.
Please let me know how to add FlexSPI Configuration Block and IVT HEADER.

Best regards,
Shinji

 

0 项奖励
回复

2,629 次查看
bernhardfink
NXP Employee
NXP Employee

i.MX RT is a different architecture compared to i.MX 8M (Mini/Nano/Plus), so the procedure from the mentioned app note AN12108 will not work.

A few notes:

  • We have support in the Yocto build configuration to create a boot image for the QSPI flash. See more details in the IMX_YOCTO_PROJECT_USERS_GUIDE.pdf  in chapter 5.5.
    The boot image is intended to go into the QSPI flash and the rootfs goes into the bigger eMMc or SD card.

  • You can use uuu.exe to program the boot image into the QSPI flash. If you have uuu in the final image folder of the Yocto build, then you can do it this way:
    uuu.exe -b qspi qspi_bootloader_image​

     

  • If you put the files together in a "discrete way" the command could like this:
    uuu.exe  imx-boot-imx8mnevk-fspi.bin-flash_evk_flexspi  qspi_bootloader_image​​
      
             \ u-boot image used as programming manager /   \ image to program /

    In fact if you use the build in script (-b qspi), then it's doing the same thing.

  • There are other ways to program the QSPI, you could boot from eMMC/SD card and stop in u-boot and program the QSPI from there.

  • Some bits an pieces can also be found in this thread: https://community.nxp.com/t5/i-MX-Processors/How-to-change-yocto-configuration-to-u-boot-from-QSPI-f...

 

Regards,
Bernhard

0 项奖励
回复

2,610 次查看
shinji_tonoshit
Contributor I

Dear Bernhard,

Thanks for the reply and information.
I want to rewrite the SPI flash with an in-circuit emulator.
To do this, I want to create a single image file.
I have written the pre-built "imx-boot-imx8mn-ddr4-evk-fspi.bin-flash_ddr4_evk_flexspi.bin" and it works.
I think that IVT is required at the first address of SPI flash when i.MX8M nano is activated with SPI flash.
However, there is no IVT in u-boot.bin and u-boot-spl.bin that I built.
Please tell me how to make a binary equivalent to "imx-boot-imx8mn-ddr4-evk-fspi.bin-flash_ddr4_evk_flexspi.bin" using the u-boot.bin and u-boot-spl.bin that I built.

 

Regards,
Shinji

0 项奖励
回复

2,593 次查看
bernhardfink
NXP Employee
NXP Employee

Hello Shinji,

you are missing a few steps in the boot image build process. See an example (one way to do this) for 8M Nano and BSP 6.1.22 below:

 

Get u-boot repo from Github:
============================
git clone https://github.com/nxp-imx/uboot-imx


Change to repository folder and check for latest version:

cd uboot-imx
git branch -a
git checkout -b lf_v2023.04 origin/lf_v2023.04


Set the cross compiler environment variables for the 8M Nano:

source ~/opt/fsl-imx-wayland/6.1-mickledore/environment-setup-aarch64-poky-linux
export ARCH=arm


Configure the project with the board you want to build:
make imx8mn_evk_defconfig


Build u-boot:
make



Download and build the ARM Trusted Firmware, change to the base directory first:
================================================================================
cd ..
git clone https://github.com/nxp-imx/imx-atf
cd imx-atf
git checkout -b lf_v2.8 origin/lf_v2.8
make PLAT=imx8mn bl31

In case of an error "aarch64-poky-linux-ld.bfd:unrecognized option 'WI,-O1':
unset LDFLAGS
make PLAT=imx8mn bl31


Download LPDDR4 training firmware binaries: Check the version in the Linux BSP Release document.
================================================================================================
cd ..
mkdir firmware-imx
cd firmware-imx
wget https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-8.20.bin
chmod a+x firmware-imx-8.20.bin
./firmware-imx-8.20.bin


Download imx-mkimage utility: Please note, "imx-mkimage" is not the same as "mkimage"
=====================================================================================
cd ..
git clone https://github.com/nxp-imx/imx-mkimage
cd imx-mkimage
git checkout -b imx_5.4.3_2.0.0 origin/imx_5.4.3_2.0.0


Stay in the folder "imx-mkimage" and copy all required files and build the boot image:
======================================================================================
cp ../uboot-imx/spl/u-boot-spl.bin iMX8M
cp ../uboot-imx/u-boot-nodtb.bin iMX8M
cp ../uboot-imx/arch/arm/dts/imx8mn-evk.dtb iMX8M
cp ../imx-atf/build/imx8mn/release/bl31.bin iMX8M
cp ../firmware-imx/firmware-imx-8.5/firmware/ddr/synopsys/lpddr4_pmu_train_* iMX8M
cp ../uboot-imx/tools/mkimage iMX8M/mkimage_uboot

make SOC=iMX8MN DEV=flexspi flash_evk   (take care of large and lower case!)

The resulting output binary "flash.bin" for the 8M Nano can then be found in the folder "iMX8M".

 

 

Regards,
Bernhard.

0 项奖励
回复

2,575 次查看
shinji_tonoshit
Contributor I

Dear Bernhard,

Thanks for the reply and the process.
I get an error when I do the last make.
Please let me know how to deal with it.
+++++
$ make SOC=iMX8MN DEV=flexspi flash_evk
make[1]: *** No rule to make target 'fsl-imx8mn-evk.dtb', needed by 'u-boot.itb'. Stop.
make: *** [Makefile:23: flash_evk] Error 2
+++++

Best Regards,
Shinji

0 项奖励
回复

2,569 次查看
bernhardfink
NXP Employee
NXP Employee

Hello Shinji,

I detected two typos in the procedure, maybe this causes the problem. I corrected them in script above.

Please check:

Get u-boot repo from Github:
============================
git clone https://github.com/nxp-imx/uboot-imx

Change to repository folder and check for latest version:

cd uboot-imx
git branch -a
git checkout -b lf_v2023.04 origin/imx_v2023.04  --> This should be lf

 

Download and build the ARM Trusted Firmware, change to the base directory first:
================================================================================
cd ..
git clone https://github.com/nxp-imx/imx-atf
cd imx-atf
git checkout -b lf_v2.8 origin/lf_v2.8-    --> The dash here is wrong
make PLAT=imx8mn bl31

 

Regards,
Bernhard.

0 项奖励
回复

2,537 次查看
shinji_tonoshit
Contributor I

Dear Bernhard,

Thank you for your many replies.

I get the following error when I run make
$ make SOC=iMX8MN DEV=flexspi flash_evk
make: *** No rule to make target 'flash_evk'. Stop.

Best regards,

Shinji

0 项奖励
回复

2,519 次查看
shinji_tonoshit
Contributor I

Dear Bernhard,

Thank you for your reply.
I once again built and re-built the build environment.
This resulted in an error.
+++++
$make SOC=iMX8MN DEV=flexspi flash_evk
Compiling mkimage_imx8
PLAT=imx8mn HDMI=no
Compiling mkimage_imx8
cc -O2 -Wall -std=c99 -static mkimage_imx8.c -o mkimage_imx8 -lz
31736+1 records in
31737+0 records out
126948 bytes (127 kB, 124 KiB) copied, 0.0287526 s, 4.4 MB/s
make[1]: *** No rule to make target 'fsl-imx8mn-evk.dtb', needed by 'u-boot.itb'. Stop.
make: *** [Makefile:23: flash_evk] Error 2
+++++

Best regards,
Shinji

0 项奖励
回复

2,659 次查看
ramprakash08
Contributor IV

To create a bootable image for QSPI NOR Flash on the i.MX8M nano EVK, you can follow the steps outlined in the NXP application note 'How to Enable Boot from QSPI Flash' (AN12108). This document provides a detailed guide on how to program a bootable image into an external storage device.

Here are the general steps you would need to follow:

 

  1. Build your binary files as you have done.
  2. Use the Flashloader tool mentioned in the application note to load your binary files onto the QSPI NOR Flash.
  3. Configure the boot switches on your i.MX8M nano EVK to boot from the QSPI NOR Flash.

Also, you might find the application note 'Deploying Linux Kernel and Root File System Images on QorIQ LS1046ARDB' (AN5340) helpful. It provides information on how to deploy U-Boot, Linux kernel, and the root file system to a board using NXP SDK images.

0 项奖励
回复