Alberto Embedded & Open experience

Notes on my experience on Open Source Embedded Systems

OpenOCD with Amontec JtagKey2 support

leave a comment »

Recently I bought an Amontec JtagKey-2 debug probe for my embedded projects. This Jtag probe have great features over a relative little buying cost: over other low cost Jtag probes, this one supports the RTCK signal and nominal speeds are really interesting.

What this post will describe is how to setup a useful JTAG debug environment:


The JtagKey2 is based on FTDI FT2232 usb interface. Drivers for this chip can be found here:

Choose your arch (for me Linux x86_64) and  download the archive in  $PRJROOT/openocd.

$ cd $PRJROOT/openocd
$ tar -xvf libftd2xx0.4.16_x86_64.tar.gz


OpenOCD can be downloaded from its public git repository:

$ git clone git:// openocd

Then, move to the opnocd directory and configure with:

$ cd openocd
$ ./bootstrap
$ # If you need, choose the right prefix with --prefix=DIR
$ ./configure --enable-maintainer-mode --enable-ft2232_ftd2xx \
$ # n: Numbers of cores in your machine
$ make -j n

At this point the OpenOCD build process fire a linker error, this because  libtool mess up the library order when linking main.c so, let we do the right command:

$ cd src/

$ gcc -std=gnu99 -g -O2 -I/media/dati/android/openocd/libftd2xx0.4.16_x86_64 \
  -Wall -Wstrict-prototypes -Wformat-security -Wextra -Wno-unused-parameter \
  -Wbad-function-cast -Wcast-align -Wredundant-decls -Werror \
  -o openocd main.o ./.libs/libopenocd.a \
  /media/dati/android/openocd/libftd2xx0.4.16_x86_64/static_lib/libftd2xx.a.0.4.16 \
  -ldl -lpthread
$ cd ..
$ make -j 6

And at the end, install:

$ sudo make install

Using OpenOCD

OpenOCD is completely configurable: the server must be started with a number of “-f ” options that points to the necessaries configuration files.
Normally must be given two configuration files: The interface config and a board config.
So OpenOCD can be started with:

$ sudo openocd -f interface/jtagkey2.cfg -f board/your_board.cfg

We have to use sudo because of permissions needs on using an usb device, otherwise an udev rule must be set.


Written by Alberto!

16/03/2010 at 12:11 pm

Posted in linux-arm

Tagged with ,

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: