SPI NAND boot on i.MX8ULP
SPI NAND boot on i.MX8ULP
This article is about the SPI NAND boot on the i.MX8ULP, some customers using the i.MX8ULP want to use the SPI NAND on it. We just have verified the NOR NAND on the i.MX8ULP EVK board, for the SPI NAND use customers do not clear and do not know how to realized, here will give details steps and modifications for customers to refer to.
1\The boot mode support on the i.MX8ULP
For the i.MX8ULP support many kinds of external memory devices SD, eMMC, SPI NOR and Flash SPI NAND Flash.
Compared to traditional parallel NAND (which requires GPMI/NFC controllers), SPI NAND can be accessed through a serial FlexSPI interface. For the i.MX8ULP for the SPI NAND use need to connect to the FlexSPI2 interface.
2\ Hardware SPI NAND boot configuration
On the i.MX8ULP the SPI NAND is mounted on the FlexSPI2 interface, the configuration need to follow the section in the RM.
Boot configuration needs to follow the Table 84. Boot configuration.
In our reference design use the NOR SPI flash, for the SPI NAND connection can refer to it.
3\Software realized for the SPI NAND boot on the i.MX8ULP
Make sure the hardware connections are proper. Next step is to boot up.
On our 8ULP EVK board I have confirmed that do not have the SPI NAND on it.
The default u-boot and the imx-mkimage flash_singleboot_m33_flexspi is for the SPI NOR, not for the SPI NAND, for the SPI NAND is using the different mechanism with SPI NOR, so if customer use ROM code read it fail, in our default released BSP do not include the build images for the 8ULP SPI NAND
https://github.com/nxp-imx/imx-mkimage/blob/lf-6.18.20_2.0.0/iMX8ULP/soc.mak.
So it need the special build images, and realized by customer themselves.
For the i.MX8ULP ROM code already confirm that support the SPI NAND boot, so in customer’s side they need to porting in their side to support it.
The SPI NAND boot mechanism for the i.MX8ULP is the same as that of the i.MX91, so we can refer to the i.MX91 design. For support the SPI NAND boot, the actual project needs to supplement U-Boot, imx mkimage, FCDBBT, download, and Linux support for related NAND part numbers. The core of SPI NAND boot is not a single binary image, but a set of data structures for ROM to identify media, bad blocks, and boot image locations. The key structures as FCB, DBBT, and Image Container.
3.1 U-boot modify
Add the NAND related information and parameters in the driver:
Take the Winbond NAND as an example,
https://github.com/nxp-imx/uboot-imx/blob/lf-6.18.20-2.0.0/drivers/mtd/nand/spi/winbond.c
Add customized header support for SPI NAND boot in the cmd_fspinand.c
(Added customized FlexSPI NAND header support: allowing different configurations to be generated for different NAND models.)
https://github.com/nxp-imx/uboot-imx/blob/lf_v2026.04/arch/arm/mach-imx/cmd_fspinand.c
3.2 Add the SPI NAND support in the imx-mkimage
imx-mkimage is a boot image generation tool provided by NXP, used to package multiple boot components such as U-Boot, ATF, OP-TEE, DDR firmware, ELE,SECO firmware into the final boot image (flash.bin).
imx-mkimage generates the Container Images that meet Boot ROM requirements.
The default code:
https://github.com/nxp-imx/imx-mkimage/tree/lf-6.18.20_2.0.0/iMX8ULP
Need to add the related information for the SPI NAND support refer to the i.MX91:https://github.com/nxp-imx/imx-mkimage/tree/lf-6.18.20_2.0.0/iMX91
Generate the flash_fw.bin and flash.bin .
flash_fw.bin is a temporary boot image used by the UUU tool during SPI NAND programming.
flash.bin is the Boot image programmed into the SPI NAND flash.
The write the boot images to UUU command is:
uuu -b spinand flash_fw.bin flash.bin
3.3 Kernel modify
For the kernel need to add the driver and spi-nand node in the board device tree.
Add the NAND related information and parameters in the driver like u-boot.
Configure FLEXSPI2 and add the SPI NAND Flash node in the board Device Tree (DTS):
Build the source code, test on the customer’s board.
4\ Trouble shooting
a.Need to check the hardware design is proper, check the connection and pins mux.
b.Confirm the i.MX8ULP if validation the 4KB SPI NAND Page size.
For the page_data_size and page_total_size
2K
config->pageDataSize = 2048;
config->pageTotalSize = 4096;
4K
config->pageDataSize = 4096;
config->pageTotalSize = 8192;
Confirm if configuration the FCB to 4KB page size or still 2K. At firstly in the 91 RM we can see that there is BOOT_CFG0[7] FlexSPI_NAND_4K_Page_Selection, no describe for the i.MX8ULP. We thought need special configuration for the i.MX8ULP. But for the i.MX8ULP do not use this BOOT_CFG0[7] FlexSPI_NAND_4K_Page_Selection. And in the default ROM Code support 2K and 4K, details can see in the ROM document .
c. The FCB, DBBT, flash.bin, and all contained boot images are 4 KB aligned to match the SPI NAND page size requirement. Make sure already confirm the FCB configure to 4KB page size. If not 4KB aligned will all met fail boot.
d. uboot/arch/arm/mach-imx/cmd_fspinand.c
The original code use the fspinand_prep_micron_mem_config() configure NAND's in-die ECC using a semi-hardcoded approach, then write to the SR2 register, this method will cover other key configuration bits in the Winbond W25N04L series SR2.
Firstly ask customer to commit out the function of the “fspinand_prep_micron_mem_config()” to see if can pass the fail.
(Commenting out the fspinand_prep_micron_mem_config() function in uboot: arch/arm/mach-imx/cmd_fspinand.c will be quick way(not a solution) to verify if this causes the boot failure.)
After annotation, the spi nand can start normally, but this is only a verification method and not the final solution.
Then customer try to modify the value configuration for the SR2 from 0x10 to 0x19:
- config->mem_config.configCmdArgs[1] = 0x10;
+ config->mem_config.configCmdArgs[1] = 0x19;
This works well in customer’s side. But fixed the SR2 value not suit for all customer’s situation using other vendors’ chip.
NXP do not use the hard code, because this may affect other NAND customers and instead increase the customized flexspi_nand_config header support.
Using the attached U-Boot and mkimage tool patches to generate the required custom header for the target SPI NAND device.
Note:
Please use our official patches (Already merged in NXP 2026 Q3 release) to address this issue. We have introduced support for customized flexspi_nand_config headers. Please use the attached U-Boot and mkimage tool patches to generate the required custom header for the target SPI NAND device.
Please note that the changes in our mkimage patch are based on the SPI NAND implementation for the NXP release of the i.MX91 platform. Please make the corresponding modifications according to the platform you are using.
If you are using the Linux 6.18.37_2.1.0 our newest released BSP, we already apply this patch. Just make porting SPI Nand boot according the i.MX91 section code to finish.
If you are using the before released version, the following two patches are needed.
0001-iMX91-soc.mak-add-flash_singleboot_spinand_customhdr.patch.txt
0001-LFU-1037-cmd_fspinand-add-customized-header-support-.patch.txt
View full article