'''Disclaimer:''' This will ''really'' erase a page of your nand. Make sure you think this through before doing it.

+

'''Disclaimer:''' This will ''really'' erase one or more pages of your nand. Make sure you think this through before doing it.

The nand erase command will reset a range of your nand to its unwritten state. In flash parts, such as Didj, this means all data within an erased page will become <code>0xFF</code>. The format of the command is:

The nand erase command will reset a range of your nand to its unwritten state. In flash parts, such as Didj, this means all data within an erased page will become <code>0xFF</code>. The format of the command is:

Line 78:

Line 78:

It is also important to understand that flash parts cannot erase less than one page. Either the whole page will be erased, or it will not. the size of your erasure should be a multiple of 0x800. In this case I have erased the first 16K of nand, which is where the bootstrap lives.

It is also important to understand that flash parts cannot erase less than one page. Either the whole page will be erased, or it will not. the size of your erasure should be a multiple of 0x800. In this case I have erased the first 16K of nand, which is where the bootstrap lives.

+

+

=== nand write ===

+

+

'''Disclaimer:''' This will write one or more pages to your nand. If those pages have not been erased first, the results will not be what you expect. See disclaimer in the erase nand section.

+

+

The nand write command will write a range of pages to your Didj's nand. In flash parts, bits can only be changed from 1 to 0. Therefore it is important to erase the block before you write it. The format of the command is

+

+

<code>nand write <memory address> <offset> <size></code>

+

+

Example:

+

+

LF1000 # nand write 1800000 0 4000

+

+

NAND write: device 0 offset 0x0, size 0x4000

+

16384 bytes written: OK

+

+

Note that you need to have the data you wish to write already in memory. In the example this data is 16Kbytes starting at physical address 0x1800000.

== To do ==

== To do ==

−

Need to document <code>nand write</code>.

+

Need to document putting it all together.

Revision as of 17:03, 7 April 2010

This primer walks through the basics of the nand command in u-boot and shows how to use it to write a new bootloader.

Contents

Programs Needed

A serial terminal program, e.g. Hyperterminal in windows or CuteCom in Linux.

Hardware Needed

UART connection

SD adapter is useful but not required.

Caution

This material can brick your Didj

While it is possible to still boot with a bad NAND, keep in mind that following the instructions in here there is a very slight, but real, possibility your Didj will never boot normally again. Follow these instructions at your own peril.

The nand command

u-boot provides a single command for interfacing with your nand part. It is important to keep in mind when using these commands that 'all values are given in hex, not decimal The general format of the nand command is:

nand <command> [options]

Some of the commands whose functions are understood are listed below.

nand dump

You can dump pages (2K of data) using the nand dump command. The format of the command is

It is also important to understand that flash parts cannot erase less than one page. Either the whole page will be erased, or it will not. the size of your erasure should be a multiple of 0x800. In this case I have erased the first 16K of nand, which is where the bootstrap lives.

nand write

Disclaimer: This will write one or more pages to your nand. If those pages have not been erased first, the results will not be what you expect. See disclaimer in the erase nand section.

The nand write command will write a range of pages to your Didj's nand. In flash parts, bits can only be changed from 1 to 0. Therefore it is important to erase the block before you write it. The format of the command is