Unbrick Your GP2X With Openocd

From wiki.gp2x.org

Here, we describe how to setup and use openocd/GDB to load a RAM version of U-boot by JTAG. This is a part of the unbricking process for the GP2X. The software used here works well on UNIX OSes, like GNU/Linux. I don't know if it is possible to use this on windows.


Contents

Software installation

openocd

The easiest way to get openocd is to get the packages for your distro. For ubuntu/debian, it is called openocd. Or, you can download and compile it.

GDB for ARM

It is quite easy to build GDB :

$ cd gdb-6.6
$ mkdir build
$ ./configure --prefix=$PWD/build --target=arm-elf
$ make && make install

Then you can launch it with :

$ gdb-6.6/build/bin/arm-elf-gdb

Configuration

Here is the configuration of openocd (gp2x.cfg) :

#daemon configuration
telnet_port 4444
gdb_port 3333

#interface
interface parport
parport_port 0
parport_cable wiggler
jtag_speed 0
#use combined on interfaces or targets that can't set TRST/SRST separately
reset_config trst_and_srst srst_pulls_trst

#jtag scan chain
#format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)
jtag_device 4 0x1 0xf 0xe

#target configuration
daemon_startup attach
#target <type> <endianess> <reset mode>
target arm9tdmi little run_and_halt 0 arm920t
working_area 0 0x200000 0x4000 backup
run_and_halt_time 0 30

To get access to parallel port under linux, you have to load some modules and fix access rights :

$ su
# rmmod lp
# modprobe ppdev
# chmod 666 /dev/parport0
# exit
$

Wiring

  1. Plug the DB25 cable between the cradle and the parallel port of your PC.
  2. Plug power supply in the GP2X.
  3. Rack the GP2X in the cradle.

Load u-boot.elf

  1. Prepare the command line of openocd but don't hit enter : openocd -f gp2x.cfg
  2. Switch on the GP2X and launch openocd just at this moment.
  3. launch arm-elf-gdb in the directory where u-boot.elf is.
  4. issue the following commands :
exec-file u-boot.elf
target remote localhost:3333
load

This should take some time and end successfully. Now, you're up to the step where you could launch the U-boot by issuing cont. But read this for other things to do before.

Personal tools