http://www.openplug.org/plugwiki/index.php/Build_OpenOCD
Build OpenOCD
From PlugWiki
1. OpenOCD Linux (version = 0.2.0)
a. Change to working directory (cd ~/work/)
b. Install libusb libraries: sudo aptitude install libusb-dev
c. Download libftdi library
1) Download the open source from [1] 2) Unpack it to your working directory (tar -czf libftdi-0.16.tar.gz)
d. Build libftdi library
1) Run the commands - a) cd libftdi-0.16 b) ./configure --prefix=/usr c) make d) sudo make install
e. Download OpenOCD
1) Change to working directory (cd ~/work/) 2) Download open OCD from [2]
f. Build the OpenOCD
1) Change to working directory (cd ~/work/openocd-<version>) 2) Run the commands - a) ./configure --enable-ft2232_libftdi b) make 5) You should have in the ~/work/openocd-<version>/src/ directory a binary named openocd.
OpenOCD Windows (version = 0.2.0)
a. Install Cygwin
1) install Cygwin from: http://www.cygwin.com/setup.exe 2) Select the install from internet 3) Use default installation path: c:/cygwin 4) Pick the Local Package Directory (this is the download cache directory) 5) Select Direct Connection 6) Select the mirror you want to use 7) In the package selection click the plus sign on the left hand of the Devel category and install the following packages (by clicking the circled arrows till you see a check box in the Bin? column): 1) gcc4 2) make 3) boost (click on the Src checkbox too) 4) libusb-win32 (click on the Src checkbox too) 5) boost-devel (click on the Src checkbox too) and press the Install button and then the Finish button 8) For the above packages, Make sure that the boost directory is in the /usr/include directory
b. Cygwin working directory
1) Create a Cygwin working directory; be sure not to place it in a path that includes spaces! (my example working path is C:/cygwin/work) 2) From this point on, references to directories are from within Cygwin console (note that paths differ between windows file browser and Cygwin console)
c. Build libftdi support to OpenOCD
1) Download the latest driver for windows from: [3] 2) Unpack the libftdi-0.16.tar.gz file into C:/cygwin/work/libftdi-0.16 3) Open the Cygwin console (via the desktop shortcut or start menu) and change directory to the work directory we created ($ cd /cygdrive/c/work) 4) Run the commands - a) cd libftdi-0.16 b) ./configure --prefix=/usr 5) Edit the Makefile, change the following line: from: SUBDIRS = src bindings $(LIBFTDI_MODULES) examples doc to: SUBDIRS = src bindings $(LIBFTDI_MODULES) 6) Run the commands - d) make e) make install
d. Download OpenOCD
There are two option to get the source: 1) SVN snapshot: a. Open the Cygwin console (via the desktop shortcut or start menu) and change directory to the work directory we created ($ cd /cygdrive/c/work) b. Run the command svn checkout svn://svn.berlios.de/openocd/trunk trunk If behind firewall try svn checkout http://svn.berlios.de/svnroot/repos/openocd/trunk 2) Latest release based from [4]
e. Build the OpenOCD
1) If svn based, rename the trunk directory to the version of OpenOCD you downloaded and change to that directory (/cygdrive/c/cygwin/work/openopcd-<version>) 2) Open the Cygwin console 3) Run the commands: a) export CFLAGS=-D__NO_INLINE__ b) ./configure --enable-ft2232_libftdi --disable-werror c) Edit the Makefile, change the following line: from: SUBDIRS = src doc to: SUBDIRS = src d) And run make e) You should have in the cygdrive/c/cygwin/work/trunk/src/ directory a binary named openocd.exe.
f. OpenOCD invocation can be done from Windows Dos (cmd), make sure the Cygwin libraries are in your PATH:
1) Right click the My Computer and select the Properties 2) Click on the Advanced tab 3) Click on the Environment Variables button 4) Click on the path variable and click on the Edit button 5) Add to the Variable value path: ;c:/cygwin/bin/ and click the OK button all the way 6) Now you can open a Dos window and openOCD should work for you