Programming the SPI FLASH

From OLPC
Revision as of 16:03, 16 August 2006 by JordanCrouse (talk | contribs) (buildrom includes olpcflash)
Jump to navigation Jump to search

(Preliminary instructions from Richard Smith)

olpcflash now works

The source code is olpcflash.c

I'm booting my board with Linuxbios from the SPI part.

If you are currently booting from a PLCC then please give this a try. The rest of you should probably wait a bit and see if I've changed professions to bricklaying.

One thing I noticed is that SPI boot is slower than the PLCC by just enough that I thought it had crashed after "Copying LinuxBIOS to RAM."

To compile:

gcc -O olpcflash.c -o olpcflash

or if you test it under the buildrom uClibc env then you will need to add the -static option

Note: The buildrom ROM image now includes the olpcflash binary by default.--JordanCrouse (Talk to me!) 12:03, 16 August 2006 (EDT)

To use:

- Read.

./olpcflash -r filename

- Write (Write does an erase first)

./olpcflash -w filename

- Verify

./olpcflash -v filename

My testing/developement method was to compile it static and copy it to a USB key. Then using a serial console I boot under the buildrom env from PLCC, mount the USB key, and run the program.

A side note is that I build with my USB mass storage 'use_delay' set zero and that appears to be working fine for my massive sample set of 1 key.

What I claim to have tested and Works For Me

  • read
  • write
  • verify
  • erase

Known Issues

'THERE ARE NO SAFEGUARDS!!!'

nuff said.

- Its really slow.

Currently it takes a little over 11 minutes to program the part. A large part of this is due to only doing a single byte each program cycle. The part can program up to 256 bytes each cycle so that may be the next feature to add. According to the typical program time in the datasheet it will only drop to around 6 minutes though so it may not be worth it.

- Re-entry from KBC reset back into KBC run mode causes the board to reboot.

Need to ask EnE about this. For now putting the KBC back into run mode after I finish the operation is disabled. This will allow you to use verify and make sure it worked ok. If you use a PS2 keyboard you are toast at this point.