Fat Jbox

From eLinux.org
Jump to: navigation, search

This is a page to document the software application for prpplague's clever SD/MMC Cartridge Hack.

Fatjbox is a crude but usable user interface(UI) prpplague's clever SD/MMC Cartridge Hack. The software is mostly just a combination of the JuiceBox Code Test programs with a few extra routines to fill in the gaps(like: nandwrite,FAT16 read,scroll,buttons init and controls,mmc GPIO inits...) The software displays(on the juice box screen) the filenames(8.3) and directories of a FAT16 SDcard and allows the user to navigate around the files and directories by using the FF and REW buttons on the juice box. It highlights the current file or directory. If you press the PLAY button while on a directory it will descend into the directory(displaying the filenames, Its like using the cd command in unix). If you navigate to file(ie its highlighted) and its extension is .BIN the you can execute the file by pressing the PLAY button(given that you have set the routine to run at 0x0c001000). The UI boots from the XD card nand. So it is now possible to easily write and execute files without a JTAG(once you have SD/MMC Cartridge Hack programmed of course).

Here is a brief description of how I did this:

 *1) Wrote the the nandwrite routines (this routine is quirky but works well but you unfortunately need a jtag for this step).
     (nandwrite will only work from a clean juicebox reboot, I don't know why????)
 *2) Wrote the init routine for the the mmc GPIO and modified the bitbang SPI routines.
 *3) Ported ZWS DOSFS[1] (READONLY) to the juice box.(this was the easy part)
 *4) Wrote the UI and scroll routines

I have tested it by executing a small juice box comm program that I wrote which turns the (juice box into a serial display) and the LCD_2 demo test code. It seems to work fine so far.

DOSFS is picky about how the sd card is partitioned (I partitioned it as FAT16 in linux) but I have written to it from both Windoze 2000 and linux and it works fine.

The best way to create a clean fat16 partition and file structure for your sd card(linux):

fdisk /dev/sda
at the command prompt, do
"n" to create a new partition
"p" for primary
"1" for partition 1

Next you need to change the type to FAT16 (assuming you want to use mkdosfs)
at the command prompt, do

"t" to change the type
"1" for partition 1
"6" for FAT16

after that you need to save the changes with "w"

mkdosfs /dev/sda1

The software does very little error checking and the source code is a messy looking, but I'm willing to release source code as is (you may have to hold your nose while looking at the code).

to use the code: you need to untar ungzip fatjbox.tgz (tar -zxvf fatjbox.tgz)

do the usual:

            make -f fatjbox.mak            (edit the make file to fit your toolchain) or just use my fatjbox.elf 

make the bootable nand image like the JuiceWare Test Image.

Use your favorite juice box nand write routine to flash the nand on the SD/MMC Cartridge Hack (Just kidding You can use my nandwrite routine)

Put the SD/MMC Cartridge Hack in the juice box and turn it on. Hopefully you will see your files names displayed on the screen

 *Here is the link to the fatjbox software  Media:fatjbox.tar.gz
 *Here is a link to the nandwrite software  Media:nandwrite.tar.gz