Programming the SPI FLASH

From OLPC
Revision as of 14:39, 16 August 2006 by 18.85.46.127 (talk) (olpcflash now works)
Jump to: navigation, 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)

First, make sure you won't lose power; you really don't want to have a bad BIOS flash. If possible, plug your board into an uninterruptible power supply.

To use:

- Read.

./olpcflash -r filename

- Write (Write does an erase first)

./olpcflash -w filename

- Verify

./olpcflash -v filename

If the verify fails, do not power off or reboot your machine as you may not be able to reboot if the flash has been corrupted; please reattempt to write and verify the flash. If the write/verify operations continue to fail, please get help. A good channel for help is the #OLPC IRC channel on irc.freenode.net.

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.