OpenOCD Config Files

 

This page contains OpenOCD config files created by TinCanTools. OpenOCD reads config files to configure itself for different hardware. OpenOCD is packaged with config files for many devices; the files on this page add support for new devices or replacements for obsolete config files.

 

Installing Config Files

To download a config file from this page, right-click the link and select “Save As.” Save the file somewhere in OpenOCD’s search path. If you’re not sure what directories OpenOCD searches and you compiled OpenOCD yourself, save the config file to the same directory as your OpenOCD executable. If you have installed the OpenOCD Ubuntu Package, save the config file to \usr\local\share\openocd\scripts.

You can run OpenOCD with the script like this:

openocd -f yourconfigfile.cfg -f yourotherfile.cfg

By convention, config files for processors go in a folder called /target, files for target boards go in /board, and files for interface devices go in /interface. Many config files for boards search in \target for the file for their processor, so always save files for processor to /target. You aren’t required to save your config files to \interface or /board, but it may help you keep your files organized. Just remember to include the folder in the file path when you run OpenOCD:

openocd -f interface/yourconfigfile.cfg -f board/yourotherfile.cfg

For a more in-depth discussion of how to use config files and how OpenOCD searches for them, see OpenOCD Config File Paths.

 

Flyswatter Config Files

These files add support for different versions of the TinCanTools Flyswatter. Flyswatter config files usually go in the OpenOCD’s /interface folder, although this is not required.

 

flyswatter2.cfg

This is the config file for the TinCanTools Flyswatter2. OpenOCD does not currently support the Flyswatter2; you will need to compile OpenOCD yourself to use it with the Flyswatter2. This file is included in the OpenOCD 0.5.0 Patch and the OpenOCD 0.4.0 Flyswatter 2/3 Patch.

 

 

Download flyswatter2.cfg
Right-click the link and select “Save As”

 

Full text of flyswatter2.cfg:

 

#
# TinCanTools Flyswatter
#
# http://www.tincantools.com/product.php?productid=16134
#

interface ft2232
ft2232_device_desc "Flyswatter2"
ft2232_layout "flyswatter2"
ft2232_vid_pid 0x0403 0x6010
jtag_khz 15000

 

flyswatter3.cfg

This is the config file for the TinCanTools Flyswatter3. OpenOCD does not currently support the Flyswatter3; you will need to compile OpenOCD yourself to use it with the Flyswatter3. This file is included in the OpenOCD 0.5.0 Patch and the OpenOCD 0.4.0 Flyswatter 2/3 Patch.

 

 

Download flyswatter3.cfg
Right-click the link and select “Save As”

 

Full text of flyswatter3.cfg:

 

# TinCanTools Flyswatter3
# http://www.tincantools.com

interface ft2232
ft2232_device_desc "Flyswatter3"
ft2232_layout "flyswatter3"
ft2232_vid_pid 0x0403 0x6010
jtag_khz 30000

 

flyswatter.cfg with JTAG Clock Speed

This file replaces flyswatter.cfg for the original Flyswatter. The new file sets the JTAG clock speed. This is required for OpenOCD 0.5.0 or any build based on OpenOCD 0.4.0 development code. It is not required for the 0.4.0 release. This file is included in the OpenOCD 0.5.0 Patch.

This file uses the jtag_khz command rather than the new adapter_khz command for compatibility with OpenOCD-0.4.0.

 

 

Download flyswatter.cfg
Right-click the link and select “Save As”

 

Full text of flyswatter.cfg:

 

# TinCanTools Flyswatter
# http://www.tincantools.com/product.php?productid=16134
#
# This revision of flyswatter.cfg adds the jtag_khz line,
# needed by the development version of OpenOCD available at 
# git://openocd.git.sourceforge.net/gitroot/openocd/openocd.

interface ft2232
ft2232_device_desc "Flyswatter"
ft2232_layout "flyswatter"
ft2232_vid_pid 0x0403 0x6010
jtag_khz 6000

 

 

Board Config Files

These files add support for different target boards. Board config files usually go in the OpenOCD’s /board folder, although this is not required.

hammer.cfg

This is the config file for the TinCanTools Hammer board. This is file replaces the hammer.cfg file provided with OpenOCD. It corrects the JTAG Tap Unexpected error with the old hammer.cfg by correctly setting the JTAG tap ID. This file is included in the OpenOCD 0.5.0 Patch.

 

 

Download hammer.cfg
Right-click the link and select “Save As”

 

Full text of hammer.cfg:

 

# Target Configuration for the TinCanTools S3C2410 Based Hammer Module
# http://www.tincantools.com
# This revision is an update for hammer.cfg provided with OpenOCD to
# correctly set CPUTAPID.

set CPUTAPID 0x0032409d
source [find target/samsung_s3c2410.cfg]

$_TARGETNAME configure -event reset-init {
	# Reset Script for the TinCanTools S3C2410 Based Hammer Module
	# http://www.tincantools.com
 	#
 	# Setup primary clocks and initialize the SDRAM
 	mww 0x53000000 0x00000000
 	mww 0x4a000008 0xffffffff
 	mww 0x4a00000c 0x000007ff
 	mww 0x4c000000 0x00ffffff
 	mww 0x4c000014 0x00000003
 	mww 0x4c000004 0x000a1031
 	mww 0x48000000 0x11111122
 	mww 0x48000004 0x00000700
 	mww 0x48000008 0x00000700
 	mww 0x4800000c 0x00000700
 	mww 0x48000010 0x00000700
 	mww 0x48000014 0x00000700
 	mww 0x48000018 0x00000700
 	mww 0x4800001c 0x00018005
 	mww 0x48000020 0x00018005
 	mww 0x48000024 0x009c0459
 	mww 0x48000028 0x000000b2
 	mww 0x4800002c 0x00000030
 	mww 0x48000030 0x00000030
 	flash probe 0
} 
 
 
#flash configuration
#flash bank <name> <driver> <base> <size> <chip_width> <bus_width> <target> [driver_options ...]
set _FLASHNAME $_CHIPNAME.flash
flash bank $_FLASHNAME cfi 0x00000000 0x1000000 2 2 $_TARGETNAME

 

olimex_pic32mx.cfg

This is the config file for the Olimex PIC-P32MX board. This very short file sets the JTAG clock speed and tap ID for the board, then calls the config file for the CPU. The CPU config file target/pic32mx.cfg is provided with OpenOCD. This file is included in the OpenOCD 0.5.0 Patch and the OpenOCD 0.4.0 Flyswatter 2/3 Patch.

This file should be used in place of the pic-p32mx.cfg file provided with OpenOCD.

 

 

Download olimex_pic32mx.cfg
Right-click the link and select “Save As”

 

Full text of olimex_pic32mx.cfg:

 

# Configuration for the Olimex PIC-32MX development board
# Config file supplied by TinCanTools
# http://www.tincantools.com

jtag_khz 15000
set CPUTAPID 0x50916053
source [find target/pic32mx.cfg]

 

 

Target Config Files

Target config files must go in a folder called /target somewhere in OpenOCD’s search path.

amdm37x.cfg

This is the config file for the am37x and dm37x processors, used with the TI Beagleboard XM in the Flyswatter2 Beagleboard XM How To. This file is almost identical to the original amdm37x.cfg file provided with OpenOCD 0.5.0. The only change is to line 32, to support JTAG TAP id 0x2b89102f. This file is included in the OpenOCD 0.5.0 Patch v0.12.

 

 

Download amdm37x.cfg
Right-click the link and select “Save As”

 

 

omap3530_norclk.cfg

OpenOCD sometimes has issues initializing the Beagleboard’s JTAG with the Flyswatter2 adaptive clocking enabled. Adaptive clocking is enabled in the config file omap3530.cfg, called from ti_beagleboard.cfg. This is a modified config file that doesn’t enable adaptive clocking. This file is intended only for use with the Beagleboard. For more information, see Beagleboard Troubleshooting: JTAG Tap Unexpected 0x000000ff.

 

 

Download omap3530_norclk.cfg
Right-click the link and select “Save As”

 

OpenOCD Patches

 

TinCanTools provides patches for the OpenOCD source to add support for the Flyswatter2 and Flyswatter3. These patches also contain config files for use with other guides on this wiki.

Patches on this page are linked directly from the guides on Compiling OpenOCD.

 

Reading the Content of Patches

OpenOCD are created by the Linux program diff. Diff files are in text format. You can see the changes made by a patch on this page by simply opening and reading it in a text editor. Lines added to files are proceeded by a + sign.

The full text of all config files can also be found on the OpenOCD Config Files page.

 

OpenOCD 0.5.0 Patch

Target: OpenOCD 0.5.0 source

Version: b0.11

Format: diff

Description: This patch adds support for the Flyswatter2 and Flyswatter3, updates the config file for the Flyswatter and the Hammer, and adds a new config file for the Olimex PIC-P32MX board.

Install: Save to /openocd-0.5.0, the directory containing the OpenOCD source. Then open a terminal window and type:

$ cd ~/openocd-0.5.0
$ patch -p1 -i Tincantools-openocd-b0.12.patch

 

 

Download Tincantools-openocd-b0.12.patch
Right-click the link and select “Save As”

 

Files Modified:

Files Created:

 

Version Changes
0.12 Added amdm37x.cfg
corrected flyswatter3_init() error messages in ft2232.c
0.11

 

OpenOCD 0.4.0 Flyswatter 2/3 Patch

Target: OpenOCD 0.4.0 source

Version: b0.1

Format: diff

Description: This patch adds support for the Flyswatter2 and Flyswatter3 in OpenOCD 0.4.0, and adds a new config file for the Olimex PIC-P32MX board.

Install: Save to /openocd-0.4.0, the directory containing the OpenOCD source. Then open a terminal window and type:

$ cd ~/openocd-0.4.0
$ patch -p1 -i Openocd-fs3-b0.1.patch

 

 

Download Openocd-fs3-b0.1.patch
Right-click the link and select “Save As”

 

Files Modified:

  • src/jtag/drivers/ft2232.c

Files Created:

 

External Links

diff man page
patch man page

Compiling OpenOCD v04 Win7

This guide will compile OpenOCD 0.4.0 on Windows 7 with the LibFTDI driver library, for use with the TinCanTools Flyswatter. The executable created with this guide is compatible with Windows XP and Windows 7. The process is identical on 32 and 64 bit versions of Windows.

This guide makes use of the GCC cross-compiler added to Cygwin on June 2, 2011. The cross-compiler makes compiling OpenOCD for Windows much easier. Older instructions can be found at Compiling OpenOCD for Windows 7 (LibFTDI) – Pre June 2011.

 

Configuring Windows 7

OpenOCD uses a command line interface and accepts commands from a telnet client. To compile and use OpenOCD in Windows 7 you will need to enable the ‘Run’ command and telnet client. See Configuring Windows 7 for OpenOCD.

 

Installing Cygwin

Download and install Cygwin 1.7.9 from http://www.cygwin.com. Cygwin provides a GNU development environment for Windows, which will allow you to compile OpenOCD using the GNU Compiler Collection (GCC). You will not need Cygwin to run OpenOCD. The Cygwin installer is available at http://cygwin.com/install.html.

Installing Cygwin Packages

If you already have Cygwin installed, this guide recommends that you delete it and reinstall completely. Close all Cygwin windows and services and delete your Cygwin directory (by default, C:\cygwin). Then find any packages downloaded but not installed and delete them as well. You set the location of these files when you installed Cygwin. By default they appear in My Documents/Downloads. If you don’t wish to reinstall Cygwin you can find more information at http://cygwin.com/ml/cygwin/2011-06/msg00021.html.

In the Cygwin installer you will be prompted to select additional packages to install. Install the following optional packages, found under the Devel heading:

 

  • autoconf (all packages)
  • automake (all packages)
  • binutils
  • gcc
  • gcc-core
  • gcc-g++
  • git
  • libtool
  • libusb-1.0
  • libusb-win32
  • libusb-devel
  • make
  • mingw-binutils
  • mingw-gcc
  • mingw-gcc-core
  • mingw-gcc-g++
  • mingw-pthreads
  • mingw-runtime
  • patch (found under the Utils heading)

Check all of these packages and click Next. Cygwin will inform you that it must install additional packages to satisfy the above packages’ dependencies. Allow it to do so. Make sure that the Select Required Packages checkbox is checked before you proceed.

 

Installing libusb for the Flyswatter

Libusb is a usb driver library you will need to communicate with the Flyswatter. You will need a newer version of libusb than the one distributed through the Cygwin installer, and you will need libusb for Windows as well. Download libusb-win32-1.2.4.0 from http://sourceforge.net/projects/libusb-win32/files/libusb-win32-releases/1.2.4.0/libusb-win32-bin-1.2.4.0.zip/download. Open the zip archive and extract the contents to C:\cygwin\home.

Navigate to the folder \libusb-win32-bin-1.2.4.0\lib\gcc. Copy the file libusb.a to C:\cygwin\lib and C:\cygwin\usr\i686-pc-mingw32\sys-root\mingw\lib.

Navigate to \libusb-win32-bin-1.2.4.0\include. Copy the file usb.h to C:\cygwin\usr\include and C:\cygwin\usr\i686-pc-mingw32\sys-root\mingw\include.Plug the Flyswatter into your computer’s USB port. The Windows Found New Hardware Wizard will appear twice, once for each interface. Click Cancel both times.

In Windows Explorer or from the command line, navigate to \libusb-win32-bin-1.2.4.0\bin and run inf-wizard.exe. Click Next from the first screen. You should see a menu with two devices, Flyswatter (Interface 1) and Flyswatter (Interface 0). Select Flyswatter (Interface 1) and click Next twice. You will be prompted to save an .inf file to your hard drive. Click Save. On the next screen, click Install Now. You may see a warning that the driver has not been digitally signed by Microsoft. Click Yes to install anyway.

Now repeat this process for Flyswatter (Interface 0). To see if the install was successful, open the Device Manager (Start Menu > Control Panel > View By: Category > System and Security > System > Device Manager). If the install is successful, you will see two new devices labeled Flyswatter (Interface 0) and Flyswatter (Interface 1).

You may also need to install a libusb Device Filter to use OpenOCD with the Flyswatter. Follow the instructions on the libusb Device Filter page before proceeding.

 

LibFTDI

LibFTDI is an open source FTDI driver you will need to compile OpenOCD. Download libftdi-0.19.tar.gz from http://www.intra2net.com/en/developer/libftdi/download.php, and save it to C:\cygwin\home.

Open the Cygwin command line interface. The default installation will create a shortcut in your start menu, Start Menu > All Programs > Cygwin > Cygwin Bash Shell. Navigate to \home and extract libftdi using gzip:

cd /hometar -zxvf libftdi-0.19.tar.gz

In the Cygwin command console navigate to the folder where you extracted the libFTDI source.

cd /home/libftdi-0.19

Compile with the following commands. Run the first and wait for it to finish, then run the next, and so on:

./configure --build=i686-pc-cygwin --host=i686-pc-mingw32make

In Cygwin or Windows Explorer, navigate to C:\cygwin\home\libftdi-0.19\src. Find the file ftdi.h and copy it to C:\cygwin\usr\i686-pc-mingw32\sys-root\mingw\include. Then in C:\cygwin\home\libftdi-0.19\src\.libs, find the file libftdi.a, and copy it to C:\cygwin\usr\i686-pc-mingw32\sys-root\mingw\lib.

 

A Note about Make Errors

With the latest version of Cygwin and its associated packages you may encounter errors with make commands. You may be able to fix these errors simply by powering through; if make gives an error, run make again. If it doesn’t halt again in the same place, you can likely proceed without worry.

You may also encounter errors with the bootstrap command used to compile OpenOCD below. Try running bootstrap again. If it passes the point where it previously halted everything is most likely fine.

 

Downloading OpenOCD

Download the OpenOCD 0.4.0 source from http://prdownload.berlios.de/openocd/openocd-0.4.0.zip and extract it to /home/openocd-0.4.0.

 

Installing the Flyswatter 2 / Flyswatter 3 Patch (Optional)

The OpenOCD Flyswatter 3 beta patch provides support for the Flyswatter3 and Flyswatter2, a config file for the Olimex PIC-P32MX development board, and an updated config file for the TinCanTools Hammer. Download the file Media:Openocd-fs3-b0.1.patch. (Right click the link and select Save As.) Save the file to your new openocd-0.4.0 directory.

In the Cygwin console window, navigate to the patch file and patch the source as follows:

cd ~/openocd-0.4.0patch -p1 -i Openocd-fs3-b0.1.patch

For more information on the config files added by this patch, see OpenOCD Config Files.

 

Compiling OpenOCD

In the Cygwin command window, navigate to the new folder containing the OpenOCD source and compile as follows.

cd /home/openocd-0.4.0./configure --disable-werror --enable-ft2232_libftdi --build=i686-pc-cygwin --host=i686-pc-mingw32make

 

Preparing to Run OpenOCD

Navigate to C:\cygwin\home\openocd\src to find openocd.exe. The executable can be run from the Windows command line and does not require Cygwin.

You can run openocd from C:\cygwin\home\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 folder containing OpenOCD and its config files. Go to Start Menu > My Computer and open your C: drive. Right-click anywhere in the C: drive window and select New > Folder. Rename the new folder openocd-bin.

In another Windows Explorer window, open C:\cygwin\home\openocdcl. Click and drag to select all the contents of the folder. Right-click on any file and select Copy. Open C:\openocd-bin, right-click anywhere, and select Paste.

Now go to C:\cygwin\home\openocd\src and copy openocd.exe to C:\openocd-bin. The folder should now contain the following files and folders:

boardchipcpldcpuopenocd.exeinterfacetargettestbitsbytes.tclmemory.tclmmr_helpers.tclreadable.tcl

You can now run OpenOCD from C:\openocd-bin. To get started running OpenOCD, see Running OpenOCD on Windows.

OpenOCD Ubuntu Package

As an alternative to compiling OpenOCD from source, OpenOCD is available via Ubuntu’s Advanced Packaging Tool (APT). Ubuntu 10.04 users can download and install OpenOCD using the apt-get command.

 

Flyswatter2 Support

This package is based on the OpenOCD 0.4.0 release available at http://prdownload.berlios.de/openocd/openocd-0.4.0.tar.gz. It does not include support for the TinCanTools Flyswatter2. To compile OpenOCD with Flyswatter2 support, see Compiling OpenOCD Linux for Flyswatter2.

 

Installing the OpenOCD Package

Open a terminal window (Applications menu > Accessories > Terminal) and type:

sudo apt-get install openocd

The Ubuntu APT will install OpenOCD and its config files to your computer. As with any command using sudo, you will need an administrator password to run this command.

 

Linking to /usr/share/openocd

The package installs config files to /usr/share/openocd/scripts, but OpenOCD looks for config files in /usr/local/share/openocd/scripts. Fix that now by creating a symbolic link in /usr/local/share to /usr/share/openocd. In the terminal window, type:

cd /usr/local/share
sudo ln -s /usr/share/openocd .

OpenOCD will now be able to find its config files. For more information on how OpenOCD searches for config files, see OpenOCD Config File Paths.

 

Running OpenOCD

You can run OpenOCD from a terminal window from any directory. Installing OpenOCD from the APT allows users to run OpenOCD without sudo. (If you compiled OpenOCD yourself you would need to take special steps to allow users to use OpenOCD without sudo.

In a terminal window, type:

openocd -f path_to/file.cfg [-f another_path_to/file2.cfg]

For example, to run OpenOCD for the TinCanTools Flyswatter and Hammer, type:

openocd -f interface/flyswatter.cfg -f board/hammer.cfg

To get started, see Running OpenOCD on Linux. If you encounter errors, see OpenOCD Troubleshooting.

OpenOCD

OpenOCD (Open On-Chip Debugger) is open-source software that interfaces with the Flyswatter’s JTAG port. OpenOCD provides debugging and in-system programming for embedded target devices. OpenOCD provides the ability to flash NAND and NOR FLASH memory devices that are attached to the processor on the target system. Flash programming is supported for external CFI compatible flashes (Intel and AMD/Spansion command set) and several internal flashes (LPC2000, AT91SAM7, STR7x, STR9x, LM3 and STM32x).

OpenOCD supports the following cores:

CORE TYPE EXAMPLE PROCESSORS
ARM7TDMI LPC2148, AT91SAM7
ARM720T LH79520, EP7312
ARM9TDMI
ARM920T S3C2410, S3C2440
ARM922T
ARM926EJS S3C2412, STN8811, STN8815
ARM966E STR91XF
ARM11 S3C6400, OMAP2420, MSM7200
ARM1136
ARM1156
ARM1176
CORTEX-M3 LM3S series, STM32 series
CORTEX-A8 OMAP3530 BeagleBoard
CORTEX-A8 DM3730 BeagleBoard-xM
CORTEX-A9 OMAP4430 PandaBoard
XSCALE PXA255, PXA270, IXP42X
MARVEL FEROCEON CPU CORE
MIPS M4K

OpenOCD was originally developed by Dominic Rath at the University of Applied Sciences Augsburg. The OpenOCD source code is now available through the GNU General Public License (GPL).

Installing OpenOCD

Compiling OpenOCD

OpenOCD Ubuntu Package

OpenOCD Patches

OpenOCD Config Files

 

Running OpenOCD

Running OpenOCD on Linux

Running OpenOCD on Windows

OpenOCD Troubleshooting

 

External Links

OpenOCD website: http://openocd.sourceforge.net/

OpenOCD source: http://sourceforge.net/projects/openocd/files/openocd/0.7.0/openocd-0.7.0.tar.gz/download

GNU GPL (OpenOCD license): http://www.gnu.org/licenses/gpl.html