Installing OpenOCD from source

1 minute read


This is a short tutorial for installing latest version of OpenOCD from source. Moreover, we also install ftdi library which is important if you are going to use flyswatter2 as JTAG adapter for OpenOCD.

Install the build tools

Installing tools that will help us build ftdi library from source.

sudo apt-get install build-essential
sudo apt-get install git-core
sudo apt-get install cmake
sudo apt-get install doxygen

Install dependencies

These dependencies are used by ftdi and should be installed before diving into ftdi source.

sudo apt-get install libusb-1.0-0-dev
sudo apt-get install libconfuse-dev
sudo apt-get install swig python-dev
sudo apt-get install libboost-all-dev

Installing FTDI library

  • Now download the latest FTDI source code from: For me, it was libftdi1-1.4.tar.bz2.

  • Run the following commands for building ftdi library.

    cd ~/libftdi1-1.4
    mkdir build
    cd build
    cmake  -DCMAKE_INSTALL_PREFIX="/usr" ../
    sudo make install

Downloading and installing OpenOCD

Now that we have installed ftdi library, we move forward to building OpenOCD from source.

cd ~
git clone openocd-code
cd openocd-code/
sudo ./bootstrap
sudo ./configure --enable-maintainer-mode --disable-werror --enable-ft2232_libftdi
sudo make
sudo make install

Preparing to run OpenOCD

These commands help us to create a separate openocd-bin directory which is used for running OpenOCD.

cd ~
mkdir openocd-bin
cd openocd-code/tcl
cp -r * ~/openocd-bin
cd ~/openocd-code/src
cp openocd ~/openocd-bin

You can now run OpenOCD from /home/USERNAME/openocd-bin