GP32 JTAG Adapter
To do JTAG flashing of your bios, you need a PC with a parallel port, a special adapter, and some software.
This page provides software for Windows and Linux.
The schematic for the adapter is:
For each output from the PC to the GP32, the adapter has a couple of resistors and a capacitor, to cut
down noise and also to protect the GP32 from excessive voltage. The string of diodes (D1-D4) provides a
2.8V reference, and the other diodes (D5-D7) will conduct if the voltage from the PC is above about 3.4V.
This will protect the GP32 inputs from voltages outside their allowed range.
The TDO signal, from the GP32 to the PC, simply has a resistor and a capacitor again for noise reasons.
Keep the cables short: my cable from the PC to the adapter is about 1 metre, and from the adapter to the
GP32 is about 10cm. Here is my adapter (which has a few extra parts on it, but they are irrelevant)
The screen on the GP32 will look odd while the jtag program is running. This
is because the GP32's CPU is effectively stopped during these JTAG operations, so it is not updating the
screen. Don't worry about this, it's normal and won't damage your GP32.
Only program your bios with fully charged batteries, or (preferably) with a power supply. This is
vital as the programming process may appear to be successful but the bios may not be programmed
correctly if the supply voltage drops while programming. Programming the bios takes quite a bit of extra
current, so even if your batteries appear fine for playing games with, they may not have enough charge for
programming the bios.
Whether for Linux or Windows, this program takes a long time to run.
A read of the bios takes about 20 minutes, a full write takes about 90 minutes.
The programming speed is interesting, because the data rate is very high (about 400kbits/sec) yet the data
transfer is very slow. This is because the jtag software has to set up all output pins of the CPU for each
signal that it sends to the Flash chip. Reading a byte from the Flash, or writing a byte to it, requires
several signals to be sent so it all adds up to a lot of overhead.
Here's a shot of the flashing process in action, the bottom trace is TCK and the top trace is TDI.
As you can see, the data rate is about 420kbps:
Mr Spiv has provided me with a "mini-bios" which has just enough code to read a real bios from a SMC
and flash it, and this speeds up the process.
To use this, you need to have a bios file, named "FW.BIN", in the root directory of your SMC card.
That is, the directory listing of the root directory should be
Now, download and unzip the mini-bios.
Program it into the GP32 bios using one of the methods described below. Then turn off the GP32,
disconnect the JTAG cable, and turn the GP32 on again. The GP32 will load FW.BIN from the SMC, and once
you press "Start" + "Select" + "Left" + "Right" on the GP32, the FW.BIN file will be programmed into the
Software for Linux and Windows
Download the source code for the flash program, and then compile it with
gcc -s -O2 -o jtag gp32_jtag_linux.c
The jtag program must be run as root. When you run it, you get a list of the available
rfbrown@val jtag $ ./jtag
Usage: ./jtag (options)
Where options are any of the following.
/? Shows this help screen.
/p biosfile.bin Program biosfile.bin to the GP32's BIOS.
/d dumpfile.bin Dump the GP32's BIOS to dumpfile.bin.
/c biosfile.bin Compare the GP32's BIOS to biosfile.bin.
So connect it all up, switch on the GP32, connect to the PC, and
./jtag /d dumpfile.bin
The result of this should look something like:
root@val jtag # ./jtag /d d.bin
Using parallel port at 378
Reading 0x80000 bytes from BIOS...
... etc ...
For a full flash, type
./jtag /p fw.bin
This program is a mixture of code and information that I got from
the LART project,
and the Code Project, plus a few bits I made myself.
Note: This program does not play particularly nicely with other programs, you will notice that your
computer slows down while it is reading from or writing to the GP32. In fact, on Windows 95 or 98 it may
lock up completely. This is necessary, because if the program allows other programs to run freely it will
take forever to get the bios transfer done! I'd recommend that you just don't run any other software while
you're reading or writing your bios.
For this program to work on Windows NT, 2000, or XP, you need to install a driver called GiveIO which
allows the program to access the parallel port. If you do not install the driver, the program will give
an illegal memory access error when it is run.
For Windows 95 or 98, you don't need the driver so skip the next section.
- You will need to be logged in as Administrator.
- Download giveio.zip, and unzip it somewhere.
- Copy the GiveIO.sys file to your WinNT\System32\drivers folder.
For Windows 2000/XP
- In the Control Panel, select "Add/Remove Hardware"
- Select "Add/Troubleshoot a device"
- Select "Add a new device"
- Click 'Next'
- Select "No, I want to select hardware from a list"
- Select "Other devices" and click "Have Disk..."
- Browse to the folder where you unzippped GiveIO.zip, and select givio.inf
- Follow the prompts to install the driver. A reboot should not be necessary.
For Windows NT
- You need a utility called INSTDRV, which is in the Windows DDK, or LOADDRV, provided
by the Windows Developer's Journal.
- I'm not going to explain it here because it's a bit involved. If you are using Windows NT, get in
touch with me and I'll give you the information.
Download The Flash programming program. Unzip and run it, and you
should see this:
Well, actually the program doesn't have red numbers on it, they are just for this explanation. Make sure
that the "Parallel Port" selection (1) is correct
for your machine, it is autodetected and should be right.
Oh, and make sure that the GP32 is turned on ;-)
Then decide what you want to do, and click the Read
(3), or Verify
(4) button accordingly.
If you want to back up the contents of your BIOS into a file on your computer, click the Read
(2) button. You will be prompted for a filename
to save the bios contents to, then the bios will be read and saved in that file. Note that if the file
already exists, you will not be warned by the program, it will just overwrite the old file. Also note that
the bios data is written in one chunk after it has all been read, so if you interrupt the reading process,
nothing will be written to disk.
If you want to verify the the bios in the GP32 is the same as a file on your hard disk, click the Verify
(4) button. A File Open dialog will appear so
select the file you want to compare with the GP32's bios. If the contents of any byte do not match, the
process will stop immediately and tell you the address of the mismatch, and the expected (file) and
read (gp32) values.
If you want to program a new bios into your GP32, click the Program
(3) button. A File Open dialog will appear so
select the file your want to program into your bios. While the bios is being programmed the progress bar
will advance and the address currently being written is displayed:
If you want to stop the transfer at any stage, just click the "Stop Transfer" button. Note that a read or
verify can be stopped at any stage with no ill effects, but if you interrupt a write, you will probably
get a GP32 that doesn't work. That's not a big problem, just write it again and let it go to completion.
During the writing process, each byte written is checked to make sure it was written correctly.
If a byte fails this check, the writing process will stop immediately and tell you the address that failed.
Hopefully, everything will complete successfully and at the end the program will indicate this:
Because each byte of the bios is checked as it is written, it probably isn't necessary to do a "Verify"
after programming to make sure the programming was successful. You can do that if you wish, however.
Anyway, turn off the GP32, disconnect the JTAG cable, turn on the GP32 again and your new bios
should be up and away!
Finally, if anyone is interested in making modifications to the jtag program, download
the MS Visual C++ project and have fun! There aren't many comments
in the code, but I'm sure anyone that's had some experience with MFC will have no trouble finding their