Compiling OpenOCD v04 WinXP D2XX

This guide will compile OpenOCD 0.4.0 on Windows XP with the FTD2XX 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 XP (FTD2XX) – Pre June 2011.

 

 

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.

 

Installing FTD2XX

Download version 2.08.14 of the D2XX Windows drivers from http://www.ftdichip.com/Drivers/D2XX.htm. Direct link is here: http://www.ftdichip.com/Drivers/CDM/CDM20814_WHQL_Certified.zip. Extract the contents to C:\cygwin\home\ftd2xx.

In Windows Explorer, open the ftd2xx folder and find the file ftd2xx.h. Copy this file to C:\cygwin\usr\include and C:\cygwin\usr\i686-pc-mingw32\sys-root\mingw\include.

Installing FTD2XX

Navigate to C:\cygwin\home\ftd2xx\i386 and find the file ftd2xx.lib. Copy it, rename the copy ftd2xx.a and copy the new file to C:\cygwin\usr\local\lib and C:\cygwin\usr\i686-pc-mingw32\sys-root\mingw\lib.

Plug the Flyswatter into your computer’s USB port. The Windows Found New Hardware Wizard should appear. Choose “No, not this time” to decline to connect to Windows Update. On the next screen, choose “Install from a list of specific location.” On the third screen, choose “Search for the best drivers in these locations,” check “Include this location in the search,” and enter C:\cygwin\home\ftd2xx.

Click Next. Windows should find and install the FTDI drivers. If you see a warning that the drivers have not passed Windows Logo testing, choose “Install Anyway.”

The Found New Hardware Wizard should appear twice. The second time the wizard appears, repeat the process exactly as above.

 

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_ftd2xx --with-ftd2xx-win32-zipdir=../ftd2xx --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.

Running OpenOCD on Linux

This guide contains general information on running OpenOCD, but all examples use the Hammer. For examples using the Beagleboard, see Running OpenOCD on Linux with the Beagleboard.

OpenOCD provides a command line interface for interacting with embedded devices. To use OpenOCD you will need to run it from the command line. This guide includes basic information about using the Ubuntu command line interface, the terminal window. If you are already proficient with the command line, you can find information specific to OpenOCD under the OpenOCD Config Files and Telnet Connection headings.

This guide was written for the Ubuntu 10.04 LTS release. You may encounter differences on other Linux distributions.

 

Opening the Command Prompt

Open the Applications menu from the menu bar on your desktop, and choose Accessories > Terminal. Ubuntu should open black window with white text and a prompt.

 

Command Prompt Basics – Paths and Navigation

The command prompt displays your current directory location. You will need to navigate to the OpenOCD directory to run it. To change directories, type ‘cd followed by a file path. File paths can be absolute…

cd /home
cd /usr/local/lib

…or relative…

cd lib/mingw
cd TinCanTools/openocd

Absolute paths are from your root directory, and begin with a slash. Relative paths are from the current directory and do not begin with a slash. File paths are case sensitive.

If you need to navigate to your home directory, type cd by itself like this…

cd

If you need to go back to the parent of the current directory, you can type…

cd ..

You can even use this as part of a longer relative path. For example…

cd ../../TinCanTools

…would take you up two levels, and then into a folder called TinCanTools.

To reach your root directory, you can type:

cd /

If you need to include your home directory in a path (home/USERNAME, replacing USERNAME with the name of your account), you can type it out as normal, or you can use the tilde key (~) as shorthand. For example:

cd /home/USERNAME/TinCanTools
cd ~/TinCanTools

…both take you to the same place.

 

Running OpenOCD

Navigate to the directory containing your openocd executable. In the folder with the executable, make sure you also see three directories called interface/, board/, and target/. If you don’t see these directories, create a new folder somewhere on your computer containing openocd, interface/, board/, and target/. (If you have just compiled OpenOCD yourself, you can find the executable in openocd/src or openocd-0.5.0/src, and the three directories you need in openocd/tcl or openocd-0.5.0/tcl.

In the directory containing the openocd executable, type…

sudo openocd -f path_to/cfg_file [-f path_to/other_cfg_file]

Replace path_to/cfg_file and so on with the .cfg files for your hardware devices. For example, to run OpenOCD for the Flyswatter2 and the hammer, you would use:

sudo openocd -f interface/flyswatter2.cfg -f board/hammer.cfg

For the original Flyswatter and the Beagleboard, you would use:

sudo openocd -f interface/flyswatter.cfg -f board/ti_beagleboard.cfg

See below for more information on config files.

 

Telnet Connection

OpenOCD runs as a daemon. It accepts connections from other programs, but does not provide any means for you to give it commands directly. Once OpenOCD is running on your computer you will need to connect to it through another program, such as telnet.

To run telnet and connect to OpenOCD, open a new command prompt. From any directory, type:

telnet localhost 4444

You may need to run telnet as root:

sudo telnet localhost 4444

You should see a simple prompt (>). From this prompt you will be able to send commands to OpenOCD. To exit the telnet prompt, press CTRL + C.

 

OpenOCD and Permissions

OpenOCD needs administrator privileges to interact with your USB drivers. Even Linux users with administrator privileges do not typically log on with those privileges active. However, Linux provides commands to run another command as the root user. On Ubuntu, this command is sudo. To run a program as root, type sudo, then a space, then the name of the program. For example…

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

…runs OpenOCD with your user permissions, and likely prevents OpenOCD from interacting with libUSB. However…

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

…runs OpenOCD as root, with full permission to access your USB drivers.

When you use the sudo command, Linux will prompt you for the root user’s password. If you do not have access to this password, contact your system administrator. You can also configure Linux to allow OpenOCD to access specific hardware devices without sudo. See Accessing Devices without Sudo.

 

Search Path

OpenOCD searches in its own directory first for config files. This guide assumes that the openocd binary is in a directory containing three folders, called interface/, board/, and target/. If you have just compiled OpenOCD yourself, you will need to move the openocd executable somewhere where it can find interface/, board/, and target, as described in the compilation guides on this page.

You can also tell OpenOCD where to look for interface/, board/, and target/ with the -s flag, like this:

sudo openocd -s ../tcl -f interface/flyswatter.cfg -f board/hammer.cfg

This would tell OpenOCD to look for interface/ and board/ one level up in a directory called tcl/. For more information, see OpenOCD Config File Paths.

 

OpenOCD Config Files

Each time you use OpenOCD you will need to configure it by passing it paths to configuration files. In the OpenOCD 0.5.0 release, these files are found in openocd-0.5.0/tcl and its subdirectories. From the tcl directory, the configuration file for the Flyswatter is at interface/flyswatter.cfg. The file for the TinCanTools Hammer is at board/hammer.cfg. If your copy of OpenOCD includes support for the Flyswatter2, its config file is at interface/flyswatter2.cfg.

When you start OpenOCD, you tell it to use the config files for your hardware with the -f switch, like this:

sudo openocd -f path_to/cfg_file [-f path_to/other_cfg_file]

For example, suppose you want to run OpenOCD for the Flyswatter2 and the Hammer. The current directory contains the OpenOCD executable and the board, interface, and target directories provided with the OpenOCD source. You would type:

sudo openocd -f interface/flyswatter2.cfg -f board/hammer.cfg

Be aware that config files may contain paths to other config files. For example hammer.cfg, the config file for the TinCanTools Hammer, contains this line:

source [find target/samsung_s3c2410.cfg]

When you run OpenOCD with the hammer.cfg file, OpenOCD searches from the current directory for target/samsung_s3c2410.cfg. If the current directory does not contain OpenOCD‘s target directory, it may not find the samsung_s3c2410.cfg file, or it may find a different samsung_s3c2410.cfg file elsewhere on your system. You can avoid this by giving OpenOCD the path to your config files. For more information, see OpenOCD Config File Paths.

If you have compiled OpenOCD yourself, the easiest way to avoid these issues is to copy the openocd binary from your openocd-0.5.0/src directory to your openocd-0.5.0/tcl directory. To run OpenOCD, navigate to openocd-0.5.0/tcl in the command terminal and run OpenOCD as above. You can also create a new directory anywhere on your system, and copy the openocd binary and the contents of openocd-0.5.0/tcl to the new directory.

 

Running Commands on Startup: the -c Flag

You can instruct OpenOCD to run a command on startup with the -c flag. For example:

sudo openocd -f interface/flyswatter.cfg -c "jtag_khz 6000" -f board/hammer.cfg

The jtag_khz command sets the Flyswatter’s clock speed. Starting OpenOCD like this does the following, in order:

  • run commands in flyswatter.cfg
  • run the OpenOCD command to set the Flyswatter’s clock speed
  • run commands in hammer.cfg (which loads samsung_s3c2410.cfg and runs commands found there)

Compiling OpenOCD WinXP D2XX

This guide will compile OpenOCD 0.5.0 on Windows XP with the FTD2XX 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 XP (FTD2XX) – Pre June 2011.

 

 

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.

 

Installing FTD2XX

Download version 2.08.14 of the D2XX Windows drivers from http://www.ftdichip.com/Drivers/D2XX.htm. Direct link is here: http://www.ftdichip.com/Drivers/CDM/CDM20814_WHQL_Certified.zip. Extract the contents to C:\cygwin\home\ftd2xx.

In Windows Explorer, open the ftd2xx folder and find the file ftd2xx.h. Copy this file to C:\cygwin\usr\include and C:\cygwin\usr\i686-pc-mingw32\sys-root\mingw\include.

Installing FTD2XX

Navigate to C:\cygwin\home\ftd2xx\i386 and find the file ftd2xx.lib. Copy it, rename the copy ftd2xx.a and copy the new file to C:\cygwin\usr\local\lib and C:\cygwin\usr\i686-pc-mingw32\sys-root\mingw\lib.

Plug the Flyswatter into your computer’s USB port. The Windows Found New Hardware Wizard should appear. Choose “No, not this time” to decline to connect to Windows Update. On the next screen, choose “Install from a list of specific location.” On the third screen, choose “Search for the best drivers in these locations,” check “Include this location in the search,” and enter C:\cygwin\home\ftd2xx.

Click Next. Windows should find and install the FTDI drivers. If you see a warning that the drivers have not passed Windows Logo testing, choose “Install Anyway.”

The Found New Hardware Wizard should appear twice. The second time the wizard appears, repeat the process exactly as above.

 

 

Downloading OpenOCD

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

 

Patching OpenOCD

The OpenOCD Flyswatter 3 beta patch provides support for the Flyswatter3 and Flyswatter2 and updated config files for the original Flyswatter, the TinCanTools Hammer, and the Olimex PIC-P32MX board. Download the file Media:Tincantools-openocd-b0.12.patch. (Right click the link and select Save As.) Save the file to your new openocd-0.5.0 directory.

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

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

Even if you do not need Flyswatter3 or Flyswatter2 support, you will need the updated config files in this patch to use the Flyswatter with OpenOCD-0.5.0. If you do not wish to install the patch you can download the config files individually from 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.5.0./configure --disable-werror --enable-ft2232_ftd2xx --with-ftd2xx-win32-zipdir=../ftd2xx --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 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

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