Booting i.MX6Q via SPI-NOR Flash Memory

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Booting i.MX6Q via SPI-NOR Flash Memory

874 Views
jhngiam
Contributor I

Hi, I am trying to boot from my SPI-NOR memory device on my custom board with an i.MX6Q but it seems that there are a few things that I don't really understand.

1. Do I partition my spinor memory using mtdparts or the devicetree? And what is the difference?

2. When I load my files into my flash memory using sf write am I able to write into a particular partition? Or does it have to be static addresses?

 

 

3. Yocto by default generates a wic file for sd/emmc memory devices. Is there something similar for SPI-NOR memory? Do fitImages work?

4. Since the uuu forces the bootcmd=fastboot 0, how do I change it to load from my SPI-NOR flash? Do I need 2 separate versions of u-boot? One to run uuu and the other for the board to boot up through SPI-NOR.

 

I am currently generating a cpio rootfs using IMAGE_FSTYPES="cpio".

I am able to boot from u-boot through USB only in the RAM.

I managed to partition my SPI-NOR memory using the device tree and I can see mtdblock0-2 in my /dev folder

How should I move forward to boot from SPI-NOR instead of having to rely on the USB to boot all the time?

This is my UUU script:

uuu_version 1.2.39

# This command will be run when i.MX6/7 i.MX8MM, i.MX8MQ
SDP: boot -f u-boot.imx

# Initialize SPI Flash
FB: ucmd sf probe ${spi_bus}

# Bootloader
FB: ucmd setenv fastboot_buffer ${loadaddr}
FB: download -f u-boot.imx
FB[-t 1000000]: ucmd sf write ${fastboot_buffer} 0x400 0x${filesize}
FB: ucmd echo uboot done

# zImage
FB: ucmd setenv fastboot_buffer ${loadaddr}
FB: download -f zImage.bin
FB[-t 1000000]: ucmd sf write ${fastboot_buffer} 0x100000 0x${filesize}
FB: ucmd echo zImage done

# Device Tree
FB: ucmd setenv fastboot_buffer ${fdt_addr}
FB: download -f imx6q-spw.dtb
FB[-t 1000000]: ucmd sf write ${fastboot_buffer} 0xB00000 0x${fastboot_bytes}
FB: ucmd echo dtb done

# RootFS
FB: ucmd setenv fastboot_buffer 0x12C000000
FB: download -f rfs.rootfs.cpio
FB[-t 1000000]: ucmd sf write ${fastboot_buffer} 0xC00000 0x${fastboot_bytes}
FB: ucmd echo rootfs done

# Boot
FB[-t 1000000]: ucmd sf read ${loadaddr} 0x100000 0x68b2e8
FB[-t 1000000]: ucmd sf read ${fdt_addr} 0xB00000 0x84e7
FB[-t 1000000]: ucmd sf read ${ramdisk_addr} 0xC00000 0x1a14440

#FB: acmd bootz ${loadaddr} - ${fdt_addr}
FB: acmd bootz ${loadaddr} ${ramdisk_addr} ${fdt_addr}

 

Labels (3)
Tags (4)
0 Kudos
3 Replies

810 Views
Sanket_Parekh
NXP TechSupport
NXP TechSupport
Hi @jhngiam ,

I hope you are doing well.

1. Do I partition my spinor memory using mtdparts or the devicetree? And what is the difference?
[Ans]: One can create a default partition using a device tree.
          and use the mtdparts command line option to edit or change mtd partition dynamically.
          Please refer to 4.6.4 SPI-NOR flash memory map in i.MX Linux User's Guide

2. When I load my files into my flash memory using sf write am I able to write into a particular partition? Or does it have to be static addresses?
[Ans]: One has to use the specific address in SF write based on partitions created.
          Please refer to 4.4.1.5 Flashing U-Boot on Parallel NOR from U-Boot in i.MX Linux User's Guide

3. Yocto by default generates a wic file for sd/emmc memory devices. Is there something similar for SPI-NOR memory? Do fitImages work?
[Ans]: One can mention boot device using uboot config to specify boot device in yocto image.
          Please refer to 5.5 U-Boot configuration in i.MX Yocto Project User's Guide

4. Since the uuu forces the bootcmd=fastboot 0, how do I change it to load from my SPI-NOR flash? Do I need 2 separate versions of u-boot? One to run uuu and the other for the board to boot up through SPI-NOR.
[Ans]: uuu uses bootcmd=fastboot 0 to specify the default USB device to download further images.
          uuu will then flash u-boot.imx,zImage,dtb and rootfs to spi-nor.
          now, one must change DIP switches to boot from SPI-NOR on Power-ON.
          
          Please refer to 4.5.8 Booting from SPI-NOR in i.MX Linux User's Guide

Thanks & Regards,

Sanket Parekh

0 Kudos

754 Views
jhngiam
Contributor I

Hi Sanket,

Thanks for the speedy reply.

I've managed to sort of partition my spinor using the mtdparts command line and flashing into spinor memory using specific addresses. Seems like spinor flash memory does not truly partition like SD card or emmc memory. I managed to boot internally from the spinor flash by blowing the appropriate fuses.

Thanks for your help~

Best Regards,
Jing Hao, Ngiam

0 Kudos

721 Views
Sanket_Parekh
NXP TechSupport
NXP TechSupport

Hi @jhngiam ,

 
I hope you are doing well.
 

Glad to know that the board booted successfully using SPI - NOR.
 
As the issue seems to be resolved, can I mark this case as close?
 
Thanks & Regards,
Sanket Parekh
0 Kudos