Difference between revisions of "Leapster Explorer: UART Boot"

From eLinux.org
Jump to: navigation, search
(Programs Needed)
Line 8: Line 8:
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. If you don't feel comfortable soldering something this small, this mod might not be good for you to attempt.
== Programs Needed ==
== Software Needed ==
[http://files.poxlib.org/LeapFrog/RidgeRun-toolchain-369009.tar.bz2 RidgeRun Toolchain]
[http://files.poxlib.org/LeapFrog/RidgeRun-toolchain-369009.tar.bz2 RidgeRun Toolchain]
Line 16: Line 16:
[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
[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
== Software Needed ==
[[Leapster_Explorer#Source_Code | LF Linux Source]] Tested on LF-Linux-8291-20101026-1425.tar.gz
[[Leapster_Explorer#Source_Code | Emerald Boot Source]] Found in the LF-Linux-* archive
== Hardware ==
== Hardware ==

Revision as of 18:41, 17 June 2011

Getting Started

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.

How tiny are the pads? Here is a comparison of a normal resistor vs the pads you will be soldering to.

Leapster Explorer-D6 comparison.jpg

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.

Software Needed

RidgeRun Toolchain

Linux, this tutorial will use it exclusive for building the boot loader

emerald-boot-supplement Includes binaries, source patch, and micromon

LF Linux Source Tested on LF-Linux-8291-20101026-1425.tar.gz


DJHI or similar cartridge for access to UART console

Soldering Iron (with very tiny tip)

Wire (very fine gauge)

2x 10K Ohm Resistor

2x Switch 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.

SD[13] LX SD13 UART Enable.jpg

SD[6] Leapster Explorer-D6 Pull Down.png




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 80+KB in size, and the Pollux SoC will start running the code sent to it over UART at 16KB. Lightning boot on the other hand, easily meets the 16KB limit and will often times need extra padding to trigger the Pollux UART boot start up.

To get started, get yourself the Emerald Boot source linked above, the Micromon program, the Emerald Boot Fixups and the devroot environment. Devroot sets up the codesourcery build environment, if you know what you are doing with such things, you can venture out on your own, but I highly recommend devroot, as it takes all the guess work out of it, and makes life rather simple in this regard. Once devroot and Micromon are set up, you can get to working on Emerald Boot, you will need these environment variables set, I put them in a file, and run source My_Env_Vars when I need them from the devroot shell.

export ARCH=arm
export KERNELDIR=~/path/to/sources/kernel/linux-2.6
export PROJECT_PATH=~/path/to/sources
export ROOTFS_PATH=~/path/to/sources/target/didj-rootfs
export RELEASE_PATH=~/path/to/sources/target/release
export TFTP_PATH=~/path/to/sources/target/tftp
export EROOTFS_PATH=~/path/to/sources/target/erootfs.stage

if you move your emerald-boot/ you may need to change a few of these. You will also need to have compiled the LX kernel in the source tree, as Emerald Boot draws a few things from it. It doesn't have to be a working one so much as just a run through the compiling process. Build Environments is a good place to get started on how to build a kernel.

Next take the fixup archive and extract it, screens/ should go in the source directory packages/ host_tools should be in the directory above emerald-boot, and copy dump32.py into your emerald-boot folder. If you are building the first version of Emerald Boot you can copy in the makefile into emerald-boot/, if its a newer version, do not, as some things have changed.

First off change

 CFLAGS += -I$(KERNELDIR)/arch/arm/mach-lf1000/include -I$(KERNELDIR)/include/linux

to this

 CFLAGS += -I$(KERNELDIR)/arch/arm/mach-lf1000/include -I$(KERNELDIR)/include/linux -I$(KERNELDIR)/include -I$(KERNELDIR)/arch/arm/include

And at the top of the file in the CFLAGS string remove -Werror and -DSELF_BOOTSTRAP

I also added in this in the file to make it easier to compile a UART version or a normal version

# Boot using Micromon, turn bootstrap off
ifneq ($(MICRO_BOOT),)

This will put the necessary SELF_BOOSTRAP flag back in, when not being booted over UART.

This leaves one final file to change and we are ready to compile. Open startUp.S from emerald-boot/ and you will need to include this code in two places. This code will set a register bit that tells the system where certain parts of the memory can be accessed, this changes regarding if Emerald Boot was booted from NOR or NAND/UART, for some reason this doesn't get set right, so we need to do it this way.

 #ifdef MICRO_BOOT
   // Sets NFCONTROL bit NFBOOTENB, Doesn't seem to get set
   //  when put into UART/NAND boot mode, so must manually do it
   ldr r3, =0xC0015874   // Loads NFCONTROL's address into R3
   ldr r2, [r3]          // Fetch NFCONTROL's value
   orr r2, r2, #0x020   // Set Bit5
   str r2, [r3]          // Store the value back to NFCONTROL

Include this snippet right after the IRQHandler: label and after the #endif directly following the line iputc #'^' around line 355 or so. You should be all set to compile now.

Open up a terminal, then run ./devroot-dir/devroot/usr/bin/shell and then put in your environment variables, navigate to the emerald-bin folder and run

 DEBUG=1 MICRO_BOOT=1 ./install.sh -c

that will give some debug info on the terminal, make it UART bootable, and do a clean build. Open up another terminal and go to your micromon directory. Make sure you've got your UART cartridge in the LX and hooked up to a USB port and hold the power button down. Then run

 bootloader.py /path/to/emerald-boot.bin 115200 0x00000000 0x00000000

if all is correct you should see it send itself over, a number counting up to 31, then start sending another bit of data with a higher number, this is emerald-boot.bin once loaded it will execute and you should see it start uncompressing a kernel, and on your LX screen it should start booting as normal.

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.