binarybuffer: Fix inverted return value in buf_cmp
[openocd.git] / README
blob950c71f707ea39822dfb1687d4a1b7534c34849b
1 # Welcome to OpenOCD!
3 OpenOCD provides on-chip programming and debugging support with a
4 layered architecture of JTAG interface and TAP support including:
6 - (X)SVF playback to facilitate automated boundary scan and FPGA/CPLD
7   programming;
8 - debug target support (e.g. ARM, MIPS): single-stepping,
9   breakpoints/watchpoints, gprof profiling, etc;
10 - flash chip drivers (e.g. CFI, NAND, internal flash);
11 - embedded TCL interpreter for easy scripting.
13 Several network interfaces are available for interacting with OpenOCD:
14 telnet, TCL, and GDB. The GDB server enables OpenOCD to function as a
15 "remote target" for source-level debugging of embedded systems using
16 the GNU GDB program (and the others who talk GDB protocol, e.g. IDA
17 Pro).
19 This README file contains an overview of the following topics:
21 - quickstart instructions,
22 - how to find and build more OpenOCD documentation,
23 - list of the supported hardware,
24 - the installation and build process,
25 - packaging tips.
28 # Quickstart for the impatient
30 If you have a popular board then just start OpenOCD with its config,
31 e.g.:
33     openocd -f board/stm32f4discovery.cfg
35 If you are connecting a particular adapter with some specific target,
36 you need to source both the jtag interface and the target configs,
37 e.g.:
39 ```
40 openocd -f interface/ftdi/jtagkey2.cfg -c "transport select jtag" \
41         -f target/ti_calypso.cfg
42 ```
44 ```
45 openocd -f interface/stlink.cfg -c "transport select hla_swd" \
46         -f target/stm32l0.cfg
47 ```
49 After OpenOCD startup, connect GDB with
51     (gdb) target extended-remote localhost:3333
54 # OpenOCD Documentation
56 In addition to the in-tree documentation, the latest manuals may be
57 viewed online at the following URLs:
59   OpenOCD User's Guide:
60     http://openocd.org/doc/html/index.html
62   OpenOCD Developer's Manual:
63     http://openocd.org/doc/doxygen/html/index.html
65 These reflect the latest development versions, so the following section
66 introduces how to build the complete documentation from the package.
68 For more information, refer to these documents or contact the developers
69 by subscribing to the OpenOCD developer mailing list:
71         openocd-devel@lists.sourceforge.net
73 ## Building the OpenOCD Documentation
75 By default the OpenOCD build process prepares documentation in the
76 "Info format" and installs it the standard way, so that `info openocd`
77 can access it.
79 Additionally, the OpenOCD User's Guide can be produced in the
80 following different formats:
82 If `PDFVIEWER` is set, this creates and views the PDF User Guide.
84     make pdf && ${PDFVIEWER} doc/openocd.pdf
86 If `HTMLVIEWER` is set, this creates and views the HTML User Guide.
88     make html && ${HTMLVIEWER} doc/openocd.html/index.html
90 The OpenOCD Developer Manual contains information about the internal
91 architecture and other details about the code:
93 Note: make sure doxygen is installed, type doxygen --version
95     make doxygen && ${HTMLVIEWER} doxygen/index.html
98 # Supported hardware
100 ## JTAG adapters
102 AM335x, ARM-JTAG-EW, ARM-USB-OCD, ARM-USB-TINY, AT91RM9200, axm0432, BCM2835,
103 Bus Blaster, Buspirate, Cadence DPI, Cadence vdebug, Chameleon, CMSIS-DAP,
104 Cortino, Cypress KitProg, DENX, Digilent JTAG-SMT2, DLC 5, DLP-USB1232H,
105 embedded projects, Espressif USB JTAG Programmer,
106 eStick, FlashLINK, FlossJTAG, Flyswatter, Flyswatter2,
107 FTDI FT232R, Gateworks, Hoegl, ICDI, ICEBear, J-Link, JTAG VPI, JTAGkey,
108 JTAGkey2, JTAG-lock-pick, KT-Link, Linux GPIOD, Lisa/L, LPC1768-Stick,
109 Mellanox rshim, MiniModule, NGX, Nuvoton Nu-Link, Nu-Link2, NXHX, NXP IMX GPIO,
110 OOCDLink, Opendous, OpenJTAG, Openmoko, OpenRD, OSBDM, Presto, Redbee,
111 Remote Bitbang, RLink, SheevaPlug devkit, Stellaris evkits,
112 ST-LINK (SWO tracing supported), STM32-PerformanceStick, STR9-comStick,
113 sysfsgpio, Tigard, TI XDS110, TUMPA, Turtelizer, ULINK, USB-A9260, USB-Blaster,
114 USB-JTAG, USBprog, VPACLink, VSLLink, Wiggler, XDS100v2, Xilinx XVC/PCIe,
115 Xverve.
117 ## Debug targets
119 ARM: AArch64, ARM11, ARM7, ARM9, Cortex-A/R (v7-A/R), Cortex-M (ARMv{6/7/8}-M),
120 FA526, Feroceon/Dragonite, XScale.
121 ARCv2, AVR32, DSP563xx, DSP5680xx, EnSilica eSi-RISC, EJTAG (MIPS32, MIPS64),
122 ESP32, ESP32-S2, ESP32-S3, Intel Quark, LS102x-SAP, RISC-V, ST STM8,
123 Xtensa.
125 ## Flash drivers
127 ADUC702x, AT91SAM, AT91SAM9 (NAND), ATH79, ATmega128RFA1, Atmel SAM, AVR, CFI,
128 DSP5680xx, EFM32, EM357, eSi-RISC, eSi-TSMC, EZR32HG, FM3, FM4, Freedom E SPI,
129 GD32, i.MX31, Kinetis, LPC8xx/LPC1xxx/LPC2xxx/LPC541xx, LPC2900, LPC3180, LPC32xx,
130 LPCSPIFI, Marvell QSPI, MAX32, Milandr, MXC, NIIET, nRF51, nRF52 , NuMicro,
131 NUC910, Nuvoton NPCX, onsemi RSL10, Orion/Kirkwood, PIC32mx, PSoC4/5LP/6,
132 Raspberry RP2040, Renesas RPC HF and SH QSPI,
133 S3C24xx, S3C6400, SiM3x, SiFive Freedom E, Stellaris, ST BlueNRG, STM32,
134 STM32 QUAD/OCTO-SPI for Flash/FRAM/EEPROM, STMSMI, STR7x, STR9x, SWM050,
135 TI CC13xx, TI CC26xx, TI CC32xx, TI MSP432, Winner Micro w600, Xilinx XCF,
136 XMC1xxx, XMC4xxx.
139 # Installing OpenOCD
141 ## A Note to OpenOCD Users
143 If you would rather be working "with" OpenOCD rather than "on" it, your
144 operating system or JTAG interface supplier may provide binaries for
145 you in a convenient-enough package.
147 Such packages may be more stable than git mainline, where
148 bleeding-edge development takes place. These "Packagers" produce
149 binary releases of OpenOCD after the developers produces new "release"
150 versions of the source code. Previous versions of OpenOCD cannot be
151 used to diagnose problems with the current release, so users are
152 encouraged to keep in contact with their distribution package
153 maintainers or interface vendors to ensure suitable upgrades appear
154 regularly.
156 Users of these binary versions of OpenOCD must contact their Packager to
157 ask for support or newer versions of the binaries; the OpenOCD
158 developers do not support packages directly.
160 ## A Note to OpenOCD Packagers
162 You are a PACKAGER of OpenOCD if you:
164 - Sell dongles and include pre-built binaries;
165 - Supply tools or IDEs (a development solution integrating OpenOCD);
166 - Build packages (e.g. RPM or DEB files for a GNU/Linux distribution).
168 As a PACKAGER, you will experience first reports of most issues.
169 When you fix those problems for your users, your solution may help
170 prevent hundreds (if not thousands) of other questions from other users.
172 If something does not work for you, please work to inform the OpenOCD
173 developers know how to improve the system or documentation to avoid
174 future problems, and follow-up to help us ensure the issue will be fully
175 resolved in our future releases.
177 That said, the OpenOCD developers would also like you to follow a few
178 suggestions:
180 - Send patches, including config files, upstream, participate in the
181   discussions;
182 - Enable all the options OpenOCD supports, even those unrelated to your
183   particular hardware;
184 - Use "ftdi" interface adapter driver for the FTDI-based devices.
187 # Building OpenOCD
189 The INSTALL file contains generic instructions for running `configure`
190 and compiling the OpenOCD source code. That file is provided by
191 default for all GNU autotools packages. If you are not familiar with
192 the GNU autotools, then you should read those instructions first.
194 The remainder of this document tries to provide some instructions for
195 those looking for a quick-install.
197 ## OpenOCD Dependencies
199 GCC or Clang is currently required to build OpenOCD. The developers
200 have begun to enforce strict code warnings (-Wall, -Werror, -Wextra,
201 and more) and use C99-specific features: inline functions, named
202 initializers, mixing declarations with code, and other tricks. While
203 it may be possible to use other compilers, they must be somewhat
204 modern and could require extending support to conditionally remove
205 GCC-specific extensions.
207 You'll also need:
209 - make
210 - libtool
211 - pkg-config >= 0.23 or pkgconf
213 OpenOCD uses jimtcl library; build from git can retrieve jimtcl as git
214 submodule.
216 Additionally, for building from git:
218 - autoconf >= 2.69
219 - automake >= 1.14
220 - texinfo >= 5.0
222 Optional USB-based adapter drivers need libusb-1.0.
224 Optional USB-Blaster, ASIX Presto and OpenJTAG interface adapter
225 drivers need:
226   - libftdi: http://www.intra2net.com/en/developer/libftdi/index.php
228 Optional CMSIS-DAP adapter driver needs HIDAPI library.
230 Optional linuxgpiod adapter driver needs libgpiod library.
232 Optional J-Link adapter driver needs libjaylink library.
234 Optional ARM disassembly needs capstone library.
236 Optional development script checkpatch needs:
238 - perl
239 - python
240 - python-ply
242 ## Permissions delegation
244 Running OpenOCD with root/administrative permissions is strongly
245 discouraged for security reasons.
247 For USB devices on GNU/Linux you should use the contrib/60-openocd.rules
248 file. It probably belongs somewhere in /etc/udev/rules.d, but
249 consult your operating system documentation to be sure. Do not forget
250 to add yourself to the "plugdev" group.
252 For parallel port adapters on GNU/Linux and FreeBSD please change your
253 "ppdev" (parport* or ppi*) device node permissions accordingly.
255 For parport adapters on Windows you need to run install_giveio.bat
256 (it's also possible to use "ioperm" with Cygwin instead) to give
257 ordinary users permissions for accessing the "LPT" registers directly.
259 ## Compiling OpenOCD
261 To build OpenOCD, use the following sequence of commands:
263     ./bootstrap
264     ./configure [options]
265     make
266     sudo make install
268 The `bootstrap` command is only necessary when building from the Git repository. The `configure` step generates the Makefiles required to build
269 OpenOCD, usually with one or more options provided to it. The first
270 'make' step will build OpenOCD and place the final executable in
271 './src/'. The final (optional) step, `make install`, places all of
272 the files in the required location.
274 To see the list of all the supported options, run `./configure --help`
276 ## Cross-compiling Options
278 Cross-compiling is supported the standard autotools way, you just need
279 to specify the cross-compiling target triplet in the --host option,
280 e.g. for cross-building for Windows 32-bit with MinGW on Debian:
282     ./configure --host=i686-w64-mingw32 [options]
284 To make pkg-config work nicely for cross-compiling, you might need an
285 additional wrapper script as described at
287     https://autotools.io/pkgconfig/cross-compiling.html
289 This is needed to tell pkg-config where to look for the target
290 libraries that OpenOCD depends on. Alternatively, you can specify
291 `*_CFLAGS` and `*_LIBS` environment variables directly, see `./configure
292 --help` for the details.
294 For a more or less complete script that does all this for you, see
296     contrib/cross-build.sh
298 ## Parallel Port Dongles
300 If you want to access the parallel port using the PPDEV interface you
301 have to specify both `--enable-parport` and `--enable-parport-ppdev`, since
302 the later option is an option to the parport driver.
304 The same is true for the `--enable-parport-giveio` option, you have to
305 use both the `--enable-parport` and the `--enable-parport-giveio` option
306 if you want to use giveio instead of ioperm parallel port access
307 method.
310 # Obtaining OpenOCD From GIT
312 You can download the current GIT version with a GIT client of your
313 choice from the main repository:
315     git://git.code.sf.net/p/openocd/code
317 You may prefer to use a mirror:
319     http://repo.or.cz/r/openocd.git
320     git://repo.or.cz/openocd.git
322 Using the GIT command line client, you might use the following command
323 to set up a local copy of the current repository (make sure there is no
324 directory called "openocd" in the current directory):
326     git clone git://git.code.sf.net/p/openocd/code openocd
328 Then you can update that at your convenience using `git pull`.
330 There is also a gitweb interface, which you can use either to browse
331 the repository or to download arbitrary snapshots using HTTP:
333     http://repo.or.cz/w/openocd.git
335 Snapshots are compressed tarballs of the source tree, about 1.3 MBytes
336 each at this writing.