AnsweredAssumed Answered

XIP (execute in place) with a NAND flash

Question asked by xii on Feb 28, 2012
Latest reply on Mar 13, 2012 by Aaronwu

Hi,

 

We are using a BF537 stamp with a 128Mb NAND flash connected according to this document + a SPI flash that supports U-Boot.

The system works fine: it boots on SPI flash which loads the NAND uImage into the RAM and then boot on it.

 

Now we would like to run the kernel directly from the NAND. We have followed the XIP document, but we are unsuccessful at executing the code directly from the NAND.

 

According to the docs, the NAND flash is located at the address 0x20212000, so we have configured the "Kernel ROM Base" (ROM_BASE) to an address a bit higher : 0x20292000. (note: I don't think it matters, but load address = BOOT_LOAD is still 0x1000)

 

Trying to boot the kernel results in this error:

"

bfin> bootm 0x20292000
Wrong Image Format for bootm command
ERROR: can't get kernel image!

"

What's wrong ? Is XIP with NAND possible ?

 

Below is the load process:

"

bfin> nand erase ; tftp 0x1000000 vmImage ; nand write.jffs2 0x1000000 0x80000 0x600000 ; tftp 0x1000000 rootfs.romfs ; nand write.jffs2 0x1000000 0x600000 0xA00000

 

NAND erase: device 0 whole chip
Skipping bad block at  0x00000000
Skipping bad block at  0x00020000
[...]

Skipping bad block at  0x00f80000
Erasing at 0xffc000 -- 100% complete.
OK
Using bfin_mac device
TFTP from server 192.168.1.102; our IP address is 192.168.1.240
Filename 'vmImage'.
Load address: 0x1000000
Loading: #################################################################
         #################################################################
         #########
done
Bytes transferred = 2032788 (1f0494 hex)

 

NAND write: device 0 offset 0x80000, size 0x600000
Skip bad block 0x00094000
Skip bad block 0x000a4000
Skip bad block 0x000c0000
Skip bad block 0x00188000
Skip bad block 0x002e0000
Skip bad block 0x00300000
Skip bad block 0x00408000
Skip bad block 0x004c0000
Skip bad block 0x004e8000
6291456 bytes written: OK
Using bfin_mac device
TFTP from server 192.168.1.102; our IP address is 192.168.1.240
Filename 'rootfs.romfs'.
Load address: 0x1000000
Loading: #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #####################
done

"

 

Side note: loading the XIP kernel in RAM hangs with like this:

"

bfin> nand read.jffs2 0x1000000 0x80000 0x500000

 

NAND read: device 0 offset 0x80000, size 0x500000
5242880 bytes read: OK

 

bfin> bootm 0x1000000
## Booting kernel from Legacy Image at 01000000 ...
   Image Name:   bf537-0.3-3.0.8-ADI-2011R1
   Created:      2012-02-28  12:54:43 UTC
   Image Type:   Blackfin Linux Kernel Image (uncompressed)
   Data Size:    2032724 Bytes = 1.9 MiB
   Load Address: 20292000
   Entry Point:  203e4bb4
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK
Starting Kernel at = 203e4bb4

"

Outcomes