DevGuide/GDB OpenOCD Debug

From PaparazziUAV
Revision as of 16:37, 16 May 2007 by Martinmm (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

JTAG debugging

Paparazzi boards do not have a JTAG interface. The one time we needed a JTAG debugger because of some strange problems we used Keil/Olimex LPC2148 boards with a professional JTAG tool. All the parallel port Wiggler adapters and the software for that showed poor performance and were abandoned.

Recently some new JTAG adapters that use the FTDI2232 USB-parallel converter were introduced through OpenOCD (you can try your Wiggler with that, too). The USB JTAG adapters are available from Olimex or Amontec and work fine with Windows (Yagarto). Getting them to work with Linux is still a little adventure. This is collected info from various sites. The paparazzi-dev packages should be installed.


The low level interfacing is done by libftdi, get it from It is possible to use a closed source version from FTDI, too.

tar xvfz libftdi-0.10.tar.gz
cd libftdi-0.10
make install

Get the OpenOCD software It needs some additional packages to be built.

apt-get install autoconf
apt-get install automake
apt-get install subversion
svn checkout svn://
cd trunk
./configure --enable-ft2232_libftdi
make install

For some debian distributions you might have to add '/usr/local/lib' to /etc/ and call


Put an entry with the vendor/device ID into your udev rules directory to get the correct access rights (or use the file from cvs in paparazzi3/conf/system/udev/rules). This applies to Yagarto.

add 'BUS=="usb", SYSFS{idVendor}=="0403", SYSFS{idProduct}=="cff8", GROUP="dialout"' 

Generate an OpenOCD config - this one worked for me, might need some polishing

#daemon configuration
telnet_port 4444
gdb_port 3333

interface ft2232
ft2232_layout "jtagkey"
ft2232_vid_pid 0x0403 0xcff8
jtag_speed 2

# reset_config <signals> [combination] [trst_type] [srst_type]
reset_config trst_and_srst

#jtag scan chain
jtag_device 4 0x1 0xf 0xe
jtag_nsrst_delay 333
jtag_ntrst_delay 333

#target configuration, what to do on a target reset
target arm7tdmi little run_and_halt 0 arm7tdmi-s_r4
run_and_halt_time 0 30
daemon_startup reset
#target_script 0 reset openocd.script
working_area 0 0x40000000 0x4000 nobackup
# flash bank lpc2000 <base> <size> 0 0 <variant> <target#> <clock> ['calc_checksum']
# mthomas: LPC2138 @ 12MHz 0x7D000 from 500*1024 (not 512!)
flash bank lpc2000 0x0 0x7D000 0 0 lpc2000_v2 0 12000 calc_checksum

Get Eclipse 3.2.2 (Debian Eclipse package did not work for me - some problem with JRE 1.4.x?)

tar xvfz eclipse-SDK-3.2.2-linux-gtk.tar.gz

Unzip the Eclipse embedded CDT from Zylin for embedded debugging

cd eclipse

Now you have to get used to Eclipse...start eclipse, close the welcome screen and change outline to C/C++: Window->Open Perspective->Other->C/C++ Add openocd support: Run->External Tools->External Tools Program, Name: OpenOCD, Location: /usr/local/bin/openocd, Arguments: -f <wher_your_cfg_lives> Try to use the debugger: Run->Debug Embedded debug (Native), Commands: ?