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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  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 facilitate 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.cfg -c "transport select hla_swd" \
  34. -f target/stm32l0.cfg
  35. After OpenOCD startup, connect GDB with
  36. (gdb) target extended-remote localhost:3333
  37. =====================
  38. OpenOCD Documentation
  39. =====================
  40. In addition to the in-tree documentation, the latest manuals may be
  41. viewed online at the following URLs:
  42. OpenOCD User's Guide:
  43. http://openocd.org/doc/html/index.html
  44. OpenOCD Developer's Manual:
  45. http://openocd.org/doc/doxygen/html/index.html
  46. These reflect the latest development versions, so the following section
  47. introduces how to build the complete documentation from the package.
  48. For more information, refer to these documents or contact the developers
  49. by subscribing to the OpenOCD developer mailing list:
  50. openocd-devel@lists.sourceforge.net
  51. Building the OpenOCD Documentation
  52. ----------------------------------
  53. By default the OpenOCD build process prepares documentation in the
  54. "Info format" and installs it the standard way, so that "info openocd"
  55. can access it.
  56. Additionally, the OpenOCD User's Guide can be produced in the
  57. following different formats:
  58. # If PDFVIEWER is set, this creates and views the PDF User Guide.
  59. make pdf && ${PDFVIEWER} doc/openocd.pdf
  60. # If HTMLVIEWER is set, this creates and views the HTML User Guide.
  61. make html && ${HTMLVIEWER} doc/openocd.html/index.html
  62. The OpenOCD Developer Manual contains information about the internal
  63. architecture and other details about the code:
  64. # NB! make sure doxygen is installed, type doxygen --version
  65. make doxygen && ${HTMLVIEWER} doxygen/index.html
  66. ==================
  67. Supported hardware
  68. ==================
  69. JTAG adapters
  70. -------------
  71. AICE, ARM-JTAG-EW, ARM-USB-OCD, ARM-USB-TINY, AT91RM9200, axm0432, BCM2835,
  72. Bus Blaster, Buspirate, Cadence DPI, Chameleon, CMSIS-DAP, Cortino,
  73. Cypress KitProg, DENX, Digilent JTAG-SMT2, DLC 5, DLP-USB1232H,
  74. embedded projects, eStick, FlashLINK, FlossJTAG, Flyswatter, Flyswatter2,
  75. FTDI FT232R, Gateworks, Hoegl, ICDI, ICEBear, J-Link, JTAG VPI, JTAGkey,
  76. JTAGkey2, JTAG-lock-pick, KT-Link, Linux GPIOD, Lisa/L, LPC1768-Stick,
  77. Mellanox rshim, MiniModule, NGX, Nuvoton Nu-Link, Nu-Link2, NXHX, NXP IMX GPIO,
  78. OOCDLink, Opendous, OpenJTAG, Openmoko, OpenRD, OSBDM, Presto, Redbee,
  79. Remote Bitbang, RLink, SheevaPlug devkit, Stellaris evkits,
  80. ST-LINK (SWO tracing supported), STM32-PerformanceStick, STR9-comStick,
  81. sysfsgpio, TI XDS110, TUMPA, Turtelizer, ULINK, USB-A9260, USB-Blaster,
  82. USB-JTAG, USBprog, VPACLink, VSLLink, Wiggler, XDS100v2, Xilinx XVC/PCIe,
  83. Xverve.
  84. Debug targets
  85. -------------
  86. ARM: AArch64, ARM11, ARM7, ARM9, Cortex-A/R (v7-A/R), Cortex-M (ARMv{6/7/8}-M),
  87. FA526, Feroceon/Dragonite, XScale.
  88. ARCv2, AVR32, DSP563xx, DSP5680xx, EnSilica eSi-RISC, EJTAG (MIPS32, MIPS64),
  89. Intel Quark, LS102x-SAP, NDS32, RISC-V, ST STM8.
  90. Flash drivers
  91. -------------
  92. ADUC702x, AT91SAM, AT91SAM9 (NAND), ATH79, ATmega128RFA1, Atmel SAM, AVR, CFI,
  93. DSP5680xx, EFM32, EM357, eSi-RISC, eSi-TSMC, EZR32HG, FM3, FM4, Freedom E SPI,
  94. i.MX31, Kinetis, LPC8xx/LPC1xxx/LPC2xxx/LPC541xx, LPC2900, LPC3180, LPC32xx,
  95. LPCSPIFI, Marvell QSPI, MAX32, Milandr, MXC, NIIET, nRF51, nRF52 , NuMicro,
  96. NUC910, Orion/Kirkwood, PIC32mx, PSoC4/5LP/6, Renesas RPC HF and SH QSPI,
  97. S3C24xx, S3C6400, SiM3x, SiFive Freedom E, Stellaris, ST BlueNRG, STM32,
  98. STM32 QUAD/OCTO-SPI for Flash/FRAM/EEPROM, STMSMI, STR7x, STR9x, SWM050,
  99. TI CC13xx, TI CC26xx, TI CC32xx, TI MSP432, Winner Micro w600, Xilinx XCF,
  100. XMC1xxx, XMC4xxx.
  101. ==================
  102. Installing OpenOCD
  103. ==================
  104. A Note to OpenOCD Users
  105. -----------------------
  106. If you would rather be working "with" OpenOCD rather than "on" it, your
  107. operating system or JTAG interface supplier may provide binaries for
  108. you in a convenient-enough package.
  109. Such packages may be more stable than git mainline, where
  110. bleeding-edge development takes place. These "Packagers" produce
  111. binary releases of OpenOCD after the developers produces new "release"
  112. versions of the source code. Previous versions of OpenOCD cannot be
  113. used to diagnose problems with the current release, so users are
  114. encouraged to keep in contact with their distribution package
  115. maintainers or interface vendors to ensure suitable upgrades appear
  116. regularly.
  117. Users of these binary versions of OpenOCD must contact their Packager to
  118. ask for support or newer versions of the binaries; the OpenOCD
  119. developers do not support packages directly.
  120. A Note to OpenOCD Packagers
  121. ---------------------------
  122. You are a PACKAGER of OpenOCD if you:
  123. - Sell dongles and include pre-built binaries;
  124. - Supply tools or IDEs (a development solution integrating OpenOCD);
  125. - Build packages (e.g. RPM or DEB files for a GNU/Linux distribution).
  126. As a PACKAGER, you will experience first reports of most issues.
  127. When you fix those problems for your users, your solution may help
  128. prevent hundreds (if not thousands) of other questions from other users.
  129. If something does not work for you, please work to inform the OpenOCD
  130. developers know how to improve the system or documentation to avoid
  131. future problems, and follow-up to help us ensure the issue will be fully
  132. resolved in our future releases.
  133. That said, the OpenOCD developers would also like you to follow a few
  134. suggestions:
  135. - Send patches, including config files, upstream, participate in the
  136. discussions;
  137. - Enable all the options OpenOCD supports, even those unrelated to your
  138. particular hardware;
  139. - Use "ftdi" interface adapter driver for the FTDI-based devices.
  140. ================
  141. Building OpenOCD
  142. ================
  143. The INSTALL file contains generic instructions for running 'configure'
  144. and compiling the OpenOCD source code. That file is provided by
  145. default for all GNU autotools packages. If you are not familiar with
  146. the GNU autotools, then you should read those instructions first.
  147. The remainder of this document tries to provide some instructions for
  148. those looking for a quick-install.
  149. OpenOCD Dependencies
  150. --------------------
  151. GCC or Clang is currently required to build OpenOCD. The developers
  152. have begun to enforce strict code warnings (-Wall, -Werror, -Wextra,
  153. and more) and use C99-specific features: inline functions, named
  154. initializers, mixing declarations with code, and other tricks. While
  155. it may be possible to use other compilers, they must be somewhat
  156. modern and could require extending support to conditionally remove
  157. GCC-specific extensions.
  158. You'll also need:
  159. - make
  160. - libtool
  161. - pkg-config >= 0.23 (or compatible)
  162. Additionally, for building from git:
  163. - autoconf >= 2.69
  164. - automake >= 1.14
  165. - texinfo >= 5.0
  166. USB-based adapters depend on libusb-1.0. A compatible implementation, such as
  167. FreeBSD's, additionally needs the corresponding .pc files.
  168. USB-Blaster, ASIX Presto and OpenJTAG interface adapter
  169. drivers need:
  170. - libftdi: http://www.intra2net.com/en/developer/libftdi/index.php
  171. CMSIS-DAP support needs HIDAPI library.
  172. Permissions delegation
  173. ----------------------
  174. Running OpenOCD with root/administrative permissions is strongly
  175. discouraged for security reasons.
  176. For USB devices on GNU/Linux you should use the contrib/60-openocd.rules
  177. file. It probably belongs somewhere in /etc/udev/rules.d, but
  178. consult your operating system documentation to be sure. Do not forget
  179. to add yourself to the "plugdev" group.
  180. For parallel port adapters on GNU/Linux and FreeBSD please change your
  181. "ppdev" (parport* or ppi*) device node permissions accordingly.
  182. For parport adapters on Windows you need to run install_giveio.bat
  183. (it's also possible to use "ioperm" with Cygwin instead) to give
  184. ordinary users permissions for accessing the "LPT" registers directly.
  185. Compiling OpenOCD
  186. -----------------
  187. To build OpenOCD, use the following sequence of commands:
  188. ./bootstrap (when building from the git repository)
  189. ./configure [options]
  190. make
  191. sudo make install
  192. The 'configure' step generates the Makefiles required to build
  193. OpenOCD, usually with one or more options provided to it. The first
  194. 'make' step will build OpenOCD and place the final executable in
  195. './src/'. The final (optional) step, ``make install'', places all of
  196. the files in the required location.
  197. To see the list of all the supported options, run
  198. ./configure --help
  199. Cross-compiling Options
  200. -----------------------
  201. Cross-compiling is supported the standard autotools way, you just need
  202. to specify the cross-compiling target triplet in the --host option,
  203. e.g. for cross-building for Windows 32-bit with MinGW on Debian:
  204. ./configure --host=i686-w64-mingw32 [options]
  205. To make pkg-config work nicely for cross-compiling, you might need an
  206. additional wrapper script as described at
  207. https://autotools.io/pkgconfig/cross-compiling.html
  208. This is needed to tell pkg-config where to look for the target
  209. libraries that OpenOCD depends on. Alternatively, you can specify
  210. *_CFLAGS and *_LIBS environment variables directly, see "./configure
  211. --help" for the details.
  212. For a more or less complete script that does all this for you, see
  213. contrib/cross-build.sh
  214. Parallel Port Dongles
  215. ---------------------
  216. If you want to access the parallel port using the PPDEV interface you
  217. have to specify both --enable-parport AND --enable-parport-ppdev, since
  218. the later option is an option to the parport driver.
  219. The same is true for the --enable-parport-giveio option, you have to
  220. use both the --enable-parport AND the --enable-parport-giveio option
  221. if you want to use giveio instead of ioperm parallel port access
  222. method.
  223. ==========================
  224. Obtaining OpenOCD From GIT
  225. ==========================
  226. You can download the current GIT version with a GIT client of your
  227. choice from the main repository:
  228. git://git.code.sf.net/p/openocd/code
  229. You may prefer to use a mirror:
  230. http://repo.or.cz/r/openocd.git
  231. git://repo.or.cz/openocd.git
  232. Using the GIT command line client, you might use the following command
  233. to set up a local copy of the current repository (make sure there is no
  234. directory called "openocd" in the current directory):
  235. git clone git://git.code.sf.net/p/openocd/code openocd
  236. Then you can update that at your convenience using
  237. git pull
  238. There is also a gitweb interface, which you can use either to browse
  239. the repository or to download arbitrary snapshots using HTTP:
  240. http://repo.or.cz/w/openocd.git
  241. Snapshots are compressed tarballs of the source tree, about 1.3 MBytes
  242. each at this writing.