SPI FLASH Recovery for XO-1.75 Using CForth
If you have an XO-1.75 that will run CForth but will not run OFW, possibly because you are a firmware developer and have installed a test version whose OFW component is horribly broken, you can load a new version of OFW into the SPI FLASH from CForth.
Attach a serial port to your semi-dead XO-1.75.
Make sure your terminal emulator supports binary mode downloads. For minicom, this typically requires an auxiliary "bin-xfr" program - see http://dev.laptop.org/~wmb/bin-xfr.c , http://dev.laptop.org/~rsmith/bin-xfr.c , or see Using Minicom on an XO. For TeraTERM, check the Binary option in the Send File dialog.
Get into CForth by holding down the rotate key and powering on.
ok init-spi .spi-id ok 100000 0 do key i c! loop <Send a rom image file, e.g. q4b03.rom, over serial, in binary mode> ok 20000 e0000 20000 reflash
After that finishes you can power off and back on, and hopefully your machine will work.
The recipe above reflashes only the portion of the FLASH that contains OFW, leaving the (already working) CForth portion alone.
You can reflash the whole thing if you prefer, but I tend to be conservative in this state, not wanting to risk screwing up CForth. But for completeness, here is the recipe for reflashing the whole thing. Only the last command is different.
ok init-spi .spi-id ok 100000 0 do key i c! loop <Send a rom image file, e.g. q4b03.rom, over serial, in binary mode> ok reflash0
Using Minicom on an XO
First, install minicom:
yum install minicom
Now install the binary transfer program:
wget http://dev.laptop.org/~wad/bin-xfer chmod a+x bin-xfer
Thanks to Danny Sung at http://www.dannysung.com/wmain/linux/tips/sending-binary-files-via-minicom/ for the script.
Attach a USB/serial adapter, and set up minicom to use it:
olpc-nosleep sudo minicom -s USB0
You will need to change the serial port to be /dev/ttyUSB0.
You also need to change the “File transfer protocols”. You can add a section there called “binary”, point it at your file, and specify:
- Name: Binary
- Program: /home/olpc/bin-xfer -o %l
- Name: Y
- U/D: U
- FullScr: Y
- IO-Red: N
- Multi:N
If you placed bin-xfer somewhere other than your home directory, don't forget to use the correct pathname! Save the configuration.
To send the binary file, type CTRL-A s and select Binary mode.