The OpenOCD Developer Manual contains information about the internal
architecture and other details about the code:
+ # NB! make sure doxygen is installed, type doxygen --version
make doxygen
# If HTMLVIEWER is set, this views the HTML Doxygen output.
- ${HTMLVIEWER} doxyegen/index.html
+ ${HTMLVIEWER} doxygen/index.html
The remaining sections describe how to configure the system such that
you can build the in-tree documentation.
The INSTALL file contains generic instructions for running 'configure'
and compiling the OpenOCD source code. That file is provided by default
-for all GNU automake packages, and
+for all GNU automake packages. If you are not familiar with the GNU
+autotools, then you should read those instructions first.
-if you are not familiar with the GNU autotools, then you should read
-those instructions first.
-Still, the
-remainder of this document tries to provide complete instructions for
-those looking for a quick-install
+The remainder of this document tries to provide some instructions for
+those looking for a quick-install.
OpenOCD Dependencies
--------------------
-You will need to install the appropriate driver files, if you want to
+Presently, GCC is required to build OpenOCD. The developers have begun
+to enforce strict code warnings (-Wall, -Werror, -Wextra, and more) and
+use C99-specific features: inline functions, named initializers, mixing
+declarations with code, and other tricks. While it may be possible to
+use other compilers, they must be somewhat modern and could require
+extending support to conditionally remove GCC-specific extensions.
+
+Also, you need to install the appropriate driver files, if you want to
build support for a USB or FTDI-based interface:
- ft2232, jlink, rlink, vsllink, usbprog, arm-jtag-ew:
- ft2232 also requires:
- libftdi: http://www.intra2net.com/opensource/ftdi/ *OR*
- ftd2xx: http://www.ftdichip.com/Drivers/D2XX.htm,
- or the Amontec version (from @uref{http://www.amontec.com}), for
+ or the Amontec version (from http://www.amontec.com), for
easier support of JTAGkey's vendor and product IDs.
+Many Linux distributions provide these packages through their automated
+installation and update mechanisms; however, some Linux versions include
+older versions of libftdi. In particular, using Ubuntu 8.04 has been
+problematic, but newer versions of Ubuntu do not have this problem.
+
Compiling OpenOCD
-----------------
final (optional) step, ``make install'', places all of the files in the
required location.
+Cross-Compiling Options
+-----------------------
+
+To cross-compile, you must specify both --build and --host options to
+the 'configure' script. For example, you can configure OpenOCD to
+cross-compile on a x86 Linux host to run on Windows (MinGW32), you could
+use the following configuration options:
+
+ ./configure --build=i686-pc-linux-gnu --host=i586-mingw32msvc ...
+
+Likewise, the following options allow OpenOCD to be cross-compiled for
+an ARM target on the same x86 host:
+
+ ./configure --build=i686-pc-linux-gnu --host=arm-elf ...
+
+Both must be specified to work around bugs in autoconf.
+
+Scripts for producing ARM cross-compilers can be found on the web with a
+little searching. A script to produce an x86 Linux-hosted MinGW32
+cross-compiler can be downloaded from the following URL:
+
+ http://www.mingw.org/wiki/LinuxCrossMinGW
+
Configuration Options
---------------------
--disable-wextra Disable extra compiler warnings
--disable-werror Do not treat warnings as errors
- --enable-release Enable building of an OpenOCD release. This
- option is intended for project maintainers.
- It simply omits the svn version string when
- the openocd -v is executed (to KISS).
-
--disable-option-checking
Ignore unrecognized --enable and --with options.
--disable-dependency-tracking speeds up one-time build
svn checkout svn://svn.berlios.de/openocd/trunk openocd
-If you prefer GIT based tools, the @command{git-svn} package works too:
+If you prefer GIT based tools, the git-svn package works too:
git svn clone -s svn://svn.berlios.de/openocd
Building OpenOCD from a repository requires a recent version of the GNU
autotools (autoconf >= 2.59 and automake >= 1.9). For building on
-Windows, you have to use Cygwin. Make sure that your @env{PATH}
+Windows, you have to use Cygwin. Make sure that your PATH
environment variable contains no other locations with Unix utils (like
UnxUtils) - these can't handle the Cygwin paths, resulting in obscure
dependency errors. This was an observation gathered from the logs of
2) Run './configure --enable-maintainer-mode' with other options.
-
+The following URL is a good reference if you want to build OpenOCD
+under cygwin.
+http://forum.sparkfun.com/viewtopic.php?t=11221
+
+Alternatively you can build the Windows binary under Linux using
+MinGW cross compiler. The following documents some tips of
+using this cross build option.
+
+a) libusb-win32
+You can choose to use the libusb-win32 binary distribution from
+its Sourceforge page. As of this writing, the latest version
+is 0.1.12.2. This is the recommend version to use since it fixed
+an issue with USB composite device and this is important for FTDI
+based JTAG debuggers.
+http://sourceforge.net/projects/libusb-win32/
+
+You need to download the libusb-win32-device-bin-0.1.12.2.tar.gz
+package. Please extract this file into a temp directory.
+
+Copy the file libusb-win32-device-bin-0.1.12.2\include\usb.h
+to your MinGW include directory.
+
+Copy the library libusb-win32-device-bin-0.1.12.2\lib\gcc\libusb.a
+to your MinGW library directory.
+
+Take note that different Linux distros often have different
+MinGW installation directory. Some of them also put the
+library and include into a seperate sys-root directory.
+
+If there is a new svn version of libusb-win32, you can build it
+as well.
+
+This is the instrunction from the libusb-win32 Makefile.
+# If you're cross-compiling and your mingw32 tools are called
+# i586-mingw32msvc-gcc and so on, then you can compile libusb-win32
+# by running
+# make host_prefix=i586-mingw32msvc all
+
+b) libftdi
+libftdi source codes can be download from the following website.
+http://www.intra2net.com/en/developer/libftdi/download.php
+
+It does not provide Windows binary. You can build it from the
+source tarball or the git tree.
+
+If you are using the git tree, the following is the instruction
+from README.mingw. You need to have cmake installed.
+- Edit Toolchain-mingw32.cmake to point to the correct MinGW
+installation.
+- Create a build directory like "mkdir build-win32", e.g in ../libftdi/
+- cd in that directory and run
+ "cmake -DCMAKE_TOOLCHAIN_FILE=../Toolchain-mingw32.cmake .."
+- Copy src/ftdi.h to your MinGW include directory.
+- Copy build-win32/src/*.a to your MinGW lib directory.
+
+c) OpenOCD
+Now you can build OpenOCD under Linux using MinGW.
+You need to use --host=your_mingW_prefix in the configure option.
+
+Example for libftdi (in one line, tested under Ubuntu 9.04):
+./configure --host=i586-mingw32msvc --enable-maintainer-mode
+--disable-shared --enable-ft2232_libftdi
+
+Example for ftd2xx (in one line, tested under Ubuntu 9.04)
+./configure --host=i586-mingw32msvc --enable-maintainer-mode
+--disable-shared --enable-ft2232_ftd2xx
+--with-ftd2xx-win32-zipdir=/home/mcuee/Desktop/build/openocd/libftd2xx-win32