Bus Pirate: OpenOCD

From Embedded Lab Vienna for IoT & Security
Revision as of 09:47, 30 January 2020 by Jostrowski (talk | contribs) (typo)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Summary

Open On-Chip Debugger (OpenOCD) software was created by Dominic Rath at the University of Applied Sciences Augsburg. The goal of this software is to provide debugging tools for a lot of different debugging adapters and platforms. It has a scripting language that allows creating configuration files for e.g. custom JTAG adapters or target platform.

This tutorial is an updated version to [1]

Requirements

  • OS: Linux

In order to complete these steps, you must have followed Bus Pirate: First steps before.

In order to use OpenOCD on the Bus Pirate you need a firmware version of 6+

Installation

Download OpenOCD
git clone https://github.com/arduino/OpenOCD.git
Install dependencies for the OpenOCD build:
sudo apt-get install autotools-dev
sudo apt-get install automake
Compile code
cd OpenOCD
./bootsrap
./configure --enable-maintainer-mode --disable-werror --enable-buspirate
make
sudo make install
Configure OpenOCD's buspirate.cfg
nano tcl/interface/buspirate.cfg
#
# Buspirate with OpenOCD support
#
# http://dangerousprototypes.com/bus-pirate-manual/
#
interface buspirate
# you need to specify port on which BP lives
buspirate_port /dev/ttyUSB0                     (select the correct PORT!!!)
# communication speed setting
buspirate_speed normal ;# or fast
# voltage regulator Enabled = 1 Disabled = 0
buspirate_vreg 0
# pin mode normal or open-drain
buspirate_mode open-drain
# pullup state Enabled = 1 Disabled = 0
buspirate_pullup 1
# this depends on the cable, you are safe with this option
reset_config srst_only
Connect Bus Pirate and OpenOCD
Connect the Bus Pirate to the computer
Start OpenOCD
cd OpenOCD
sudo openocd -f tcl/interface/buspirate.cfg
(Errors might appear)
$ sudo openocd -f tcl/interface/buspirate.cfg              
Open On-Chip Debugger 0.10.0-rc1-dev-gc404ff5d-dirty (2019-11-11-15:43)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
Warn : Adapter driver 'buspirate' did not declare which transports it allows; assuming legacy JTAG-only
Info : only one transport option; autoselect 'jtag'
srst_only separate srst_gates_jtag srst_open_drain connect_deassert_srst
Info : Buspirate Interface ready!
Info : This adapter doesn't support configurable speed
Warn : There are no enabled taps.  AUTO PROBING MIGHT NOT WORK!!
Error: JTAG scan chain interrogation failed: all ones
Error: Check JTAG interface, timings, target power, etc.
Error: Trying to use configured scan chain anyway...
Warn : Bypassing JTAG setup events due to errors
Warn : gdb services need one or more targets defined
Start OpenOCD session
Open a new terminal tab
type: telnet localhost 4444
The OpenOCD terminal should open
Type help for all possible operations

Used Hardware

Bus Pirate v3.6 Universal serial interface

References