Leapster Explorer: UART Boot

Summary
UART booting the Emerald Boot boot loader, allows you to recover a device that has had the installed boot loader corrupted, or test new boot loaders, easily and non-destructively. Unlike its predecessor on the Didj, Didj_Lightning_Boot, Emerald Boot is significantly larger, and surpasses the Pollux 16k UART boot limit, while the hardware also prevents direct access to the pins needed to set the Pollux in the UART boot state. So this requires not only a software modification, but a hardware one also.

Warning This hardware modification requires some delicate soldering skills. There 4 wires that need to be solder to rather small pads. Before proceeding take a look at what needs to be done, and make sure you are capable of making the necessary modifications with out harming your device.



Notice that the width of the pad is the same size as the stripe on the resistor. This takes a light touch and a steady hand, be sure you are capable before proceeding.

Prerequisites
Setup the build environment

Some versions of Emerald Boot require being built against the kernel, it may be necessary to build a kernel first, as Emerald Boot may attempt to pull some files that it built.

Software Needed
Linux

Python 2.5+ and PySerial installed

Sources and corresponding UART Patch

Hardware Needed
Cartridge

Console Access

Soldering Iron (with very tiny tip)

Wire (very fine gauge)

2x 10K Ohm Resistor

2x Switches or jumper pins

Hardware Modification
Pictures SD[13] and SD[6] show the pads you will be working with. You want to connect the two pads together, with a switch or jumper, and a 10Kohm resistor in series. So that when the connection is closed via the switch or jumper, it completes the circuit. This is pulling the SD[13] and SD[6] low, which will be read by the Pollux SoC on start up, to tell it where it should look for the boot loader, in this case, being sent over UART. When everything is soldered up, be sure to add some strain relief so the wires won't be pulling on the delicate pads.

SD[13]

 SD[6]

To verify it works, press both switches and hold, then turn on the Explorer. Nothing should happen, the screen will stay blank. It is now expecting the boot loader to be sent to it. Try booting it with out the switches held down, it should boot normally.

Bootloader
Technically this isn't a UART boot, what will be happening is, once Emerald Boot is compiled, the Micromon application will be used to load the bin file onto the Explorer's RAM, where Micromon will then execute the code and start Emerald Boot loading.

Compiling

Extract the emerald-boot-supplement archive. Make sure you have a clean copy of the emerald-boot/ directory in the LF-Source tree.

Copy screens/ to the packages/ directory in the source tree.

Copy host_tools/ to the root directory along side emerald-boot and packages. If you want you can make your own, just save them as png. Although they only get used when Emerald Boot is in USB boot mode.

Next apply the patch which makes the necessary modifications for UART booting, along with a few other mods to make things a bit more friendly. Inside the emerald-boot/ directory apply the patch.

$ patch -p1 < /path/to/emerald-boot-supplement.patch

To compile the bootloader for UART run: $ MICRO_BOOT=1 ./install.sh

UART Booting
Once you have compiled a UART enabled Emerald Boot, copy the resulting emerald-boot_UART.bin file to the micromon directory in emerald-boot-supplement/. Set the jumpers or switches to enable UART boot on the Explorer and hook up a serial cable or usb adapter, then run this command while holding down the power button.

$ ./bootstrap.py emerald-boot_UART.bin 115200

You should see something like this Opening serial port Setting local baudrate to 19200 Sending block 1 of 1 block(s) Sending block 31 of 31 block(s) Setting target baudrate to 115200 Setting local baudrate to 115200 Remote CRC32: 0xE514244C Local CRC32: 0xE514244C Sending block 335 of 410 block(s)

This uploads a small program, Micromon to the Explorer, which allows uploading a file much larger than the 16k bytes the Pollux SoC accepts for UART booting.

After it changes the baudrate, you can let off the power button. This allows you to hold any buttons you may want to use to trigger different Emerald Boot modes.

If all goes well the Explorer should boot up as expected.

Flash to NOR
Once you've tested out your Emerald Boot by running a UART version, or have found a precompiled NOR version you want to permanently install on your Explorer, you need to flash it to the NOR memory.

Caution: This is a potentially harmful modification. Some precautions, make sure you have a known working copy of Emerald Boot for NOR and UART. If you compile you're own, make sure to test a UART version first. Before attempting this, make sure you have fresh batteries or AC adapter, and in worst case, will be able to make the hardware modifications necessary to UART boot if you have not already.

Copy emerald-boot_NOR.bin to /LF/Bulk then run these commands on the Explorers command line.

mfgmode.sh 9 > /dev/null flashcp -v /LF/Bulk/emerald-boot_NOR.bin /dev/mtd5 mfgmode.sh 0 > /dev/null

Then reboot your device, if all went well it should boot up fine. If there is an issue and it will not boot, make the necessary hardware modifications for UART boot if you have not. UART boot the device, and redo this process with a known working version of Emerald Boot.