There should now be a folder in your home directory called '''openocd/.'''

There should now be a folder in your home directory called '''openocd/.'''

−

==Compiling OpenOCD==

==Compiling OpenOCD==

Revision as of 19:09, 16 November 2012

This guide will compile OpenOCD {{{3}}} for Ubuntu 10.04 with the {{{{{2}}}_NAME_CAPS}} driver library, for use with the TinCanTools Flyswatter, Flyswatter2, and Flyswatter3. Version {{{3}}} is the version of OpenOCD currently in development. For instructions on compiling with the most recent release code, see Compiling OpenOCD Linux.

Contents

OpenOCD 0.6.0 vs the 0.5.0 Release

This guide uses the most recent version of the OpenOCD source currently in development. Unlike the 0.5.0 release the development version includes support for the Flyswatter2 and Flyswatter3, so you won't need to download or apply a patch before compiling. However, the development code is subject to change at any time. If you encounter problems with this option, try the OpenOCD 0.5.0 instructions in Compiling OpenOCD Linux instead.

Installing Packages

You will need to install several packages to compile and run OpenOCD. Open a terminal window (Applications menu > Accessories > Terminal) and type:

Downloading and Compiling libFTDI

libFTDI is an open source library that enables you to talk to FTDI chips like: FT232BM, FT245BM, FT245R, FT2232C, FT2232D and FT2232H. You will need libFTDI to compile OpenOCD. Download libftdi-{{{{{2}}}_VERNUM}}.tar.gz from:
http://www.intra2net.com/en/developer/libftdi/download.php
and extract it to your home directory (/home/USERNAME, replacing USERNAME with your username).

Navigate to home/USERNAME/libftdi-{{{{{2}}}_VERNUM}}/src, and copy ftdi.hto your /usr/include directory. Then create a symbolic link to ftdi.h in /usr/local/include. In the terminal window:

Downloading OpenOCD

Git is version control software distributed with Ubuntu. You can use git to download the current development code from the OpenOCD git repository at sourceforge.net. In the terminal window, navigate to your home directory and make sure you don't already have a directory there named openocd/. (Downloading with git will create a directory called openocd/ containing the OpenOCD source. If you already have a directory called openocd/ either rename it or navigate to a different directory before you proceed.) Then download OpenOCD with the following command:

Navigate to /home/USERNAME/openocd/src to find the openocd binary. You will need superuser privileges (the sudo command) to run OpenOCD.

Preparing to Run OpenOCD

You can run openocd from /home/USERNAME/openocd/src, but you may encounter problems with configuration files. For a more in-depth discussion of these issues, see OpenOCD Config File Paths. This guide recommends that you create a new directory containing OpenOCD and its config files.

Create a new directory in /home/USERNAME called openocd-bin, and copy the openocd binary and the contents of /home/USERNAME/openocd/tcl to the new directory. You can do this from the terminal window with the collowing commands: