This is an old revision of the document!

Install openOCD

Download Debian Package

First and recommended way to install is to install the debian package.

sudo apt-get install openocd
Build it yourself

If you need the newest version of openOCD you should build the source yourself. Download Source from sourceforge page:

git clone git://git.code.sf.net/p/openocd/code openocd-code

later moreā€¦.

How to use openOCD

First of all, you should download the official openOCD User's Guide:


You can find actually all information you need there. I will give you a quickstart guide here.

You can use openOCD with various hardware, so you have to tell openOCD which one you are actually using. This is done with some special Configuration Files. Overall you need three of these files:

* interface config file descripes which hardware debugger you are using * board config file descripes which kind of board you are using * target config files descripes which microcontroller you are using

You can find a lot of configuration files for specific hardware there:

cd /usr/share/openocd/scripts

Here are the interface config files (e.g. jlink.cfg)

ls interface

Here are the board config files (e.g. pic-p32mx.cfg)

ls board

Here are the target config files (e.g. pic32mx.cfg)

ls target

Now you have to find the right config files for your devices. If you don't find the config file for your device, you should have a look into the official OpenOCD User's Guide. There are many design rules for these files.

If you had find suitable files for your hardware you can start programming the flash of your target.

openocd -f interface/ADAPTER.cfg -f board/MYBOARD.cfg -c "program filename.elf verify reset"

verify and reset are optional parameters, for verifying the flash after programming and reseting the hardware.

filename.elf is the excecutable, which should be cross-compiled for the target hardware.

Now, the board should allready execute your program.

  • dt_openocd.1392058376.txt.gz
  • Last modified: 2014/02/10 19:52
  • (external edit)