Leapster Explorer: UART Boot
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.
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.
Devroot Handy tool for setting up Codesourcery to build Emerald Boot
Micromon Used to send EB over UART and executing it
File:Emerald-boot-fixups.tgz utilities and files for fixing Emerald boot sources
Linux, this tutorial will use it exclusive for building the boot loader
Emerald Boot Source Found in the LF-Linux-* archive
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
Pictures SD and SD 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.
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 TARGET_MACH=LF_TS_LF1000
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
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),) CFLAGS += -DMICRO_BOOT else CFLAGS += -DSELF_BOOTSTRAP endif
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 #endif
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.