Difference between revisions of "DevGuide/OpenOCD"

From PaparazziUAV
Jump to navigation Jump to search
(moved installation instructions for openocd from DevGuide/JTAG-Debug to here and removed obsolete info)
 
m
 
(5 intermediate revisions by the same user not shown)
Line 2: Line 2:


=== Ubuntu/Debian packages ===
=== Ubuntu/Debian packages ===
Openocd 0.5 is a recommendation of the paparazzi-dev package, install it if not already done so. For older distributions (Debian squeeze, Ubunutu Lucid, Maverick and Natty) backported packages are available in the Paparazzi repositories. See [[Installation]].
<tt>openocd</tt> 0.5 is a recommendation of the <tt>paparazzi-dev</tt> package, install it if not already done so. For older distributions (Debian squeeze, Ubunutu Lucid, Maverick and Natty) backported packages are available in the [https://launchpad.net/~paparazzi-uav/+archive/ppa ppa:paparazzi-uav/ppa]. See [[Installation]].
The latest paparazzi-arm-multilib packages also already include gdb for arm.
The latest <tt>paparazzi-arm-multilib</tt> packages also already include gdb for arm.


=== from source ===
=== from source ===
The low level interfacing is done by libftdi, get it from http://www.intra2net.com/de/produkte/opensource/ftdi/ It is possible to use a closed source version from FTDI, too.
==== libftdi ====
The low level interfacing is done by libftdi. The package <tt>libftdi-dev</tt> should already have been installed as a dependency of <tt>paprazzi-dev</tt>.
 
As an alternative you can get it from http://www.intra2net.com/de/produkte/opensource/ftdi/ although this is outdated!
It is possible to use a closed source version from FTDI, too.


  wget http://www.intra2net.com/de/produkte/opensource/ftdi/TGZ/libftdi-0.10.tar.gz
  wget http://www.intra2net.com/de/produkte/opensource/ftdi/TGZ/libftdi-0.10.tar.gz
Line 15: Line 19:
  make install
  make install


Get the OpenOCD software http://openfacts.berlios.de/index-en.phtml?title=Building_OpenOCD It needs some additional packages to be built.
==== OpenOCD ====
Get the OpenOCD software http://openocd.sourceforge.net/ Make sure you have <tt>automake</tt> and <tt>autoconf</tt> installed.


  apt-get install autoconf
  git clone git://openocd.git.sourceforge.net/gitroot/openocd/openocd
apt-get install automake
  cd openocd
apt-get install subversion
svn checkout svn://svn.berlios.de/openocd/trunk
  cd trunk
./bootstrap
  ./configure --enable-ft2232_libftdi
  ./configure --enable-ft2232_libftdi
  make
  make
Line 28: Line 29:


For some debian distributions you might have to add '/usr/local/lib' to /etc/ld.so.conf.d/i486-linux-gnu.conf and call
For some debian distributions you might have to add '/usr/local/lib' to /etc/ld.so.conf.d/i486-linux-gnu.conf and call
ldconfig


ldconfig
== JTAG Debug Configuration ==


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 conf/system/udev/rules). This applies to Amontec JTAG-Tiny.
=== STM32 ===
GDB needs to exactly know the target architecture and OpenOCD currently does not automatically hand GDB all the needed details.
You will need a [https://gist.github.com/1808576 xml file with the target description], save it and load it in your <tt>.gdbinit</tt>:
  set tdesc filename ~/path/to/gdb_cortex_m3_target.xml


add 'BUS=="usb", SYSFS{idVendor}=="0403", SYSFS{idProduct}=="cff8", GROUP="plugdev"'
For lisa/m boards file lisa-m.cfg should look like:
<pre># the Lost Illusions Serendipitous Autopilot
# http://paparazzi.enac.fr/wiki/Lisa
# Work-area size (RAM size) = 64kB for STM32F103RB device
set WORKAREASIZE 0xFA00
source [find target/stm32f1x.cfg]</pre>


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


  #daemon configuration
  #daemon configuration
Line 88: Line 99:
  #continue
  #continue


Get Eclipse 3.2.2  (Debian Etch Eclipse package does not work, there is some problem with JRE 1.4.x)
Read this using the LPC2148 examples: http://www.yagarto.de/howto/yagarto2/index.html
 
wget http://download.eclipse.org/eclipse/downloads/drops/R-3.2.2-200702121330/download.php?dropFile=eclipse-SDK-3.2.2-linux-gtk.tar.gz
tar xvfz eclipse-SDK-3.2.2-linux-gtk.tar.gz
 
Unzip the Eclipse embedded CDT from Zylin for embedded debugging http://www.zylin.com/embeddedcdt.html
 
wget http://www.zylin.com/embeddedcdt-linux-gtk-20060908.zip
wget http://www.zylin.com/zylincdt-20060908.zip
cd eclipse
unzip embeddedcdt-linux-gtk-20060908.zip
unzip zylincdt-20060908.zip
 
Now you have to get used to Eclipse, read this using the LPC2148 examples: http://www.yagarto.de/howto/yagarto2/index.html


[[Category:Software]] [[Category:Developer_Documentation]]
[[Category:Software]] [[Category:Developer_Documentation]]

Latest revision as of 03:37, 7 February 2013

Installation

Ubuntu/Debian packages

openocd 0.5 is a recommendation of the paparazzi-dev package, install it if not already done so. For older distributions (Debian squeeze, Ubunutu Lucid, Maverick and Natty) backported packages are available in the ppa:paparazzi-uav/ppa. See Installation. The latest paparazzi-arm-multilib packages also already include gdb for arm.

from source

libftdi

The low level interfacing is done by libftdi. The package libftdi-dev should already have been installed as a dependency of paprazzi-dev.

As an alternative you can get it from http://www.intra2net.com/de/produkte/opensource/ftdi/ although this is outdated! It is possible to use a closed source version from FTDI, too.

wget http://www.intra2net.com/de/produkte/opensource/ftdi/TGZ/libftdi-0.10.tar.gz
tar xvfz libftdi-0.10.tar.gz
cd libftdi-0.10
./configure
make
make install

OpenOCD

Get the OpenOCD software http://openocd.sourceforge.net/ Make sure you have automake and autoconf installed.

git clone git://openocd.git.sourceforge.net/gitroot/openocd/openocd
cd openocd
./configure --enable-ft2232_libftdi
make
make install

For some debian distributions you might have to add '/usr/local/lib' to /etc/ld.so.conf.d/i486-linux-gnu.conf and call

ldconfig

JTAG Debug Configuration

STM32

GDB needs to exactly know the target architecture and OpenOCD currently does not automatically hand GDB all the needed details. You will need a xml file with the target description, save it and load it in your .gdbinit:

 set tdesc filename ~/path/to/gdb_cortex_m3_target.xml

For lisa/m boards file lisa-m.cfg should look like:

# the Lost Illusions Serendipitous Autopilot
# http://paparazzi.enac.fr/wiki/Lisa
# Work-area size (RAM size) = 64kB for STM32F103RB device
set WORKAREASIZE 0xFA00
source [find target/stm32f1x.cfg]

LPC21xx

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

#daemon configuration
telnet_port 4444
gdb_port 3333

#interface
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

This .gdbinit should start gdb in the correct way for the lpc21xx:

#set directories $cdir:$cwd:../lcds16x2/
set can-use-hw-watchpoints 2
set complaints 33
set history save
set history size 333
set logging on
set output-radix 0x10
set step-mode on
set trust-readonly-sections on
set verbose on
set watchdog 15

target remote localhost:3333
monitor soft_reset_halt
# only for RAM: monitor arm7_9 sw_bkpts enable
monitor arm7_9 force_hw_bkpts enable
hbreak main
#load
#continue

Read this using the LPC2148 examples: http://www.yagarto.de/howto/yagarto2/index.html