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

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)