Monday, June 28, 2010

Debugging with GDB and OpenOCD By Using Wiggler Jtag

I have found OpenOCD the best solution for debugging the embedded hardware by using Jtag devices.

Open On-Chip Debugger has been created by Dominic Rath as part of a diploma thesis at the University of Applied Sciences, FH-Augsburg.
Since that time, the project has grown into an active open-source project, supported by a diverse community of software and hardware developers from around the world.

The Open On-Chip Debugger (OpenOCD) aims to provide debugging, in-system programming and boundary-scan testing for embedded target devices.

Download OpenOCD 0.4.0 from:
http://www.freddiechopin.info/index.php/en/download/category/4-openocd

Or you can download the openOCD project from here:
http://developer.berlios.de/projects/openocd
and build it yourself.

OpenOCD User's Guide,
http://openocd.berlios.de/doc/pdf/openocd.pdf

I am using wiggler Jtag to debug a sample application.
Wiggler Jtag Schematic:



Using OpenOCD is not as easy as just connecting your Jtag and running OpenOCD.
You have to configure OpenOCD server so it knows about the Jtag and the hardware.
I have installed the OpenOCD in C:\Program Files\OpenOCD\0.4.0\bin
OpenOCD would read it's configuration from openocd.cfg by default.
Here is my openocd.cfg for using Wiggler Jtag and AT91EB40a evaluation board.

source [find board/AT91EB40a.cfg]
source [find interface/parport.cfg]

interface parport
parport_port 0x378
parport_cable wiggler

There are some pre-configured files for some evaluation boards, processors and connections, for example here I am using AT91EB40a evaluation board so I include the
board/AT91EB40a.cfg file at the top of openocd.cfg file.

These are the default port addresses for OpenOCD,
gdb_port 3333
telnet_port 4444

So you can connect to OpenOCD by telnet in port 4444 and use telnet as a console for it.



Let's debug our application,
1. Connect your wiggler to the AT91EB40a evaluation board.
2. Power on the board
3. Run OpenOCD


4.Run gdb from Eclipse
Follow the instruction in post "Embedded Remote Debugging With Eclipse"
But in command write target remote localhost:3333 to connect to OpenOCD and run Debug.

No comments:

Post a Comment