Difference between revisions of "Leapster Explorer: UART Boot"

From eLinux.org
Jump to: navigation, search
(Bootloader)
(AC)
 
(15 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== Getting Started ==
+
== Summary ==
This how-to will show you how to gain UART Boot access to your Explorer. This involves a hardware hack not for the faint of smd soldering skills, or eye sight. There is two connections that need to be made to some pads that are very very tiny, takes some soldering skills, so be prepared. Also being a hardware hack, there is there is a chance of breaking something important, be careful and be warned. In the second part it will take you through compiling Emerald Boot and sending it over UART to the LX for testing.
+
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.  
  
How tiny are the pads? Here is a comparison of a normal resistor vs the pads you will be soldering to.
+
 
 +
'''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.
  
 
[[File:Leapster Explorer-D6 comparison.jpg|200px]]
 
[[File:Leapster Explorer-D6 comparison.jpg|200px]]
  
Notice that the width of the pad is the same size as the stripe on the resistor. If you don't feel comfortable soldering something this small, this mod might not be good for you to attempt.
+
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.
  
== Software Needed ==
 
  
[http://files.poxlib.org/LeapFrog/RidgeRun-toolchain-369009.tar.bz2 RidgeRun Toolchain]
+
== Prerequisites ==
 +
[[LeapFrog_Pollux_Platform:_Build_Environment| 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.
 +
 
  
Linux, this tutorial will use it exclusive for building the boot loader
+
== Software Needed ==
 +
Linux
  
[https://sites.google.com/site/jrspruitt/main/lx_eb_uart/OpenLX_EmeraldBoot_v2_-_UART_Boot.tar.gz?attredirects=0&d=1 emerald-boot-supplement] Includes binaries, source patch, and micromon
+
Python 2.5+ and PySerial installed
  
[[Leapster_Explorer#Source_Code | LF Linux Source]] Tested on LF-Linux-8291-20101026-1425.tar.gz
+
[[Leapster_Explorer:_Emerald_Boot#Versions| Sources and corresponding UART Patch]]
  
== Hardware ==
 
  
DJHI or similar cartridge for access to UART console
+
== Hardware Needed ==
 +
[[LeapFrog_Pollux_Platform:_Console_Access| Console Access]]
  
 
Soldering Iron (with very tiny tip)
 
Soldering Iron (with very tiny tip)
Line 28: Line 33:
 
2x 10K Ohm Resistor
 
2x 10K Ohm Resistor
  
2x Switch or jumper pins
+
2x Switches or jumper pins
 
 
== On Explorer ==
 
 
 
Pictures SD[13] and SD[6] show the pads you will be working with. Take your 4 pieces of wire and strip a small amount of insulation off one end of each, and solder one to each pad shown, watch your heat and where the tip is, so as not to destroy the pad or unsolder the component next to it. A magnifier would be a good idea here. Then on one of the wires, of the two to be connected together, attach the resistor and on the other the switch, then solder the resistor to the switch. Add a dab of hot glue or some other means of strain relief, put back together and you are done. To test, hold down both buttons, while you turn on your Explorer, nothing should happen. Try it with out holding down the buttons, to verify your Explorer still works.
 
  
 +
== Hardware Modification ==
 +
Pictures SD[13] and SD[6] show the pads you will be working with. You want to connect the two pads in each picture 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] high 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[13]'''
Line 39: Line 42:
  
 
''' SD[6]'''
 
''' SD[6]'''
[[File:Leapster Explorer-D6 Pull Down.png]]
+
[[Image:D6hack.jpg | 440px]]
 
 
 
 
 
 
Example:
 
  
[[Image:D6hack.jpg | 320px]]
+
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 ==
 
== 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.
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 LX in RAM, where Micromon will then execute the code and start Emerald Boot loading. The reason for this is Emerald Boot is too big to load over UART since it can range from 40 to 200+KB in size, and the Pollux SoC will start running the code sent to it over UART at 16KB.  
 
  
 
'''Compiling'''
 
'''Compiling'''
 
This works with the RidgeRun toolchain and on the LF-Linux-8291-20101026-1425.tar.gz sources, it may work with others toolchains and source version, but is as of yet untested. It also requires that you have built the LF-Linux kernel, as Emerald Boot draws a few files from it.
 
  
 
Extract the emerald-boot-supplement archive. Make sure you have a clean copy of the emerald-boot/ directory in the LF-Source tree.  
 
Extract the emerald-boot-supplement archive. Make sure you have a clean copy of the emerald-boot/ directory in the LF-Source tree.  
 
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.
 
  
 
Copy screens/ to the packages/ directory in the source tree.
 
Copy screens/ to the packages/ directory in the source tree.
Line 63: Line 57:
 
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.
 
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.
  
Inside the emerald-boot/ directory apply the patch.
+
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
 
   $ patch -p1 < /path/to/emerald-boot-supplement.patch
  
To compile the bootloader run
+
To compile the bootloader for UART run:
   $ OPTION=1 ./install.sh
+
   $ MICRO_BOOT=1 ./install.sh
  
Some OPTION values include MICRO_BOOT for UART enabling, SDCARD for booting a kernel off an SD card, and DEBUG which puts out some extra info in the console which is nice for bootloader testing.
 
  
example for UART booting and Debugging
+
== UART Booting ==
  
  $ MICRO_BOOT=1 DEBUG=1 ./install.sh
+
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.
  
'''UART Booting'''
+
  $ ./bootstrap.py emerald-boot_UART.bin 115200
  
Once you have compiled a UART enabled Emerald Boot, copy the resulting emerald-boot_UART.bin file to the micromon directory in the emerald-boot-supplement directory. 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.
+
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)
  
  $ ./bootloader emerald-boot_UART.bin 115200
+
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.  
  
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. Which is necessary because Emerald Boot is a lot bigger than that. If all goes well the Explorer should boot up as normal.
+
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.
  
Flashing Emerald Boot
+
If all goes well the Explorer should boot up as expected.
Once you've tested out your UART booting Emerald Boot, or have found a precompiled NOR version you want to permanently install on your Explorer, you need to flash it to the NOR memory.
+
 
 +
== 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.
 
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.
Line 97: Line 101:
 
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.
 
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.
  
== Flash to NOR ==
 
First off, this is a dangerous operation, things can go wrong. I would make sure you understanding fully the process here, and that you are using AC power instead of batteries, or at the very least a good fresh set of batteries, if the power goes out before its done, it won't boot back up. Also make sure you tested your Emerald Boot the best you can prior to doing this. Bricking is possible, so know what you are doing first.
 
 
To flash your compiled binary of Emerald Boot to your LX, you need to make sure and recompile it with out the MICRO_BOOT option, and then place your bin file on your LX. Run ''cat /proc/mtd'' on your LX and double check that NOR is mtd5 this will be needed for the next step. On the LX there is a script /usr/bin/norget that is for flashing to the NOR. It contains the key commands you will need to flash your new Emerald Boot to your LX.
 
 
mfgmode.sh 9 > /dev/null
 
flashcp -v path/to/your/emerald-boot.bin /dev/mtd5
 
mfgmode.sh 0 > /dev/null
 
  
It should say its erasing then writing, then finish, now cross your fingers and reboot. If all is successful it should boot like normal. Remember, things can go wrong, so make sure you understand the process first.
+
[[Category:Leapster Explorer]]

Latest revision as of 02:58, 27 October 2011

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.

Leapster Explorer-D6 comparison.jpg

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

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 in each picture 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] high 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] LX SD13 UART Enable.jpg

SD[6] D6hack.jpg

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.