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 13 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  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 including:
  5. - (X)SVF playback to faciliate automated boundary scan and FPGA/CPLD
  6. programming;
  7. - debug target support (e.g. ARM, MIPS): single-stepping,
  8. breakpoints/watchpoints, gprof profiling, etc;
  9. - flash chip drivers (e.g. CFI, NAND, internal flash);
  10. - embedded TCL interpreter for easy scripting.
  11. Several network interfaces are available for interacting with OpenOCD:
  12. telnet, TCL, and GDB. The GDB server enables OpenOCD to function as a
  13. "remote target" for source-level debugging of embedded systems using
  14. the GNU GDB program (and the others who talk GDB protocol, e.g. IDA
  15. Pro).
  16. This README file contains an overview of the following topics:
  17. - quickstart instructions,
  18. - how to find and build more OpenOCD documentation,
  19. - list of the supported hardware,
  20. - the installation and build process,
  21. - packaging tips.
  22. ============================
  23. Quickstart for the impatient
  24. ============================
  25. If you have a popular board then just start OpenOCD with its config,
  26. e.g.:
  27. openocd -f board/stm32f4discovery.cfg
  28. If you are connecting a particular adapter with some specific target,
  29. you need to source both the jtag interface and the target configs,
  30. e.g.:
  31. openocd -f interface/ftdi/jtagkey2.cfg -c "transport select jtag" \
  32. -f target/ti_calypso.cfg
  33. openocd -f interface/stlink-v2-1.cfg -c "transport select hla_swd" \
  34. -f target/stm32l0.cfg
  35. NB: when using an FTDI-based adapter you should prefer configs in the
  36. ftdi directory; the old configs for the ft2232 are deprecated.
  37. After OpenOCD startup, connect GDB with
  38. (gdb) target extended-remote localhost:3333
  39. =====================
  40. OpenOCD Documentation
  41. =====================
  42. In addition to the in-tree documentation, the latest manuals may be
  43. viewed online at the following URLs:
  44. OpenOCD User's Guide:
  45. http://openocd.org/doc/html/index.html
  46. OpenOCD Developer's Manual:
  47. http://openocd.org/doc/doxygen/html/index.html
  48. These reflect the latest development versions, so the following section
  49. introduces how to build the complete documentation from the package.
  50. For more information, refer to these documents or contact the developers
  51. by subscribing to the OpenOCD developer mailing list:
  52. openocd-devel@lists.sourceforge.net
  53. Building the OpenOCD Documentation
  54. ----------------------------------
  55. By default the OpenOCD build process prepares documentation in the
  56. "Info format" and installs it the standard way, so that "info openocd"
  57. can access it.
  58. Additionally, the OpenOCD User's Guide can be produced in the
  59. following different formats:
  60. # If PDFVIEWER is set, this creates and views the PDF User Guide.
  61. make pdf && ${PDFVIEWER} doc/openocd.pdf
  62. # If HTMLVIEWER is set, this creates and views the HTML User Guide.
  63. make html && ${HTMLVIEWER} doc/openocd.html/index.html
  64. The OpenOCD Developer Manual contains information about the internal
  65. architecture and other details about the code:
  66. # NB! make sure doxygen is installed, type doxygen --version
  67. make doxygen && ${HTMLVIEWER} doxygen/index.html
  68. ==================
  69. Supported hardware
  70. ==================
  71. JTAG adapters
  72. -------------
  73. AICE, ARM-JTAG-EW, ARM-USB-OCD, ARM-USB-TINY, AT91RM9200, axm0432,
  74. BCM2835, Bus Blaster, Buspirate, Chameleon, CMSIS-DAP, Cortino, DENX,
  75. Digilent JTAG-SMT2, DLC 5, DLP-USB1232H, embedded projects, eStick,
  76. FlashLINK, FlossJTAG, Flyswatter, Flyswatter2, Gateworks, Hoegl, ICDI,
  77. ICEBear, J-Link, JTAG VPI, JTAGkey, JTAGkey2, JTAG-lock-pick, KT-Link,
  78. Lisa/L, LPC1768-Stick, MiniModule, NGX, NXHX, OOCDLink, Opendous,
  79. OpenJTAG, Openmoko, OpenRD, OSBDM, Presto, Redbee, RLink, SheevaPlug
  80. devkit, Stellaris evkits, ST-LINK (SWO tracing supported),
  81. STM32-PerformanceStick, STR9-comStick, sysfsgpio, TUMPA, Turtelizer,
  82. ULINK, USB-A9260, USB-Blaster, USB-JTAG, USBprog, VPACLink, VSLLink,
  83. Wiggler, XDS100v2, Xverve.
  84. Debug targets
  85. -------------
  86. ARM11, ARM7, ARM9, AVR32, Cortex-A, Cortex-R, Cortex-M,
  87. Feroceon/Dragonite, DSP563xx, DSP5680xx, FA526, MIPS EJTAG, NDS32,
  88. XScale, Intel Quark.
  89. Flash drivers
  90. -------------
  91. ADUC702x, AT91SAM, AVR, CFI, DSP5680xx, EFM32, EM357, FM3, Kinetis,
  92. LPC8xx/LPC1xxx/LPC2xxx/LPC541xx, LPC2900, LPCSPIFI, Marvell QSPI,
  93. Milandr, NuMicro, PIC32mx, PSoC4, SiM3x, Stellaris, STM32, STMSMI,
  94. STR7x, STR9x, nRF51; NAND controllers of AT91SAM9, LPC3180, LPC32xx,
  95. i.MX31, MXC, NUC910, Orion/Kirkwood, S3C24xx, S3C6400.
  96. ==================
  97. Installing OpenOCD
  98. ==================
  99. A Note to OpenOCD Users
  100. -----------------------
  101. If you would rather be working "with" OpenOCD rather than "on" it, your
  102. operating system or JTAG interface supplier may provide binaries for
  103. you in a convenient-enough package.
  104. Such packages may be more stable than git mainline, where
  105. bleeding-edge development takes place. These "Packagers" produce
  106. binary releases of OpenOCD after the developers produces new "release"
  107. versions of the source code. Previous versions of OpenOCD cannot be
  108. used to diagnose problems with the current release, so users are
  109. encouraged to keep in contact with their distribution package
  110. maintainers or interface vendors to ensure suitable upgrades appear
  111. regularly.
  112. Users of these binary versions of OpenOCD must contact their Packager to
  113. ask for support or newer versions of the binaries; the OpenOCD
  114. developers do not support packages directly.
  115. A Note to OpenOCD Packagers
  116. ---------------------------
  117. You are a PACKAGER of OpenOCD if you:
  118. - Sell dongles and include pre-built binaries;
  119. - Supply tools or IDEs (a development solution integrating OpenOCD);
  120. - Build packages (e.g. RPM or DEB files for a GNU/Linux distribution).
  121. As a PACKAGER, you will experience first reports of most issues.
  122. When you fix those problems for your users, your solution may help
  123. prevent hundreds (if not thousands) of other questions from other users.
  124. If something does not work for you, please work to inform the OpenOCD
  125. developers know how to improve the system or documentation to avoid
  126. future problems, and follow-up to help us ensure the issue will be fully
  127. resolved in our future releases.
  128. That said, the OpenOCD developers would also like you to follow a few
  129. suggestions:
  130. - Send patches, including config files, upstream, participate in the
  131. discussions;
  132. - Enable all the options OpenOCD supports, even those unrelated to your
  133. particular hardware;
  134. - Use "ftdi" interface adapter driver for the FTDI-based devices.
  135. As a PACKAGER, never link against the FTD2XX library, as the resulting
  136. binaries can't be legally distributed, due to the restrictions of the
  137. GPL.
  138. ================
  139. Building OpenOCD
  140. ================
  141. The INSTALL file contains generic instructions for running 'configure'
  142. and compiling the OpenOCD source code. That file is provided by
  143. default for all GNU autotools packages. If you are not familiar with
  144. the GNU autotools, then you should read those instructions first.
  145. The remainder of this document tries to provide some instructions for
  146. those looking for a quick-install.
  147. OpenOCD Dependencies
  148. --------------------
  149. GCC or Clang is currently required to build OpenOCD. The developers
  150. have begun to enforce strict code warnings (-Wall, -Werror, -Wextra,
  151. and more) and use C99-specific features: inline functions, named
  152. initializers, mixing declarations with code, and other tricks. While
  153. it may be possible to use other compilers, they must be somewhat
  154. modern and could require extending support to conditionally remove
  155. GCC-specific extensions.
  156. You'll also need:
  157. - make
  158. - libtool
  159. - pkg-config >= 0.23 (or compatible)
  160. Additionally, for building from git:
  161. - autoconf >= 2.64
  162. - automake >= 1.9
  163. - texinfo
  164. USB-based adapters depend on libusb-1.0 and some older drivers require
  165. libusb-0.1 or libusb-compat-0.1. A compatible implementation, such as
  166. FreeBSD's, additionally needs the corresponding .pc files.
  167. USB-Blaster, ASIX Presto, OpenJTAG and ft2232 interface adapter
  168. drivers need either one of:
  169. - libftdi: http://www.intra2net.com/en/developer/libftdi/index.php
  170. - ftd2xx: http://www.ftdichip.com/Drivers/D2XX.htm (proprietary,
  171. GPL-incompatible)
  172. CMSIS-DAP support needs HIDAPI library.
  173. Permissions delegation
  174. ----------------------
  175. Running OpenOCD with root/administrative permissions is strongly
  176. discouraged for security reasons.
  177. For USB devices on GNU/Linux you should use the contrib/99-openocd.rules
  178. file. It probably belongs somewhere in /etc/udev/rules.d, but
  179. consult your operating system documentation to be sure. Do not forget
  180. to add yourself to the "plugdev" group.
  181. For parallel port adapters on GNU/Linux and FreeBSD please change your
  182. "ppdev" (parport* or ppi*) device node permissions accordingly.
  183. For parport adapters on Windows you need to run install_giveio.bat
  184. (it's also possible to use "ioperm" with Cygwin instead) to give
  185. ordinary users permissions for accessing the "LPT" registers directly.
  186. Compiling OpenOCD
  187. -----------------
  188. To build OpenOCD, use the following sequence of commands:
  189. ./bootstrap (when building from the git repository)
  190. ./configure [options]
  191. make
  192. sudo make install
  193. The 'configure' step generates the Makefiles required to build
  194. OpenOCD, usually with one or more options provided to it. The first
  195. 'make' step will build OpenOCD and place the final executable in
  196. './src/'. The final (optional) step, ``make install'', places all of
  197. the files in the required location.
  198. To see the list of all the supported options, run
  199. ./configure --help
  200. Cross-compiling Options
  201. -----------------------
  202. Cross-compiling is supported the standard autotools way, you just need
  203. to specify the cross-compiling target triplet in the --host option,
  204. e.g. for cross-building for Windows 32-bit with MinGW on Debian:
  205. ./configure --host=i686-w64-mingw32 [options]
  206. To make pkg-config work nicely for cross-compiling, you might need an
  207. additional wrapper script as described at
  208. http://www.flameeyes.eu/autotools-mythbuster/pkgconfig/cross-compiling.html
  209. This is needed to tell pkg-config where to look for the target
  210. libraries that OpenOCD depends on. Alternatively, you can specify
  211. *_CFLAGS and *_LIBS environment variables directly, see "./configure
  212. --help" for the details.
  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.
  218. The same is true for the --enable-parport-giveio option, you have to
  219. use both the --enable-parport AND the --enable-parport-giveio option
  220. if you want to use giveio instead of ioperm parallel port access
  221. method.
  222. Using FTDI's FTD2XX
  223. -------------------
  224. The (closed source) FTDICHIP.COM solution is faster than libftdi on
  225. Windows. That is the motivation for supporting it even though its
  226. licensing restricts it to non-redistributable OpenOCD binaries, and it
  227. is not available for all operating systems used with OpenOCD. You may,
  228. however, build such copies for personal use.
  229. The FTDICHIP drivers come as either a (win32) ZIP file, or a (Linux)
  230. TAR.GZ file. You must unpack them ``some where'' convenient. As of this
  231. writing FTDICHIP does not supply means to install these files "in an
  232. appropriate place."
  233. You should use the following ./configure options to make use of
  234. FTD2XX:
  235. --with-ftd2xx-win32-zipdir
  236. Where (CYGWIN/MINGW) the zip file from ftdichip.com
  237. was unpacked <default=search>
  238. --with-ftd2xx-linux-tardir
  239. Where (Linux/Unix) the tar file from ftdichip.com
  240. was unpacked <default=search>
  241. --with-ftd2xx-lib=(static|shared)
  242. Use static or shared ftd2xx libs (default is static)
  243. Remember, this library is binary-only, while OpenOCD is licenced
  244. according to GNU GPLv2 without any exceptions. That means that
  245. _distributing_ copies of OpenOCD built with the FTDI code would
  246. violate the OpenOCD licensing terms.
  247. Note that on Linux there is no good reason to use these FTDI binaries;
  248. they are no faster (on Linux) than libftdi, and cause licensing issues.
  249. ==========================
  250. Obtaining OpenOCD From GIT
  251. ==========================
  252. You can download the current GIT version with a GIT client of your
  253. choice from the main repository:
  254. git://git.code.sf.net/p/openocd/code
  255. You may prefer to use a mirror:
  256. http://repo.or.cz/r/openocd.git
  257. git://repo.or.cz/openocd.git
  258. Using the GIT command line client, you might use the following command
  259. to set up a local copy of the current repository (make sure there is no
  260. directory called "openocd" in the current directory):
  261. git clone git://git.code.sf.net/p/openocd/code openocd
  262. Then you can update that at your convenience using
  263. git pull
  264. There is also a gitweb interface, which you can use either to browse
  265. the repository or to download arbitrary snapshots using HTTP:
  266. http://repo.or.cz/w/openocd.git
  267. Snapshots are compressed tarballs of the source tree, about 1.3 MBytes
  268. each at this writing.