OpenOCD - matianfu/survivor GitHub Wiki
Introduction
OpenOCD is a software package supporting the hardware debug probe or debuggers (some people prefer the old name 'emulator').
It supports JLINK, ST-Link, which we are mostly interested in for MCUs.
It also supports TI xds100v2 debugger. This hopefully provides another debugging tool choice other than TI Code Composer Studio.
Compilation of OpenOCD
This page lists many references
Reference for compiling OpenOCD:
http://elinux.org/Compiling_OpenOCD
And specifically for OpenOCD v0.7.0 for Ubuntu 13.04
http://elinux.org/Compiling_OpenOCD_v0.7.0_on_Ubuntu_13.04
Prerequisite: USB library (user space library, not the driver, the OS provides the driver)
First of all, OpenOCD requires user space USB library (built on top of libusb so libusb-dev package is a prerequisite) to work with debuggers with FTDI chips (such as AM335x/XDS100v2).
Users have the choices to choose between the proprietary FTD2xx or the open source libftdi. The latter is preferred and recommended by the open source community (of course!) because there is no copyright issue when you (re-)distribute it.
Here is a detailed description: http://elinux.org/Libftdi_vs_FTD2XX
In the "Compiling OpenOCD v0.7.0 on Ubuntu" guide above, libftdi compilation is mentioned but outdated. New instructions are here:
Download page: http://www.intra2net.com/en/developer/libftdi/download.php
As the time of writing the latest version is libftdi1-1.1.tar.bz2
http://www.intra2net.com/en/developer/libftdi/download/libftdi1-1.1.tar.bz2
After download and untar, there is a README file shows how to build (quickly).
cmake package is required on ubuntu
sudo apt-get install cmake
build commands:
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX="/usr" ../
make
sudo make install
git repository git://git.code.sf.net/p/openocd/code
bootstrap ./bootstrap .... Submodule 'jimtcl' (http://repo.or.cz/r/jimtcl.git) registered for path 'jimtcl' Submodule 'tools/git2cl' (http://repo.or.cz/r/git2cl.git) registered for path 'tools/git2cl' ....
configure
--enable-mantainer-mode (as is)
--enable-ft2232, this is suggested by build system. original --enable-ft2232_libftdi will raise complaints. The solution is either to use this option, or use --enable-legacy-ft2232_libftdi option, if you already build and installed the libftdi on your system. But this is not required if you use the recommended --enable-ft2232 option. It seems that the newer version of OpenOCD has the built-in support for ftdi chips.
--disable-werror, not used and no problem.
./configure --enable-maintainer-mode --enable-ft2232
....
OpenOCD configuration summary
--------------------------------------------------
MPSSE mode of FTDI based devices yes (auto)
ST-Link JTAG Programmer yes (auto)
TI ICDI JTAG Programmer yes (auto)
Keil ULINK JTAG Programmer yes (auto)
Altera USB-Blaster II Compatible yes (auto)
Versaloon-Link JTAG Programmer yes (auto)
Segger J-Link JTAG Programmer yes (auto)
OSBDM (JTAG only) Programmer yes (auto)
eStick/opendous JTAG Programmer yes (auto)
Andes JTAG Programmer yes (auto)
USBProg JTAG Programmer yes (auto)
Raisonance RLink JTAG Programmer yes (auto)
Olimex ARM-JTAG-EW Programmer yes (auto)
CMSIS-DAP Compliant Debugger no
make and install
>make
>sudo make install