How to boot i.MX6 Yocto BSP from NAND Flash ?

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

How to boot i.MX6 Yocto BSP from NAND Flash ?

Jump to solution
4,711 Views
ottob
Contributor IV

Hi There,


We have a custom board that is similar to the imx6q sabresd (+NAND flash) that we are working on porting the new Yocto BSP to. What works so far


1. Booting LTIB BSP from SD card and NAND Flash

2. Booting Yocto BSP from SD card (by modifying mx6qsabresd.h & mx6qsabre_common.h)

3. Reading & Writing NAND Flash in Yocto u-boot (2013.04)


However, when attempting to boot the Yocto U-boot from NAND flash there is no bootloader console output. The same binary (but w/o the header - u-boot.imx) written to the SD card (with the 0x400 offset) works OK. I know one needs to modify uboot to have the environment read from the nand-flash, however its my impression that at the very minimum there should be some console output using the same uboot binary. Which is where I might be mistaken. Are there any other modifications needed ? I use the following command to program uboot to Flash.


kobs-ng init -v --chip_0_device_path=/dev/mtd0 u-boot.bin


Programming my LTIB-based uboot using this works OK, so that narrows down the problem to the actual content of the new Yocto u-boot.bin. Hexdumping the mtd0 partition reveals some differences in the first few hundred bytes, but I'm not sure if its significant


@ubuntu:/project/yocto/build1$ hexdump -C ltib_uboot -n 1000

00000000  00 00 67 fb ff ff 46 43  42 20 00 00 00 01 50 3c  |..g...FCB ....P<|

00000010  19 06 00 00 00 00 00 08  00 00 40 08 00 00 40 00  |..........@...@.|

00000020  00 00 00 00 00 00 00 00  00 00 00 00 00 00 04 00  |................|

00000030  00 00 00 02 00 00 00 02  00 00 04 00 00 00 0a 00  |................|

00000040  00 00 03 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|

00000050  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|

00000060  00 00 00 00 00 00 00 00  00 00 00 02 00 00 00 05  |................|

00000070  00 00 b9 00 00 00 b9 00  00 00 00 01 00 00 cf 07  |................|

00000080  00 00 00 00 00 00 00 08  00 00 00 00 00 00 00 00  |................|

00000090  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|

*

00000200  1c 0f 17 1f 05 00 00 00  00 00 19 00 00 15 19 00  |................|

00000210  00 15 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|

00000220  00 13 00 00 00 00 16 00  00 00 16 00 00 13 00 00  |................|

00000230  00 0f 00 00 00 0a 00 00  00 00 00 00 00 00 00 00  |................|

00000240  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|

00000250  00 00 00 00 00 00 00 00  00 00 00 00 00 00 16 00  |................|

00000260  00 00 0f 00 00 16 00 00  00 16 00 00 00 00 1c 00  |................|

00000270  00 1b 19 00 00 00 00 00  00 00 19 00 00 00 00 00  |................|

00000280  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|

@ubuntu:/project/yocto/build1$ hexdump -C uboot_yocto -n 1000

00000000  00 00 d3 fc ff ff 46 43  42 20 00 00 00 01 50 3c  |......FCB ....P<|

00000010  19 06 00 00 00 00 00 08  00 00 40 08 00 00 40 00  |..........@...@.|

00000020  00 00 00 00 00 00 00 00  00 00 00 00 00 00 04 00  |................|

00000030  00 00 00 02 00 00 00 02  00 00 04 00 00 00 0a 00  |................|

00000040  00 00 03 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|

00000050  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|

00000060  00 00 00 00 00 00 00 00  00 00 00 02 00 00 00 05  |................|

00000070  00 00 02 01 00 00 02 01  00 00 00 01 00 00 cf 07  |................|

00000080  00 00 00 00 00 00 00 08  00 00 00 00 00 00 00 00  |................|

00000090  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|

*

00000200  1c 0f 17 1f 05 00 00 00  00 00 19 00 00 15 19 00  |................|

00000210  00 15 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|

00000220  00 13 00 00 00 00 16 00  00 00 16 00 00 13 00 00  |................|

00000230  00 0f 00 00 00 0a 00 00  00 00 00 00 00 00 00 00  |................|

00000240  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|

00000250  00 00 00 00 00 00 00 00  00 00 00 00 00 00 16 00  |................|

00000260  00 00 0f 00 00 16 1c 00  00 16 1c 00 00 00 1c 00  |................|

00000270  00 1b 19 00 00 00 00 00  00 00 19 00 00 00 00 00  |................|

00000280  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|

*

000003e8

Also, performing a "nand dump 0" in the LTIB u-boot shows the same data as in the new Yocto u-boot. That proves that the Yocto u-boot can read the Flash OK.

Any hints on what the problem could be would be appreciated

Thanks,

/Otto


andrewk

Labels (3)
Tags (4)
0 Kudos
1 Solution
1,533 Views
ottob
Contributor IV

Hi Yuri,

As I mentioned our BSP is based on the mx6qSabreSD, which has no NAND configuration in uboot so we added that in. The information I was hoping to get was - Be sure to enable the necessary clocks in the DDR / Clock setup script - mx6q_4x_mt41j128.cfg

--- board/freescale/imx/ddr/mx6q_4x_mt41j128.cfg    (revision 31363)

+++ board/freescale/imx/ddr/mx6q_4x_mt41j128.cfg    (working copy)

@@ -153,9 +154,9 @@

DATA 4, 0x020c406c, 0x0030FC03

DATA 4, 0x020c4070, 0x0FFFC000

DATA 4, 0x020c4074, 0x3FF00000

-DATA 4, 0x020c4078, 0x00FFF300

+DATA 4, 0x020c4078, 0xFFFFF300

DATA 4, 0x020c407c, 0x0F0000F3

-DATA 4, 0x020c4080, 0x000003FF

+DATA 4, 0x020c4080, 0x00000FFF

It works well now. Hopefully this can help someone else

Thanks,

/Otto

View solution in original post

0 Kudos
4 Replies
1,533 Views
Yuri
NXP Employee
NXP Employee

Hope the following threads help.

To make NAND image by Yocto.

Freescale Yocto i.MX6 U-Boot NAND Boot


Have a great day,
Yuri

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
1,533 Views
ottob
Contributor IV

Hi Yuri,

Unfortunately no progress.

We are using the SabreSD as base so there is no NAND booting option in the Yocto Recipes. From what I can see defining 'use UBOOT_CONFIG = "nand"' enables the 'CONFIG_SYS_BOOT_NAND' in uboot, which I have enabled in my modified sabresd config file.

Is there any documentation on how to troubleshoot this ? I particular I'm curious how the iMX device knows how to communicate with the NAND flash before any code is loaded. I did probe the CE pin of the NAND device and there are two 10ms wide bursts with pause of 30ms in between them upon power-up. But after that its quiet

Can a JTAG debugger be used to troubleshoot the pre-code executing NAND initialization ?

Btw, we are using a Micron MT29F4G08 NAND flash device

Thanks,

/Otto

0 Kudos
1,533 Views
Yuri
NXP Employee
NXP Employee

Can You build the U-boot for NAND (UBOOT_CONFIG = "nand") ?

And deploy it to the NAND  ?

dd if=u-boot.imx of=u-boot-nand.imx bs=512 seek=2

kobs-ng init -v /boot/u-boot-nand.imx

~Yuri.

0 Kudos
1,534 Views
ottob
Contributor IV

Hi Yuri,

As I mentioned our BSP is based on the mx6qSabreSD, which has no NAND configuration in uboot so we added that in. The information I was hoping to get was - Be sure to enable the necessary clocks in the DDR / Clock setup script - mx6q_4x_mt41j128.cfg

--- board/freescale/imx/ddr/mx6q_4x_mt41j128.cfg    (revision 31363)

+++ board/freescale/imx/ddr/mx6q_4x_mt41j128.cfg    (working copy)

@@ -153,9 +154,9 @@

DATA 4, 0x020c406c, 0x0030FC03

DATA 4, 0x020c4070, 0x0FFFC000

DATA 4, 0x020c4074, 0x3FF00000

-DATA 4, 0x020c4078, 0x00FFF300

+DATA 4, 0x020c4078, 0xFFFFF300

DATA 4, 0x020c407c, 0x0F0000F3

-DATA 4, 0x020c4080, 0x000003FF

+DATA 4, 0x020c4080, 0x00000FFF

It works well now. Hopefully this can help someone else

Thanks,

/Otto

0 Kudos