Linux Firmware Replacement for Leapfrog LeapsterGS

11/06/2013

OpenGS

The Leapfrog LeapsterGS is a handheld gaming/educational device marketed at young children and sold by many retailers here in the US. For a number of years, Leapfrog has used Linux as the base operating system in a number of their products and this device is running a custom 2.6.37 kernel.

A lot of work has been done in the past to get custom kernels running on the their Didj handheld, much of this work has been captured here:  Embedded Linux Wiki . This site describes various hardware and kernel modifications required to run custom kernels on those devices. I took some time to evaluate the current offerings and test various apps on the Didj and Explorer platforms and had varying degrees of success. Ultimately I decided that the Didj and Explorer platforms lacked the physical memory and CPU resources to run the apps I was targeting, specifically, Mame and Mess.

The Leapster Didj, Explorer, and Leappad v1 are based on the LeapFrog LF-1000 branded MagicEyes Pollux VF3520F ARM core running at 393MHZ. There is 32MB of SDRAM available to the Didj while the Explorer and Leappad each have 64MB. I found that simple emulators like the GnuBoy Gameboy Classic/Color emulator and the Stella 2600 emulator worked well on these platforms but anything else seemed to require more ram or CPU.

The Leapfrog LeapsterGS and Leappad2 have 128MB ram , 2 or 4GB flash and a 550mhz Nexell NXP3200 based ARM9 SOC. This platform is capable of running the following open-source emulators:

Gnuboy based “Ohboy” Gameboy Emulator (SDL Based) Ohboy
Advancemame v0.106 (SDL Based) Advancemame
Xmame v0.106 (X11 Based) xmame.x11
Xmess v0.106 (X11 Based) xmess.x11
Stella 2600 Emulator (SDL Based) stella
Gngeo Neogeo Emulator (SDL WIP NO SOUND Now with working sound, update to be released shortly. – uses Cyclone 68K ARM assembler core)GNGEO

Clearly not all of the Mame supported roms will run at full speed but most of the classics do. Same goes for Mess, I’ve had good luck playing 8-bit consoles like NES but not quite enough CPU for 16-bit consoles. None of the above emulators are using ASM CPU cores, that would undoubtedly speed up emulation. You can expect NES in Xmess, Ohboy and Stella to perform at full speed for all games.

The custom kernel I’ve created relinquishes over 50MB of ram which the original Leapfrog kernel reserved for the video and 3D capabilities of the SOC. I don’t have the the specs for those drivers so freeing that ram allowed some of the more memory hungry apps to execute properly. I’ve also modified the keyboard driver to facilitate a more emulator friendly keymap. I have not modified the NAND driver’s partition mapping, it will create a 128MB useable root filesystem and reserve the remaining flash for user apps. I suggest keeping the emulators and their respective roms the larger secondary partition. Lastly, I’ve modified the X11 server to operate correctly on this device, in particular, it required a minor change to allow the button presses to register correctly. It can be downloaded here:

My custom 2.6.37 kernel and rootfs can be downloaded here:

Kernel: 2.6.37 Kernel Image
Rootfs: Root Filesystem

Kernel Source: Leapfrog Kernel Source
Root Filesystem Source: Build Root 2013.08.1

I used jrspruitt’s OpenLFConnect firmware flashing utility to write these images to NAND, it can be found here: OpenLFConnect . You will also need to make a serial cable adapter in order to customize the image once installed. This image will present a serial console on /dev/ttyS0 @ 115200 8N1 and by default there is no root password. Details on fabricating such a cable can be found here: Hardware Serial Cable . This is a simple 3 wire TX/RX/GND connection and if you don’t feel like hacking the device itself you can sacrifice an old Didj cartridge and use its edge connector as an interface into the serial lines. It should be noted that this is not an RS232 level connection but rather 3.3V. You’ll likely fry your unit if you don’t use a level converter before attaching it to a serial port. I use simple FTDI usb->serial cable directly to these lines with excellent results. In fact my cable is the 5V version and I haven’t experienced any issues.

This rootfs has all the proper libraries required to run SDL framebuffer apps as well as X11 apps. X11 is installed as is the Fluxbox window manager. Currently there is no customization for this image so some manual configuration is required. Most notably networking will require the g_ether.ko kernel module to be loaded and X11 will require a startup script to launch it. Common SDL environment variables should also be placed in /etc/profile. Lastly, there is a working and quite accurate touchscreen driver provided in the image using the opensource tslib libary. Run ts_calibrate at 1st boot to calibrate it for your device.

Though it’s not emulator related I have also included two text based media players, mpg123 and mplayer. I had good luck watching mp4 movies originally created for the Sony PSP in mplayer and all mp3′s seem to play fine. Leapfrog includes a couple of utilities which I recommend transferring to your device which allow volume and backlight control. The “lfd” daemon should be installed which accepts commands from the “lfd-ctrl” command line utility. lfd when loaded will allow you to use the volume controls on the unit to set the SOC’s volume output, it can also set the backlight brightness to one of 4 settings, 0-3, 0 being no backlight. Also of interest is the “fbctrl” tool, it’s a framebuffer tool which can be used to clear the screen among other things. These files will exist within /usr/bin in your stock Leapfrog OS, back them up before flashing so you can restore them to this new image.

Although this page focuses on the LeapsterGS , the same rootfs and kernel will also work on the Leappad2. There will be button mapping issues due to the lack of physical buttons on that device. I have experimented with various key map layouts however and when I settle on one I’m happy with I’ll post an image.

Enjoy!

Mike Wolak

Castlevania NES
Cobra Command Advancemame
Tetris Ohboy/GnuBoy
Pitfall II Stella
X11 Interface
Linux Framebuffer Display

Leave a Reply

You must be logged in to post a comment.