Next: , Previous: Developers, Up: Top


2 Building OpenOCD

2.1 Pre-Built Tools

If you are interested in getting actual work done rather than building OpenOCD, then check if your interface supplier provides binaries for you. Chances are that that binary is from some SVN version that is more stable than SVN trunk where bleeding edge development takes place.

2.2 Packagers Please Read!

You are a PACKAGER of OpenOCD if you

  1. Sell dongles and include pre-built binaries
  2. Supply tools i.e.: A complete development solution
  3. Supply IDEs like Eclipse, or RHIDE, etc.
  4. Build packages i.e.: RPM files, or DEB files for a Linux Distro

As a PACKAGER, you will experience first reports of most issues. When you fix those problems for your users, your solution may help prevent hundreds (if not thousands) of other questions from other users.

If something does not work for you, please work to inform the OpenOCD developers know how to improve the system or documentation to avoid future problems, and follow-up to help us ensure the issue will be fully resolved in our future releases.

That said, the OpenOCD developers would also like you to follow a few suggestions:

  1. Send patches, including config files, upstream.
  2. Always build with printer ports enabled.
  3. Use libftdi + libusb for FT2232 support.

2.3 Building From Source

You can download the current SVN version with an SVN client of your choice from the following repositories:

svn://svn.berlios.de/openocd/trunk

or

http://svn.berlios.de/svnroot/repos/openocd/trunk

Using the SVN command line client, you can use the following command to fetch the latest version (make sure there is no (non-svn) directory called "openocd" in the current directory):

      svn checkout svn://svn.berlios.de/openocd/trunk openocd

If you prefer GIT based tools, the git-svn package works too:

      git svn clone -s svn://svn.berlios.de/openocd

Building OpenOCD from a repository requires a recent version of the GNU autotools (autoconf >= 2.59 and automake >= 1.9). For building on Windows, you have to use Cygwin. Make sure that your PATH environment variable contains no other locations with Unix utils (like UnxUtils) - these can't handle the Cygwin paths, resulting in obscure dependency errors (This is an observation I've gathered from the logs of one user - correct me if I'm wrong).

You further need the appropriate driver files, if you want to build support for a FTDI FT2232 based interface:

libftdi is supported under Windows. Do not use versions earlier than 0.14. To use the newer FT2232H chips, supporting RTCK and USB high speed (480 Mbps), you need libftdi version 0.16 or newer.

Some people say that FTDI's libftd2xx code provides better performance. However, it is binary-only, while OpenOCD is licenced according to GNU GPLv2 without any exceptions. That means that distributing copies of OpenOCD built with the FTDI code would violate the OpenOCD licensing terms. You may, however, build such copies for personal use.

To build OpenOCD (on both Linux and Cygwin), use the following commands:

      ./bootstrap

Bootstrap generates the configure script, and prepares building on your system.

      ./configure [options, see below]

Configure generates the Makefiles used to build OpenOCD.

      make
      make install

Make builds OpenOCD, and places the final executable in ./src/, the last step, “make install” is optional.

The configure script takes several options, specifying which JTAG interfaces should be included (among other things):

2.4 Parallel Port Dongles

If you want to access the parallel port using the PPDEV interface you have to specify both the --enable-parport AND the --enable-parport_ppdev option since the --enable-parport_ppdev option actually is an option to the parport driver (see http://forum.sparkfun.com/viewtopic.php?t=3795 for more info).

The same is true for the --enable-parport_giveio option, you have to use both the --enable-parport AND the --enable-parport_giveio option if you want to use giveio instead of ioperm parallel port access method.

2.5 FT2232C Based USB Dongles

There are 2 methods of using the FTD2232, either (1) using the FTDICHIP.COM closed source driver, or (2) the open (and free) driver libftdi. Some claim the (closed) FTDICHIP.COM solution is faster, which is the motivation for supporting it even though its licensing restricts it to non-redistributable OpenOCD binaries, and it is not available for all operating systems used with OpenOCD.

The FTDICHIP drivers come as either a (win32) ZIP file, or a (Linux) TAR.GZ file. You must unpack them “some where” convient. As of this writing FTDICHIP does not supply means to install these files “in an appropriate place”. As a result, there are two “./configure” options that help.

Below is an example build process:

  1. Check out the latest version of “openocd” from SVN.
  2. If you are using the FTDICHIP.COM driver, download and unpack the Windows or Linux FTD2xx drivers (http://www.ftdichip.com/Drivers/D2XX.htm). If you are using the libftdi driver, install that package (e.g. apt-get install libftdi on systems with APT).
              /home/duane/ftd2xx.win32    => the Cygwin/Win32 ZIP file contents
              /home/duane/libftd2xx0.4.16 => the Linux TAR.GZ file contents
    
  3. Configure with options resembling the following.
    1. Cygwin FTDICHIP solution:
                     ./configure --prefix=/home/duane/mytools \
                             --enable-ft2232_ftd2xx \
                             --with-ftd2xx-win32-zipdir=/home/duane/ftd2xx.win32
      
    2. Linux FTDICHIP solution:
                     ./configure --prefix=/home/duane/mytools \
                             --enable-ft2232_ftd2xx \
                             --with-ft2xx-linux-tardir=/home/duane/libftd2xx0.4.16
      
    3. Cygwin/Linux LIBFTDI solution ... assuming that
      • For Windows – that the Windows port of LIBUSB is in place.
      • For Linux – that libusb has been built/installed and is in place.
      • That libftdi has been built and installed (relies on libusb).

      Then configure the libftdi solution like this:

                     ./configure --prefix=/home/duane/mytools \
                             --enable-ft2232_libftdi
      
  4. Then just type “make”, and perhaps “make install”.

2.6 Miscellaneous Configure Options