SPI FLASH Recovery for XO-4 Using JTAG

From OLPC
Jump to: navigation, search
  This page is monitored by the OLPC team.

If you have an XO-4 that will not start Open Firmware, you should first try to recover it with CForth, per SPI FLASH Recovery for XO-4 Using CForth. If that doesn't work, and you have a Marvell JTAG setup, you may be able to recover it with JTAG.

Preparation

You need:

  • The Marvell xTreme Debugger software - the version that includes the support files for the MMP3 chip (if you don't know how to get it, you probably can't get it...).
  • A Windows system to run the software (it works in a virtual machine)
  • An XO-4 with the JTAG connector installed
  • The special JTAG adapter cable that connects to the XO's JTAG connector
  • The OLPC JTAG Support Tools (see below)
  • A serial connection to the XO's internal serial port.

Getting the OLPC JTAG Support Tools

Download http://dev.laptop.org/~wmb/xdbkit-cl4.zip (source).

Unpack xdbkit to C:\Program Files\Marvell\XDB5.3\xdb\ - when you are done, xdb\ should have a subdirectory named OLPC .

You may need to get cforth.img and ofw.rom into that OLPC directory, if they don't already exist or are out of date. See #Updating the cforth.img and ofw.rom Files below.

Procedure

  • Connect the JTAG box to the XO
  • Connect the serial port to the XO and start a terminal program to talk to it
  • Power on the XO
  • Start Marvell xTreme Debugger.
  • In the startup dialog, browse to C:\Program Files\Marvell\XDB5.3\xdb\configurations and select the file olpc.xsf
  • Optional: if you have trouble later, with xTreme Debugger not connecting to the XO, at this stage you can click on Settings and adjust the "Connection Type" settings in the ARM-JTAG and the three CS-JTAG tabs. The correct values are ARM-JTAG: Reset SoC & Stop, CS-JTAG: Try Hot Connect & Stop. Then get back out to the main startup dialog.
  • Click "Start"
  • Eventually, if you are lucky, Marvell xTreme Debugger will connect to the board, and a new row of buttons will appear in the menu bar at the top of the window.
  • If necessary, resize the Marvell xTreme Debugger window so you can see the terminal emulator.
  • While holding down the XO's rotate button (underneath the board near the power connector), click on the CFORTH button (in the debugger's menu bar).
  • The debugger will download CForth into the XO's SRAM and the CForth signon message should appear in the terminal window, followed by "Skipping OFW" and an "ok" prompt.
  • Click on the DLOFW button to copy OFW into the XO's DRAM.
  • When that finishes, type "reflash0" at the ok prompt in the terminal window. You should see "Erasing", then after some time "Programming", then finally "Verifying".
  • When the ok prompt reappears, the XO's SPI FLASH has been rewritten. You can now power cycle, and the machine should start normally.
  • Update OFW using normal procedures (such as from a USB stick) if the version you have reflashed per the above is out of date.

Running OFW Instead of Flashing It

After you have downloaded OFW with DLOFW as above, you can start it running by typing

ok ofw-go

then hit the RUNOFW button in XDB.

It might not work perfectly, because OFW depends on finding some auxiliary modules in SPI FLASH. If you haven't flashed a good copy of the OFW image into SPI FLASH, either OFW won't find any modules or it might find out-of-date ones. But OFW should at least run to the point where you can debug things on the serial port.

Updating the cforth.img and ofw.rom Files

The cforth.img and ofw.rom files in the OLPC directory might be out of date. If they are so out of date that the system won't work after you do the above procedure, you can try with a new copy of ofw.rom , and maybe a new cforth.img . ofw.rom is a verbatim copy of an OFW release file (like q6b05.rom), so you can get a new copy from http://dev.laptop.org/pub/firmware and copy it into the OLPC directory, renaming it to ofw.rom .

You can probably get away with an old cforth.img, but if not, you can extract a new one from the ofw.rom with:

 $ dd if=ofw.rom of=cforth.img bs=1 skip=8192 count=122880

It is also possible to copy the ofw.rom directly from an OFW build tree (cpu/arm/olpc/cl4/build/q6XXX.rom) and cforth.img from a CForth build tree (build/arm-xo-cl4/cforth.img).