I am using a 'stock' AM437x-GP-EVM to start on development while we design our new board. Our board will not have an SD card and will boot from NAND flash, so I am trying to get the GP-EVM to boot entirely from NAND. I have reverted to a 100% stock installation of ti-sdk-am437x-evm-08.00.00.00, but I am still unable to get the board to boot from NAND.
What does work for me:
- SD boot works fine with both all the pre-built binaries and my own MLO, u-boot.img and kernel
- SD boot for MLO and u-boot works, and from there I can load the kernel (programmed by me into NAND flash in uboot) and mount the NAND flash file system (also programmed into flash by me using ubi tools). After getting to the u-boot prompt, this command boots through to linux: setenv nandroot ubi0:rootfs rw ubi.mtd=9; run nandboot
What does not work for me
- I cannot get the ROM bootloader to load MLO and u-boot.
Observed symptoms:
I am using boot mode 0 on the EVM (NAND, USB-MS, MMC0, USB_CL). When I remove the SD card (with nothing in USB either) then apply power, nothing comes out the console log. If I put the SD card in, the ROM bootloader gets MLO and u-boot from the SD card and then boots linux from NAND due to my uboot configuration.
For grins I tried using boot mode 11001b (UART, NAND_I2C, NAND, MMC0). When I remove the SD card, I get the expected "CCCC..." out the UART indefinitely. So it's alive but not finding my MLO and/or u-boot in NAND.
Here are the steps I took to program MLO and u-boot. I have tried this numerous times and with both the pre-built and me-built versions of MLO/u-boot.
U-Boot# version
U-Boot 2014.07 (Feb 26 2015 - 15:33:10)
arm-linux-gnueabihf-gcc (crosstool-NG linaro-1.13.1-4.7-2013.03-20130313 - Linaro GCC 2013.03) 4.7.3 20130226 (prerelease)
GNU ld (crosstool-NG linaro-1.13.1-4.7-2013.03-20130313 - Linaro GCC 2013.03) 2.23.1
U-Boot# mtdparts
device nand0 <nand.0>, # parts = 10
#: name size offset mask_flags
0: NAND.SPL 0x00040000 0x00000000 0
1: NAND.SPL.backup1 0x00040000 0x00040000 0
2: NAND.SPL.backup2 0x00040000 0x00080000 0
3: NAND.SPL.backup3 0x00040000 0x000c0000 0
4: NAND.u-boot-spl-os 0x00080000 0x00100000 0
5: NAND.u-boot 0x00100000 0x00180000 0
6: NAND.u-boot-env 0x00040000 0x00280000 0
7: NAND.u-boot-env.backup10x00040000 0x002c0000 0
8: NAND.kernel 0x00700000 0x00300000 0
9: NAND.file-system 0x1f600000 0x00a00000 0
active partition: nand0,0 - (NAND.SPL) 0x00040000 @ 0x00000000
defaults:
mtdids : nand0=nand.0
mtdparts: mtdparts=nand.0:256k(NAND.SPL),256k(NAND.SPL.backup1),256k(NAND.SPL.backup2),256k(NAND.SPL.backup3),512k(NAND.u-boot-spl-os),1m(NAND.u-boot),256k(NAND.u-boot-env),256k(NAND.u-boot-env.backup1),7m(NAND.kernel),-(NAND.file-system)
U-Boot# nand erase.part NAND.SPL
NAND erase.part: device 0 offset 0x0, size 0x40000
Erasing at 0x0 -- 100% complete.
OK
U-Boot# nand erase.part NAND.SPL.backup1
NAND erase.part: device 0 offset 0x40000, size 0x40000
Erasing at 0x40000 -- 100% complete.
OK
U-Boot# nand erase.part NAND.SPL.backup2
NAND erase.part: device 0 offset 0x80000, size 0x40000
Erasing at 0x80000 -- 100% complete.
OK
U-Boot# nand erase.part NAND.SPL.backup3
NAND erase.part: device 0 offset 0xc0000, size 0x40000
Erasing at 0xc0000 -- 100% complete.
OK
U-Boot# nand erase.part NAND.u-boot
NAND erase.part: device 0 offset 0x180000, size 0x100000
Erasing at 0x240000 -- 100% complete.
OK
U-Boot# printenv loadaddr
loadaddr=0x82000000
U-Boot# mw.b $loadaddr 0xff 0x40000
U-Boot# fatload mmc 0 $loadaddr MLO
reading MLO
93192 bytes read in 7 ms (12.7 MiB/s)
U-Boot# nand write $loadaddr NAND.SPL
NAND write: device 0 offset 0x0, size 0x40000
262144 bytes written: OK
U-Boot# nand write $loadaddr NAND.SPL.backup1
NAND write: device 0 offset 0x40000, size 0x40000
262144 bytes written: OK
U-Boot# nand write $loadaddr NAND.SPL.backup2
NAND write: device 0 offset 0x80000, size 0x40000
262144 bytes written: OK
U-Boot# nand write $loadaddr NAND.SPL.backup3
NAND write: device 0 offset 0xc0000, size 0x40000
262144 bytes written: OK
U-Boot# mw.b $loadaddr 0xff 0x00100000
U-Boot# fatload mmc 0 $loadaddr u-boot.img
reading u-boot.img
417180 bytes read in 23 ms (17.3 MiB/s)
U-Boot# nand write $loadaddr NAND.u-boot
NAND write: device 0 offset 0x180000, size 0x100000
1048576 bytes written: OK
There is information in both the MLO and u-boot sector. I verified this once I booted to linux:
root@am437x-evm:~# mtd_debug read /dev/mtd0 0 0x400 /tmp/mlo.txt && hexdump /tmp/mlo.txt
0000000 0040 0000 000c 0000 0000 0000 0000 0000
0000010 0000 0000 4843 4553 5454 4e49 5347 0000
0000020 ffff ffff ffff ffff ffff ffff ffff ffff
*
0000040 c0c1 c0c0 0100 0000 0000 0000 0000 0000
0000050 0000 0000 0000 0000 0000 0000 0000 0000
*
0000200 6a00 0001 4000 402f 0075 eb00 0000 e10f
0000210 101f e200 001a e331 001f 13c0 0013 1380
0000220 00c0 e380 f000 e129 0f10 ee11 0a02 e3c0
root@am437x-evm:~# mtd_debug read /dev/mtd5 0 0x400 /tmp/u-boot.txt && hexdump /tmp/u-boot.txt
0000000 0527 5619 2e56 15da ef54 5aad 0600 5c5d
0000010 8080 0000 0000 0000 62d1 d003 0211 0005
0000020 2d55 6f42 746f 3220 3130 2e34 3730 6620
0000030 726f 6120 346d 7833 2078 6f62 7261 0064
0000040 f018 e59f f018 e59f f018 e59f f018 e59f
*
0000060 0300 8080 0060 8080 00c0 8080 0120 8080
0000070 0180 8080 01e0 8080 0240 8080 02a0 8080
0000080 c0de 0bad f000 e320 f000 e320 f000 e320
0000090 f000 e320 f000 e320 f000 e320 f000 e320
00000a0 d028 e51f e000 e58d e000 e14f e004 e58d
00000b0 d013 e3a0 f00d e169 e00f e1a0 f00e e1b0
00000c0 d048 e24d 1fff e88d 2050 e51f 000c e892
I must be missing something simple here since this seems pretty basic. Am I supposed to program something different into NAND than the files which succesfully load from SD maybe, and if so which ones? Any help is appreciated.