You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README 19 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485
  1. Welcome to OpenOCD!
  2. ===================
  3. OpenOCD provides on-chip programming and debugging support with a
  4. layered architecture of JTAG interface and TAP support, debug target
  5. support (e.g. ARM, MIPS), and flash chip drivers (e.g. CFI, NAND, etc.).
  6. Several network interfaces are available for interactiving with OpenOCD:
  7. HTTP, telnet, TCL, and GDB. The GDB server enables OpenOCD to function
  8. as a "remote target" for source-level debugging of embedded systems
  9. using the GNU GDB program.
  10. This README file contains an overview of the following topics:
  11. - how to find and build more OpenOCD documentation,
  12. - the build process
  13. - packaging tips.
  14. - configuration options
  15. =====================
  16. OpenOCD Documentation
  17. =====================
  18. In addition to in-tree documentation, the latest documentation may be
  19. viewed on-line at the following URLs:
  20. OpenOCD User's Guide:
  21. http://openocd.berlios.de/doc/html/index.html
  22. OpenOCD Developer's Manual:
  23. http://openocd.berlios.de/doc/doxygen/index.html
  24. These reflect the latest development versions, so the following section
  25. introduces how to build the complete documentation from the package.
  26. For more information, refer to these documents or contact the developers
  27. by subscribing to the OpenOCD developer mailing list:
  28. openocd-development@lists.berlios.de
  29. Building the OpenOCD Documentation
  30. ----------------------------------
  31. The OpenOCD User's Guide can be produced in two different format:
  32. # If PDFVIEWER is set, this creates and views the PDF User Guide.
  33. make pdf && ${PDFVIEWER} doc/openocd.pdf
  34. # If HTMLVIEWER is set, this creates and views the HTML User Guide.
  35. make html && ${HTMLVIEWER} doc/openocd.html/index.html
  36. The OpenOCD Developer Manual contains information about the internal
  37. architecture and other details about the code:
  38. # NB! make sure doxygen is installed, type doxygen --version
  39. make doxygen
  40. # If HTMLVIEWER is set, this views the HTML Doxygen output.
  41. ${HTMLVIEWER} doxygen/index.html
  42. The remaining sections describe how to configure the system such that
  43. you can build the in-tree documentation.
  44. ==================
  45. Installing OpenOCD
  46. ==================
  47. A Note to OpenOCD Users
  48. -----------------------
  49. If you would rather be working "with" OpenOCD rather than "on" it, your
  50. operating system or interface supplier may provide binaries for you in a
  51. convenient package.
  52. Such packages should be more stable than SVN trunk, where bleeding-edge
  53. development takes place. These "Packagers" produce binary releases of
  54. OpenOCD after the developers produces new "stable" versions of the
  55. source code. Previous versions of OpenOCD cannot be used to diagnosed
  56. problems with the current release, so users are encouraged to keep in
  57. contact with their distribution package maintainers or interface vendors
  58. to ensure suitable upgrades appear regularly.
  59. Users of these binary versions of OpenOCD must contact their Packager to
  60. ask for support or newer versions of the binaries; the OpenOCD
  61. developers do not support packages directly.
  62. A Note to OpenOCD Packagers
  63. ---------------------------
  64. You are a PACKAGER of OpenOCD if you:
  65. - Sell dongles: and include pre-built binaries
  66. - Supply tools: A complete development solution
  67. - Supply IDEs: like Eclipse, or RHIDE, etc.
  68. - Build packages: RPM files, or DEB files for a Linux Distro
  69. As a PACKAGER, you will experience first reports of most issues.
  70. When you fix those problems for your users, your solution may help
  71. prevent hundreds (if not thousands) of other questions from other users.
  72. If something does not work for you, please work to inform the OpenOCD
  73. developers know how to improve the system or documentation to avoid
  74. future problems, and follow-up to help us ensure the issue will be fully
  75. resolved in our future releases.
  76. That said, the OpenOCD developers would also like you to follow a few
  77. suggestions:
  78. - Send patches, including config files, upstream.
  79. - Always build with printer ports enabled.
  80. - Use libftdi + libusb for FT2232 support.
  81. Remember, the FTD2XX library cannot be used in binary distributions, due
  82. to restrictions of the GPL v2.
  83. ================
  84. Building OpenOCD
  85. ================
  86. The INSTALL file contains generic instructions for running 'configure'
  87. and compiling the OpenOCD source code. That file is provided by default
  88. for all GNU automake packages. If you are not familiar with the GNU
  89. autotools, then you should read those instructions first.
  90. The remainder of this document tries to provide some instructions for
  91. those looking for a quick-install.
  92. OpenOCD Dependencies
  93. --------------------
  94. Presently, GCC is required to build OpenOCD. The developers have begun
  95. to enforce strict code warnings (-Wall, -Werror, -Wextra, and more) and
  96. use C99-specific features: inline functions, named initializers, mixing
  97. declarations with code, and other tricks. While it may be possible to
  98. use other compilers, they must be somewhat modern and could require
  99. extending support to conditionally remove GCC-specific extensions.
  100. Also, you need to install the appropriate driver files, if you want to
  101. build support for a USB or FTDI-based interface:
  102. - ft2232, jlink, rlink, vsllink, usbprog, arm-jtag-ew:
  103. - libusb: required for portable communication with USB dongles
  104. - ft2232 also requires:
  105. - libftdi: http://www.intra2net.com/opensource/ftdi/ *OR*
  106. - ftd2xx: http://www.ftdichip.com/Drivers/D2XX.htm,
  107. or the Amontec version (from http://www.amontec.com), for
  108. easier support of JTAGkey's vendor and product IDs.
  109. Many Linux distributions provide these packages through their automated
  110. installation and update mechanisms; however, some Linux versions include
  111. older versions of libftdi. In particular, using Ubuntu 8.04 has been
  112. problematic, but newer versions of Ubuntu do not have this problem.
  113. Compiling OpenOCD
  114. -----------------
  115. To build OpenOCD (on both Linux and Cygwin), use the following sequence
  116. of commands:
  117. ./configure [with some options listed in the next section]
  118. make
  119. make install
  120. The 'configure' step generates the Makefiles required to build OpenOCD,
  121. usually with one or more options provided to it. The first 'make' step
  122. will build OpenOCD and place the final executable in ./src/. The
  123. final (optional) step, ``make install'', places all of the files in the
  124. required location.
  125. Cross-Compiling Options
  126. -----------------------
  127. To cross-compile, you must specify both --build and --host options to
  128. the 'configure' script. For example, you can configure OpenOCD to
  129. cross-compile on a x86 Linux host to run on Windows (MinGW32), you could
  130. use the following configuration options:
  131. ./configure --build=i686-pc-linux-gnu --host=i586-mingw32msvc ...
  132. Likewise, the following options allow OpenOCD to be cross-compiled for
  133. an ARM target on the same x86 host:
  134. ./configure --build=i686-pc-linux-gnu --host=arm-elf ...
  135. Both must be specified to work around bugs in autoconf.
  136. Scripts for producing ARM cross-compilers can be found on the web with a
  137. little searching. A script to produce an x86 Linux-hosted MinGW32
  138. cross-compiler can be downloaded from the following URL:
  139. http://www.mingw.org/wiki/LinuxCrossMinGW
  140. Configuration Options
  141. ---------------------
  142. The configure script takes numerous options, specifying which JTAG
  143. interfaces should be included (among other things). The following list
  144. of options was extracted from the output of './configure --help'. Other
  145. options may be available there:
  146. --enable-maintainer-mode enable make rules and dependencies not useful
  147. (and sometimes confusing) to the casual installer
  148. NOTE: This option is *required* for SVN builds!
  149. It should *not* be used to build a release.
  150. --enable-dummy Enable building the dummy JTAG port driver
  151. --enable-ft2232_libftdi Enable building support for FT2232 based devices
  152. using the libftdi driver, opensource alternate of
  153. FTD2XX
  154. --enable-ft2232_ftd2xx Enable building support for FT2232 based devices
  155. using the FTD2XX driver from ftdichip.com
  156. --enable-ftd2xx-highspeed
  157. Enable building support for FT2232H and
  158. FT4232H-based devices (requires >=libftd2xx-0.4.16)
  159. --enable-gw16012 Enable building support for the Gateworks GW16012
  160. JTAG Programmer
  161. --enable-parport Enable building the pc parallel port driver
  162. --disable-parport-ppdev Disable use of ppdev (/dev/parportN) for parport
  163. (for x86 only)
  164. --enable-parport-giveio Enable use of giveio for parport (for CygWin only)
  165. --enable-presto_libftdi Enable building support for ASIX Presto Programmer
  166. using the libftdi driver
  167. --enable-presto_ftd2xx Enable building support for ASIX Presto Programmer
  168. using the FTD2XX driver
  169. --enable-amtjtagaccel Enable building the Amontec JTAG-Accelerator driver
  170. --enable-arm-jtag-ew Enable building support for the Olimex ARM-JTAG-EW
  171. Programmer
  172. --enable-jlink Enable building support for the Segger J-Link JTAG
  173. Programmer
  174. --enable-rlink Enable building support for the Raisonance RLink
  175. JTAG Programmer
  176. --enable-usbprog Enable building support for the usbprog JTAG
  177. Programmer
  178. --enable-vsllink Enable building support for the Versaloon-Link JTAG
  179. Programmer
  180. --enable-oocd_trace Enable building support for the OpenOCD+trace ETM
  181. capture device
  182. --enable-ep93xx Enable building support for EP93xx based SBCs
  183. --enable-at91rm9200 Enable building support for AT91RM9200 based SBCs
  184. --enable-ecosboard Enable building support for eCos based JTAG debugger
  185. --enable-zy1000 Enable ZY1000 interface
  186. --enable-minidriver-dummy
  187. Enable the dummy minidriver.
  188. --enable-ioutil Enable ioutil functions - useful for standalone
  189. OpenOCD implementations
  190. --enable-httpd Enable builtin httpd server - useful for standalone
  191. OpenOCD implementations
  192. Miscellaneous Configure Options
  193. -------------------------------
  194. The following additional options may also be useful:
  195. --disable-assert turn off assertions
  196. --enable-verbose Enable verbose JTAG I/O messages (for debugging).
  197. --enable-verbose-jtag-io
  198. Enable verbose JTAG I/O messages (for debugging).
  199. --enable-verbose-usb-io Enable verbose USB I/O messages (for debugging)
  200. --enable-verbose-usb-comms
  201. Enable verbose USB communication messages (for
  202. debugging)
  203. --enable-malloc-logging Include free space in logging messages (requires
  204. malloc.h).
  205. --disable-gccwarnings Disable extra gcc warnings during build.
  206. --disable-wextra Disable extra compiler warnings
  207. --disable-werror Do not treat warnings as errors
  208. --disable-option-checking
  209. Ignore unrecognized --enable and --with options.
  210. --disable-dependency-tracking speeds up one-time build
  211. --enable-shared[=PKGS] build shared libraries [default=no]
  212. --enable-static[=PKGS] build static libraries [default=yes]
  213. Parallel Port Dongles
  214. ---------------------
  215. If you want to access the parallel port using the PPDEV interface you
  216. have to specify both --enable-parport AND --enable-parport-ppdev, since the
  217. the later option is an option to the parport driver (see
  218. http://forum.sparkfun.com/viewtopic.php?t=3795 for more info).
  219. The same is true for the --enable-parport-giveio option, you
  220. have to use both the --enable-parport AND the --enable-parport-giveio
  221. option if you want to use giveio instead of ioperm parallel port access
  222. method.
  223. FT2232C Based USB Dongles
  224. -------------------------
  225. There are 2 methods of using the FTD2232, either (1) using the
  226. FTDICHIP.COM closed source driver, or (2) the open (and free) driver
  227. libftdi.
  228. Using LIBFTDI
  229. -------------
  230. For both Linux and Windows, both libusb and libftdi must be built and
  231. installed. To use the newer FT2232H chips, supporting RTCK and USB high
  232. speed (480 Mbps), you need libftdi version 0.16 or newer. Many Linux
  233. distributions provide suitable packages for these libraries.
  234. For Windows, libftdi is supported with versions 0.14 and later.
  235. With these prerequisites met, configure the libftdi solution like this:
  236. ./configure --prefix=/path/for/your/install --enable-ft2232_libftdi
  237. Then type ``make'', and perhaps ``make install''.
  238. Using FTDI's FTD2XX
  239. -------------------
  240. Some claim the (closed) FTDICHIP.COM solution is faster, which
  241. is the motivation for supporting it even though its licensing restricts
  242. it to non-redistributable OpenOCD binaries, and it is not available for
  243. all operating systems used with OpenOCD. You may, however, build such
  244. copies for personal use.
  245. The FTDICHIP drivers come as either a (win32) ZIP file, or a (Linux)
  246. TAR.GZ file. You must unpack them ``some where'' convient. As of this
  247. writing FTDICHIP does not supply means to install these files "in an
  248. appropriate place."
  249. If your distribution does not package these, there are several
  250. './configure' options to solve this problem:
  251. --with-ftd2xx-win32-zipdir
  252. Where (CYGWIN/MINGW) the zip file from ftdichip.com
  253. was unpacked <default=search>
  254. --with-ftd2xx-linux-tardir
  255. Where (Linux/Unix) the tar file from ftdichip.com
  256. was unpacked <default=search>
  257. --with-ftd2xx-lib Use static or shared ftd2xx libs on default static
  258. If you are using the FTDICHIP.COM driver, download and unpack the
  259. Windows or Linux FTD2xx drivers from the following location:
  260. http://www.ftdichip.com/Drivers/D2XX.htm
  261. Remember, this library is binary-only, while OpenOCD is licenced
  262. according to GNU GPLv2 without any exceptions. That means that
  263. _distributing_ copies of OpenOCD built with the FTDI code would violate
  264. the OpenOCD licensing terms.
  265. Cygwin/Win32 Notes
  266. ******************
  267. The Cygwin/Win32 ZIP file contains a directory named ftd2xx.win32.
  268. Assuming that you have extracted this archive in the same directory as
  269. the OpenOCD package, you could configure with options like the following:
  270. ./configure \
  271. --enable-ft2232_ftd2xx \
  272. --with-ftd2xx-win32-zipdir=../ftd2xx.win32 \
  273. ... other options ...
  274. Linux Notes
  275. ***********
  276. The Linux tar.gz archive contains a directory named libftd2xx0.4.16
  277. (or similar). Assuming that you have extracted this archive in the same
  278. directory as the OpenOCD package, you could configure with options like
  279. the following:
  280. ./configure \
  281. --enable-ft2232_ftd2xx \
  282. --with-ft2xx-linux-tardir=../libftd2xx0.4.16 \
  283. ... other options ...
  284. =================================
  285. Obtaining OpenOCD From Subversion
  286. ---------------------------------
  287. You can download the current SVN version with an SVN client of your
  288. choice from the following repositories:
  289. svn://svn.berlios.de/openocd/trunk
  290. or
  291. http://svn.berlios.de/svnroot/repos/openocd/trunk
  292. Using the SVN command line client, you can use the following command to
  293. fetch the latest version (make sure there is no (non-svn) directory
  294. called "openocd" in the current directory):
  295. svn checkout svn://svn.berlios.de/openocd/trunk openocd
  296. If you prefer GIT based tools, the git-svn package works too:
  297. git svn clone -s svn://svn.berlios.de/openocd
  298. Tips For Building From The Subversion Repository
  299. ************************************************
  300. Building OpenOCD from a repository requires a recent version of the GNU
  301. autotools (autoconf >= 2.59 and automake >= 1.9). For building on
  302. Windows, you have to use Cygwin. Make sure that your PATH
  303. environment variable contains no other locations with Unix utils (like
  304. UnxUtils) - these can't handle the Cygwin paths, resulting in obscure
  305. dependency errors. This was an observation gathered from the logs of
  306. one user; please correct us if this is wrong.
  307. 1) Run './bootstrap' to create the 'configure' script and prepare
  308. the build process for your host system.
  309. 2) Run './configure --enable-maintainer-mode' with other options.
  310. The following URL is a good reference if you want to build OpenOCD
  311. under cygwin.
  312. http://forum.sparkfun.com/viewtopic.php?t=11221
  313. Alternatively you can build the Windows binary under Linux using
  314. MinGW cross compiler. The following documents some tips of
  315. using this cross build option.
  316. a) libusb-win32
  317. You can choose to use the libusb-win32 binary distribution from
  318. its Sourceforge page. As of this writing, the latest version
  319. is 0.1.12.2. This is the recommend version to use since it fixed
  320. an issue with USB composite device and this is important for FTDI
  321. based JTAG debuggers.
  322. http://sourceforge.net/projects/libusb-win32/
  323. You need to download the libusb-win32-device-bin-0.1.12.2.tar.gz
  324. package. Please extract this file into a temp directory.
  325. Copy the file libusb-win32-device-bin-0.1.12.2\include\usb.h
  326. to your MinGW include directory.
  327. Copy the library libusb-win32-device-bin-0.1.12.2\lib\gcc\libusb.a
  328. to your MinGW library directory.
  329. Take note that different Linux distros often have different
  330. MinGW installation directory. Some of them also put the
  331. library and include into a seperate sys-root directory.
  332. If there is a new svn version of libusb-win32, you can build it
  333. as well.
  334. This is the instrunction from the libusb-win32 Makefile.
  335. # If you're cross-compiling and your mingw32 tools are called
  336. # i586-mingw32msvc-gcc and so on, then you can compile libusb-win32
  337. # by running
  338. # make host_prefix=i586-mingw32msvc all
  339. b) libftdi
  340. libftdi source codes can be download from the following website.
  341. http://www.intra2net.com/en/developer/libftdi/download.php
  342. It does not provide Windows binary. You can build it from the
  343. source tarball or the git tree.
  344. If you are using the git tree, the following is the instruction
  345. from README.mingw. You need to have cmake installed.
  346. - Edit Toolchain-mingw32.cmake to point to the correct MinGW
  347. installation.
  348. - Create a build directory like "mkdir build-win32", e.g in ../libftdi/
  349. - cd in that directory and run
  350. "cmake -DCMAKE_TOOLCHAIN_FILE=../Toolchain-mingw32.cmake .."
  351. - Copy src/ftdi.h to your MinGW include directory.
  352. - Copy build-win32/src/*.a to your MinGW lib directory.
  353. c) OpenOCD
  354. Now you can build OpenOCD under Linux using MinGW.
  355. You need to use --host=your_mingW_prefix in the configure option.
  356. Example for libftdi (in one line, tested under Ubuntu 9.04):
  357. ./configure --host=i586-mingw32msvc --enable-maintainer-mode
  358. --disable-shared --enable-ft2232_libftdi
  359. Example for ftd2xx (in one line, tested under Ubuntu 9.04)
  360. ./configure --host=i586-mingw32msvc --enable-maintainer-mode
  361. --disable-shared --enable-ft2232_ftd2xx
  362. --with-ftd2xx-win32-zipdir=/home/mcuee/Desktop/build/openocd/libftd2xx-win32