doc: Update list of interfaces, targets and boards
[openocd.git] / doc / openocd.texi
index 0d24ddef5c73398b2ac6d6a5be215d7061d7f787..95c38f95471d677895805e19623feff9167c9ee1 100644 (file)
@@ -31,7 +31,7 @@ Permission is granted to copy, distribute and/or modify this document
 under the terms of the GNU Free Documentation License, Version 1.2 or
 any later version published by the Free Software Foundation; with no
 Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
-Texts.  A copy of the license is included in the section entitled ``GNU
+Texts. A copy of the license is included in the section entitled ``GNU
 Free Documentation License''.
 @end quotation
 @end copying
@@ -62,16 +62,17 @@ Free Documentation License''.
 * About::                            About OpenOCD
 * Developers::                       OpenOCD Developer Resources
 * Debug Adapter Hardware::           Debug Adapter Hardware
-* About JIM-Tcl::                    About JIM-Tcl
+* About Jim-Tcl::                    About Jim-Tcl
 * Running::                          Running OpenOCD
 * OpenOCD Project Setup::            OpenOCD Project Setup
 * Config File Guidelines::           Config File Guidelines
 * Daemon Configuration::             Daemon Configuration
-* Debug Adapter Configuration:: Debug Adapter Configuration
+* Debug Adapter Configuration::      Debug Adapter Configuration
 * Reset Configuration::              Reset Configuration
 * TAP Declaration::                  TAP Declaration
 * CPU Configuration::                CPU Configuration
 * Flash Commands::                   Flash Commands
+* Flash Programming::                Flash Programming
 * NAND Flash Commands::              NAND Flash Commands
 * PLD/FPGA Commands::                PLD/FPGA Commands
 * General Commands::                 General Commands
@@ -113,18 +114,18 @@ devices.
 
 It does so with the assistance of a @dfn{debug adapter}, which is
 a small hardware module which helps provide the right kind of
-electrical signaling to the target being debugged.  These are
+electrical signaling to the target being debugged. These are
 required since the debug host (on which OpenOCD runs) won't
 usually have native support for such signaling, or the connector
 needed to hook up to the target.
 
 Such debug adapters support one or more @dfn{transport} protocols,
 each of which involves different electrical signaling (and uses
-different messaging protocols on top of that signaling).  There
+different messaging protocols on top of that signaling). There
 are many types of debug adapter, and little uniformity in what
-they are called.  (There are also product naming differences.)
+they are called. (There are also product naming differences.)
 
-These adapters are sometimes packaged as discrete dongles. which
+These adapters are sometimes packaged as discrete dongles, which
 may generically be called @dfn{hardware interface dongles}.
 Some development boards also integrate them directly, which may
 let the development board can be directly connected to the debug
@@ -134,13 +135,13 @@ For example, a @dfn{JTAG Adapter} supports JTAG
 signaling, and is used to communicate
 with JTAG (IEEE 1149.1) compliant TAPs on your target board.
 A @dfn{TAP} is a ``Test Access Port'', a module which processes
-special instructions and data.  TAPs are daisy-chained within and
-between chips and boards.  JTAG supports debugging and boundary
+special instructions and data. TAPs are daisy-chained within and
+between chips and boards. JTAG supports debugging and boundary
 scan operations.
 
 There are also @dfn{SWD Adapters} that support Serial Wire Debug (SWD)
 signaling to communicate with some newer ARM cores, as well as debug
-adapters which support both JTAG and SWD transports.  SWD only supports
+adapters which support both JTAG and SWD transports. SWD only supports
 debugging, whereas JTAG also supports boundary scan operations.
 
 For some chips, there are also @dfn{Programming Adapters} supporting
@@ -155,50 +156,61 @@ OpenOCD internally. @xref{Debug Adapter Hardware}.
 
 @b{GDB Debug:} It allows ARM7 (ARM7TDMI and ARM720t), ARM9 (ARM920T,
 ARM922T, ARM926EJ--S, ARM966E--S), XScale (PXA25x, IXP42x) and
-Cortex-M3 (Stellaris LM3 and ST STM32) based cores to be
+Cortex-M3 (Stellaris LM3, ST STM32 and Energy Micro EFM32) based cores to be
 debugged via the GDB protocol.
 
 @b{Flash Programing:} Flash writing is supported for external CFI
 compatible NOR flashes (Intel and AMD/Spansion command set) and several
-internal flashes (LPC1700, LPC2000, AT91SAM7, AT91SAM3U, STR7x, STR9x, LM3, and
-STM32x). Preliminary support for various NAND flash controllers
-(LPC3180, Orion, S3C24xx, more) controller is included.
+internal flashes (LPC1700, LPC1800, LPC2000, LPC4300, AT91SAM7, AT91SAM3U,
+STR7x, STR9x, LM3, STM32x and EFM32). Preliminary support for various NAND flash
+controllers (LPC3180, Orion, S3C24xx, more) controller is included.
 
 @section OpenOCD Web Site
 
 The OpenOCD web site provides the latest public news from the community:
 
-@uref{http://openocd.berlios.de/web/}
+@uref{http://openocd.sourceforge.net/}
 
 @section Latest User's Guide:
 
 The user's guide you are now reading may not be the latest one
-available.  A version for more recent code may be available.
-Its HTML form is published irregularly at:
+available. A version for more recent code may be available.
+Its HTML form is published regularly at:
 
-@uref{http://openocd.berlios.de/doc/html/index.html}
+@uref{http://openocd.sourceforge.net/doc/html/index.html}
 
 PDF form is likewise published at:
 
-@uref{http://openocd.berlios.de/doc/pdf/openocd.pdf}
+@uref{http://openocd.sourceforge.net/doc/pdf/openocd.pdf}
 
 @section OpenOCD User's Forum
 
 There is an OpenOCD forum (phpBB) hosted by SparkFun,
-which might be helpful to you.  Note that if you want
+which might be helpful to you. Note that if you want
 anything to come to the attention of developers, you
 should post it to the OpenOCD Developer Mailing List
 instead of this forum.
 
 @uref{http://forum.sparkfun.com/viewforum.php?f=18}
 
+@section OpenOCD User's Mailing List
+
+The OpenOCD User Mailing List provides the primary means of
+communication between users:
+
+@uref{https://lists.sourceforge.net/mailman/listinfo/openocd-user}
+
+@section OpenOCD IRC
+
+Support can also be found on irc:
+@uref{irc://irc.freenode.net/openocd}
 
 @node Developers
 @chapter OpenOCD Developer Resources
 @cindex developers
 
 If you are interested in improving the state of OpenOCD's debugging and
-testing support, new contributions will be welcome.  Motivated developers
+testing support, new contributions will be welcome. Motivated developers
 can produce new target, flash or interface drivers, improve the
 documentation, as well as more conventional bug fixes and enhancements.
 
@@ -208,9 +220,13 @@ or expand the OpenOCD source code.
 @section OpenOCD GIT Repository
 
 During the 0.3.x release cycle, OpenOCD switched from Subversion to
-a GIT repository hosted at SourceForge.  The repository URL is:
+a GIT repository hosted at SourceForge. The repository URL is:
+
+@uref{git://git.code.sf.net/p/openocd/code}
 
-@uref{git://openocd.git.sourceforge.net/gitroot/openocd/openocd}
+or via http
+
+@uref{http://git.code.sf.net/p/openocd/code}
 
 You may prefer to use a mirror and the HTTP protocol:
 
@@ -222,8 +238,6 @@ There are also gitweb pages letting you browse the repository
 with a web browser, or download arbitrary snapshots without
 needing a GIT client:
 
-@uref{http://openocd.git.sourceforge.net/git/gitweb.cgi?p=openocd/openocd}
-
 @uref{http://repo.or.cz/w/openocd.git}
 
 The @file{README} file contains the instructions for building the project
@@ -237,14 +251,14 @@ work from their submitter in order to be updated for newer releases.
 @section Doxygen Developer Manual
 
 During the 0.2.x release cycle, the OpenOCD project began
-providing a Doxygen reference manual.  This document contains more
+providing a Doxygen reference manual. This document contains more
 technical information about the software internals, development
 processes, and similar documentation:
 
-@uref{http://openocd.berlios.de/doc/doxygen/index.html}
+@uref{http://openocd.sourceforge.net/doc/doxygen/html/index.html}
 
 This document is a work-in-progress, but contributions would be welcome
-to fill in the gaps.  All of the source files are provided in-tree,
+to fill in the gaps. All of the source files are provided in-tree,
 listed in the Doxyfile configuration in the top of the source tree.
 
 @section OpenOCD Developer Mailing List
@@ -252,10 +266,10 @@ listed in the Doxyfile configuration in the top of the source tree.
 The OpenOCD Developer Mailing List provides the primary means of
 communication between developers:
 
-@uref{https://lists.berlios.de/mailman/listinfo/openocd-development}
+@uref{https://lists.sourceforge.net/mailman/listinfo/openocd-devel}
 
 Discuss and submit patches to this list.
-The @file{PATCHES.txt} file contains basic information about how
+The @file{HACKING} file contains basic information about how
 to prepare patches.
 
 @section OpenOCD Bug Database
@@ -280,7 +294,7 @@ Defined: @b{dongle}: A small device that plugins into a computer and serves as
 an adapter .... [snip]
 
 In the OpenOCD case, this generally refers to @b{a small adapter} that
-attaches to your computer via USB or the Parallel Printer Port.  One
+attaches to your computer via USB or the Parallel Printer Port. One
 exception is the Zylin ZY1000, packaged as a small box you attach via
 an ethernet cable. The Zylin ZY1000 has the advantage that it does not
 require any drivers to be installed on the developer PC. It also has
@@ -294,12 +308,12 @@ There are several things you should keep in mind when choosing a dongle.
 
 @enumerate
 @item @b{Transport} Does it support the kind of communication that you need?
-OpenOCD focusses mostly on JTAG.  Your version may also support
+OpenOCD focusses mostly on JTAG. Your version may also support
 other ways to communicate with target devices.
 @item @b{Voltage} What voltage is your target - 1.8, 2.8, 3.3, or 5V?
-Does your dongle support it?  You might need a level converter.
+Does your dongle support it? You might need a level converter.
 @item @b{Pinout} What pinout does your target board use?
-Does your dongle support it?  You may be able to use jumper
+Does your dongle support it? You may be able to use jumper
 wires, or an "octopus" connector, to convert pinouts.
 @item @b{Connection} Does your computer have the USB, printer, or
 Ethernet port needed?
@@ -309,8 +323,8 @@ RTCK support? Also known as ``adaptive clocking''
 
 @section Stand alone Systems
 
-@b{ZY1000} See: @url{http://www.zylin.com/zy1000.html} Technically, not a
-dongle, but a standalone box. The ZY1000 has the advantage that it does
+@b{ZY1000} See: @url{http://www.ultsol.com/index.php/component/content/article/8/33-zylin-zy1000-jtag-probe}
+Technically, not a dongle, but a standalone box. The ZY1000 has the advantage that it does
 not require any drivers installed on the developer PC. It also has
 a built in web interface. It supports RTCK/RCLK or adaptive clocking
 and has a built in relay to power cycle targets remotely.
@@ -322,7 +336,7 @@ on a chip from ``Future Technology Devices International'' (FTDI)
 known as the FTDI FT2232; this is a USB full speed (12 Mbps) chip.
 See: @url{http://www.ftdichip.com} for more information.
 In summer 2009, USB high speed (480 Mbps) versions of these FTDI
-chips are starting to become available in JTAG adapters.  (Adapters
+chips are starting to become available in JTAG adapters. (Adapters
 using those high speed FT2232H chips may support adaptive clocking.)
 
 The FT2232 chips are flexible enough to support some other
@@ -336,7 +350,7 @@ a built-in low cost debug adapter and usb-to-serial solution.
 
 @itemize @bullet
 @item @b{usbjtag}
-@* Link @url{http://www.hs-augsburg.de/~hhoegl/proj/usbjtag/usbjtag.html}
+@* Link @url{http://elk.informatik.fh-augsburg.de/hhweb/doc/openocd/usbjtag/usbjtag.html}
 @item @b{jtagkey}
 @* See: @url{http://www.amontec.com/jtagkey.shtml}
 @item @b{jtagkey2}
@@ -346,19 +360,19 @@ a built-in low cost debug adapter and usb-to-serial solution.
 @item @b{signalyzer}
 @* See: @url{http://www.signalyzer.com}
 @item @b{Stellaris Eval Boards}
-@* See: @url{http://www.luminarymicro.com} - The Stellaris eval boards
+@* See: @url{http://www.ti.com} - The Stellaris eval boards
 bundle FT2232-based JTAG and SWD support, which can be used to debug
-the Stellaris chips.  Using separate JTAG adapters is optional.
+the Stellaris chips. Using separate JTAG adapters is optional.
 These boards can also be used in a "pass through" mode as JTAG adapters
 to other target boards, disabling the Stellaris chip.
-@item @b{Luminary ICDI}
-@* See: @url{http://www.luminarymicro.com} - Luminary In-Circuit Debug
+@item @b{TI/Luminary ICDI}
+@* See: @url{http://www.ti.com} - TI/Luminary In-Circuit Debug
 Interface (ICDI) Boards are included in Stellaris LM3S9B9x
-Evaluation Kits.  Like the non-detachable FT2232 support on the other
+Evaluation Kits. Like the non-detachable FT2232 support on the other
 Stellaris eval boards, they can be used to debug other target boards.
 @item @b{olimex-jtag}
 @* See: @url{http://www.olimex.com}
-@item @b{flyswatter}
+@item @b{Flyswatter/Flyswatter2}
 @* See: @url{http://www.tincantools.com}
 @item @b{turtelizer2}
 @* See:
@@ -369,26 +383,34 @@ Stellaris eval boards, they can be used to debug other target boards.
 @item @b{stm32stick}
 @* Link @url{http://www.hitex.com/stm32-stick}
 @item @b{axm0432_jtag}
-@* Axiom AXM-0432 Link @url{http://www.axman.com}
+@* Axiom AXM-0432 Link @url{http://www.axman.com} - NOTE: This JTAG does not appear
+to be available anymore as of April 2012.
 @item @b{cortino}
 @* Link @url{http://www.hitex.com/index.php?id=cortino}
+@item @b{dlp-usb1232h}
+@* Link @url{http://www.dlpdesign.com/usb/usb1232h.shtml}
+@item @b{digilent-hs1}
+@* Link @url{http://www.digilentinc.com/Products/Detail.cfm?Prod=JTAG-HS1}
+@item @b{opendous}
+@* Link @url{http://code.google.com/p/opendous/wiki/JTAG} FT2232H-based
+(OpenHardware).
 @end itemize
 
 @section USB-JTAG / Altera USB-Blaster compatibles
 
 These devices also show up as FTDI devices, but are not
 protocol-compatible with the FT2232 devices. They are, however,
-protocol-compatible among themselves.  USB-JTAG devices typically consist
+protocol-compatible among themselves. USB-JTAG devices typically consist
 of a FT245 followed by a CPLD that understands a particular protocol,
 or emulate this protocol using some other hardware.
 
 They may appear under different USB VID/PID depending on the particular
-product.  The driver can be configured to search for any VID/PID pair
+product. The driver can be configured to search for any VID/PID pair
 (see the section on driver commands).
 
 @itemize
 @item @b{USB-JTAG} Kolja Waschk's USB Blaster-compatible adapter
-@* Link: @url{http://www.ixo.de/info/usb_jtag/}
+@* Link: @url{http://ixo-jtag.sourceforge.net/}
 @item @b{Altera USB-Blaster}
 @* Link: @url{http://www.altera.com/literature/ug/ug_usb_blstr.pdf}
 @end itemize
@@ -404,43 +426,80 @@ AT91SAM764 internally.
 @item @b{SEGGER JLINK}
 @* Link: @url{http://www.segger.com/jlink.html}
 @item @b{IAR J-Link}
-@* Link: @url{http://www.iar.com/website1/1.0.1.0/369/1/index.php}
+@* Link: @url{http://www.iar.com/en/products/hardware-debug-probes/iar-j-link/}
 @end itemize
 
 @section USB RLINK based
-Raisonance has an adapter called @b{RLink}.  It exists in a stripped-down form on the STM32 Primer, permanently attached to the JTAG lines.  It also exists on the STM32 Primer2, but that is wired for SWD and not JTAG, thus not supported.
+Raisonance has an adapter called @b{RLink}. It exists in a stripped-down form on the STM32 Primer,
+permanently attached to the JTAG lines. It also exists on the STM32 Primer2, but that is wired for
+SWD and not JTAG, thus not supported.
 
 @itemize @bullet
 @item @b{Raisonance RLink}
-@* Link: @url{http://www.raisonance.com/products/RLink.php}
+@* Link: @url{http://www.mcu-raisonance.com/~rlink-debugger-programmer__microcontrollers__tool~tool__T018:4cn9ziz4bnx6.html}
 @item @b{STM32 Primer}
 @* Link: @url{http://www.stm32circle.com/resources/stm32primer.php}
 @item @b{STM32 Primer2}
 @* Link: @url{http://www.stm32circle.com/resources/stm32primer2.php}
 @end itemize
 
+@section USB ST-LINK based
+ST Micro has an adapter called @b{ST-LINK}.
+They only work with ST Micro chips, notably STM32 and STM8.
+
+@itemize @bullet
+@item @b{ST-LINK}
+@* This is available standalone and as part of some kits, eg. STM32VLDISCOVERY.
+@* Link: @url{http://www.st.com/internet/evalboard/product/219866.jsp}
+@item @b{ST-LINK/V2}
+@* This is available standalone and as part of some kits, eg. STM32F4DISCOVERY.
+@* Link: @url{http://www.st.com/internet/evalboard/product/251168.jsp}
+@end itemize
+
+For info the original ST-LINK enumerates using the mass storage usb class, however
+it's implementation is completely broken. The result is this causes issues under linux.
+The simplest solution is to get linux to ignore the ST-LINK using one of the following methods:
+@itemize @bullet
+@item modprobe -r usb-storage && modprobe usb-storage quirks=483:3744:i
+@item add "options usb-storage quirks=483:3744:i" to /etc/modprobe.conf
+@end itemize
+
+@section USB TI/Stellaris ICDI based
+Texas Instruments has an adapter called @b{ICDI}.
+It is not to be confused with the FTDI based adapters that were originally fitted to their
+evaluation boards. This is the adapter fitted to the Stellaris LaunchPad.
+
 @section USB Other
 @itemize @bullet
 @item @b{USBprog}
-@* Link: @url{http://www.embedded-projects.net/usbprog} - which uses an Atmel MEGA32 and a UBN9604
+@* Link: @url{http://shop.embedded-projects.net/} - which uses an Atmel MEGA32 and a UBN9604
 
 @item @b{USB - Presto}
 @* Link: @url{http://tools.asix.net/prg_presto.htm}
 
 @item @b{Versaloon-Link}
-@* Link: @url{http://www.simonqian.com/en/Versaloon}
+@* Link: @url{http://www.versaloon.com}
 
 @item @b{ARM-JTAG-EW}
 @* Link: @url{http://www.olimex.com/dev/arm-jtag-ew.html}
 
 @item @b{Buspirate}
 @* Link: @url{http://dangerousprototypes.com/bus-pirate-manual/}
+
+@item @b{opendous}
+@* Link: @url{http://code.google.com/p/opendous-jtag/} - which uses an AT90USB162
+
+@item @b{estick}
+@* Link: @url{http://code.google.com/p/estick-jtag/}
+
+@item @b{Keil ULINK v1}
+@* Link: @url{http://www.keil.com/ulink1/}
 @end itemize
 
 @section IBM PC Parallel Printer Port Based
 
 The two well known ``JTAG Parallel Ports'' cables are the Xilnx DLC5
-and the MacGraigor Wiggler. There are many clones and variations of
+and the Macraigor Wiggler. There are many clones and variations of
 these on the market.
 
 Note that parallel ports are becoming much less common, so if you
@@ -463,8 +522,7 @@ produced, PDF schematics are easily found and it is easy to make.
 @* Link: @url{http://www.gateworks.com/products/avila_accessories/gw16042.php}
 
 @item @b{Wiggler2}
-@*@uref{http://www.ccac.rwth-aachen.de/@/~michaels/@/index.php/hardware/@/armjtag,
-Improved parallel-port wiggler-style JTAG adapter}
+@* Link: @url{http://www.ccac.rwth-aachen.de/~michaels/index.php/hardware/armjtag}
 
 @item @b{Wiggler_ntrst_inverted}
 @* Yet another variation - See the source code, src/jtag/parport.c
@@ -487,8 +545,7 @@ Improved parallel-port wiggler-style JTAG adapter}
 
 @item @b{flashlink}
 @* From ST Microsystems;
-@uref{http://www.st.com/stonline/@/products/literature/um/7889.pdf,
-FlashLINK JTAG programing cable for PSD and uPSD}
+@* Link: @url{http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/DATA_BRIEF/DM00039500.pdf}
 
 @end itemize
 
@@ -503,38 +560,43 @@ FlashLINK JTAG programing cable for PSD and uPSD}
 
 @end itemize
 
-@node About JIM-Tcl
-@chapter About JIM-Tcl
-@cindex JIM Tcl
+@node About Jim-Tcl
+@chapter About Jim-Tcl
+@cindex Jim-Tcl
 @cindex tcl
 
-OpenOCD includes a small ``Tcl Interpreter'' known as JIM-Tcl.
+OpenOCD uses a small ``Tcl Interpreter'' known as Jim-Tcl.
 This programming language provides a simple and extensible
 command interpreter.
 
-All commands presented in this Guide are extensions to JIM-Tcl.
+All commands presented in this Guide are extensions to Jim-Tcl.
 You can use them as simple commands, without needing to learn
 much of anything about Tcl.
 Alternatively, can write Tcl programs with them.
 
-You can learn more about JIM at its website,  @url{http://jim.berlios.de}.
+You can learn more about Jim at its website, @url{http://jim.berlios.de}.
+There is an active and responsive community, get on the mailing list
+if you have any questions. Jim-Tcl maintainers also lurk on the
+OpenOCD mailing list.
 
 @itemize @bullet
-@item @b{JIM vs. Tcl}
-@* JIM-TCL is a stripped down version of the well known Tcl language,
-which can be found here: @url{http://www.tcl.tk}. JIM-Tcl has far
-fewer features. JIM-Tcl is a single .C file and a single .H file and
+@item @b{Jim vs. Tcl}
+@* Jim-Tcl is a stripped down version of the well known Tcl language,
+which can be found here: @url{http://www.tcl.tk}. Jim-Tcl has far
+fewer features. Jim-Tcl is several dozens of .C files and .H files and
 implements the basic Tcl command set. In contrast: Tcl 8.6 is a
 4.2 MB .zip file containing 1540 files.
 
 @item @b{Missing Features}
 @* Our practice has been: Add/clone the real Tcl feature if/when
-needed. We welcome JIM Tcl improvements, not bloat.
+needed. We welcome Jim-Tcl improvements, not bloat. Also there
+are a large number of optional Jim-Tcl features that are not
+enabled in OpenOCD.
 
 @item @b{Scripts}
-@* OpenOCD configuration scripts are JIM Tcl Scripts. OpenOCD's
+@* OpenOCD configuration scripts are Jim-Tcl Scripts. OpenOCD's
 command interpreter today is a mixture of (newer)
-JIM-Tcl commands, and (older) the orginal command interpreter.
+Jim-Tcl commands, and (older) the orginal command interpreter.
 
 @item @b{Commands}
 @* At the OpenOCD telnet command line (or via the GDB monitor command) one
@@ -543,7 +605,10 @@ Some of the commands documented in this guide are implemented
 as Tcl scripts, from a @file{startup.tcl} file internal to the server.
 
 @item @b{Historical Note}
-@* JIM-Tcl was introduced to OpenOCD in spring 2008.
+@* Jim-Tcl was introduced to OpenOCD in spring 2008. Fall 2010,
+before OpenOCD 0.5 release OpenOCD switched to using Jim Tcl
+as a git submodule, which greatly simplified upgrading Jim Tcl
+to benefit from new features and bugfixes in Jim Tcl.
 
 @item @b{Need a crash course in Tcl?}
 @*@xref{Tcl Crash Course}.
@@ -556,9 +621,9 @@ as Tcl scripts, from a @file{startup.tcl} file internal to the server.
 @cindex directory search
 
 Properly installing OpenOCD sets up your operating system to grant it access
-to the debug adapters.  On Linux, this usually involves installing a file
-in @file{/etc/udev/rules.d,} so OpenOCD has permissions.  MS-Windows needs
-complex and confusing driver configuration for every peripheral.  Such issues
+to the debug adapters. On Linux, this usually involves installing a file
+in @file{/etc/udev/rules.d,} so OpenOCD has permissions. MS-Windows needs
+complex and confusing driver configuration for every peripheral. Such issues
 are unique to each operating system, and are not detailed in this User's Guide.
 
 Then later you will invoke the OpenOCD server, with various options to
@@ -598,16 +663,16 @@ The first found file with a matching file name will be used.
 
 @quotation Note
 Don't try to use configuration script names or paths which
-include the "#" character.  That character begins Tcl comments.  
+include the "#" character. That character begins Tcl comments.
 @end quotation
 
 @section Simple setup, no customization
 
 In the best case, you can use two scripts from one of the script
 libraries, hook up your JTAG adapter, and start the server ... and
-your JTAG setup will just work "out of the box".  Always try to
+your JTAG setup will just work "out of the box". Always try to
 start by reusing those scripts, but assume you'll need more
-customization even if this works.  @xref{OpenOCD Project Setup}.
+customization even if this works. @xref{OpenOCD Project Setup}.
 
 If you find a script for your JTAG adapter, and for your board or
 target, you may be able to hook up your JTAG adapter then start
@@ -624,13 +689,13 @@ If all goes well you'll see output something like
 @example
 Open On-Chip Debugger 0.4.0 (2010-01-14-15:06)
 For bug reports, read
-        http://openocd.berlios.de/doc/doxygen/bugs.html
+        http://openocd.sourceforge.net/doc/doxygen/bugs.html
 Info : JTAG tap: lm3s.cpu tap/device found: 0x3ba00477
        (mfg: 0x23b, part: 0xba00, ver: 0x3)
 @end example
 
 Seeing that "tap/device found" message, and no warnings, means
-the JTAG communication is working.  That's a key milestone, but
+the JTAG communication is working. That's a key milestone, but
 you'll probably need more project-specific setup.
 
 @section What OpenOCD does as it starts
@@ -638,7 +703,7 @@ you'll probably need more project-specific setup.
 OpenOCD starts by processing the configuration commands provided
 on the command line or, if there were no @option{-c command} or
 @option{-f file.cfg} options given, in @file{openocd.cfg}.
-@xref{Configuration Stage}.
+@xref{configurationstage,,Configuration Stage}.
 At the end of the configuration stage it verifies the JTAG scan
 chain defined using those commands; your configuration should
 ensure that this always succeeds.
@@ -654,7 +719,7 @@ those channels.
 If you are having problems, you can enable internal debug messages via
 the @option{-d} option.
 
-Also it is possible to interleave JIM-Tcl commands w/config scripts using the
+Also it is possible to interleave Jim-Tcl commands w/config scripts using the
 @option{-c} command line switch.
 
 To enable debug output (when reporting problems or working on OpenOCD
@@ -662,14 +727,12 @@ itself), use the @option{-d} command line switch. This sets the
 @option{debug_level} to "3", outputting the most information,
 including debug messages. The default setting is "2", outputting only
 informational messages, warnings and errors. You can also change this
-setting from within a telnet or gdb session using @command{debug_level
-<n>} (@pxref{debug_level}).
+setting from within a telnet or gdb session using @command{debug_level<n>}
+(@pxref{debuglevel,,debug_level}).
 
 You can redirect all output from the daemon to a file using the
 @option{-l <logfile>} switch.
 
-For details on the @option{-p} option. @xref{Connecting to GDB}.
-
 Note! OpenOCD will launch the GDB & telnet server even if it can not
 establish a connection with the target. In general, it is possible for
 the JTAG controller to be unresponsive until the target is set up
@@ -714,7 +777,7 @@ Not all JTAG adapters have the level shifters needed to work
 with 1.2 Volt boards.
 
 @item @emph{Be certain the cable is properly oriented} or you might
-damage your board.  In most cases there are only two possible
+damage your board. In most cases there are only two possible
 ways to connect the cable.
 Connect the JTAG cable from your adapter to the board.
 Be sure it's firmly connected.
@@ -726,7 +789,7 @@ housing, which must match a key on the JTAG cable's female connector.
 If there's no housing, then you must look carefully and
 make sure pin 1 on the cable hooks up to pin 1 on the board.
 Ribbon cables are frequently all grey except for a wire on one
-edge, which is red.  The red wire is pin 1.
+edge, which is red. The red wire is pin 1.
 
 Sometimes dongles provide cables where one end is an ``octopus'' of
 color coded single-wire connectors, instead of a connector block.
@@ -741,7 +804,7 @@ you are using to run OpenOCD.
 For Ethernet, consult the documentation and your network administrator.
 
 For USB based JTAG adapters you have an easy sanity check at this point:
-does the host operating system see the JTAG adapter?  If that host is an
+does the host operating system see the JTAG adapter? If that host is an
 MS-Windows host, you'll need to install a driver before OpenOCD works.
 
 @item @emph{Connect the adapter's power supply, if needed.}
@@ -820,7 +883,7 @@ same in a script, the variable @var{VAR} will have no value
 that can be tested in a later script.
 @end quotation
 
-Here we will focus on the simpler solution:  one user config
+Here we will focus on the simpler solution: one user config
 file, including basic configuration plus any TCL procedures
 to simplify your work.
 
@@ -840,7 +903,7 @@ For example, OpenOCD distributes a @file{scripts} directory
 (probably in @file{/usr/share/openocd/scripts} on Linux).
 Board and tool vendors can provide these too, as can individual
 user sites; the @option{-s} command line option lets you say
-where to find these files.  (@xref{Running}.)
+where to find these files. (@xref{Running}.)
 The AT91SAM7X256 example above works this way.
 
 Three main types of non-user configuration file each have their
@@ -852,7 +915,7 @@ own subdirectory in the @file{scripts} directory:
 @item @b{target} -- the chips which integrate CPUs and other JTAG TAPs
 @end enumerate
 
-Best case:  include just two files, and they handle everything else.
+Best case: include just two files, and they handle everything else.
 The first is an interface config file.
 The second is board-specific, and it sets up the JTAG TAPs and
 their GDB targets (by deferring to some @file{target.cfg} file),
@@ -875,7 +938,7 @@ need help from OpenOCD to discover what's on the board.
 Once you find the JTAG TAPs, you can just search for appropriate
 target and board
 configuration files ... or write your own, from the bottom up.
-@xref{Autoprobing}.
+@xref{autoprobing,,Autoprobing}.
 
 @item You can often reuse some standard config files but
 need to write a few new ones, probably a @file{board.cfg} file.
@@ -923,11 +986,11 @@ that the @code{reset-init} event handler does.
 Likewise, the @command{arm9 vector_catch} command (or
 @cindex vector_catch
 its siblings @command{xscale vector_catch}
-and @command{cortex_m3 vector_catch}) can be a timesaver
+and @command{cortex_m vector_catch}) can be a timesaver
 during some debug sessions, but don't make everyone use that either.
 Keep those kinds of debugging aids in your user config file,
 along with messaging and tracing setup.
-(@xref{Software Debug Messages and Tracing}.)
+(@xref{softwaredebugmessagesandtracing,,Software Debug Messages and Tracing}.)
 
 @item
 You might need to override some defaults.
@@ -937,7 +1000,7 @@ work area if your application needs much SRAM.
 @item
 TCP/IP port configuration is another example of something which
 is environment-specific, and should only appear in
-a user config file.  @xref{TCP/IP Ports}.
+a user config file. @xref{tcpipports,,TCP/IP Ports}.
 @end itemize
 
 @section Project-Specific Utilities
@@ -976,7 +1039,7 @@ based microcontroller application instead of a boot loader.)
 
 @example
 proc newboot @{ @} @{
-    # Reset, leaving the CPU halted.  The "reset-init" event
+    # Reset, leaving the CPU halted. The "reset-init" event
     # proc gives faster access to the CPU and to NOR flash;
     # "reset halt" would be slower.
     reset init
@@ -1015,7 +1078,7 @@ handling issues like:
 
 @item @b{Watchdog Timers}...
 Watchog timers are typically used to automatically reset systems if
-some application task doesn't periodically reset the timer.  (The
+some application task doesn't periodically reset the timer. (The
 assumption is that the system has locked up if the task can't run.)
 When a JTAG debugger halts the system, that task won't be able to run
 and reset the timer ... potentially causing resets in the middle of
@@ -1026,15 +1089,15 @@ needs to be debugged just like all other parts of your firmware.
 That might however be your only option.
 
 Look instead for chip-specific ways to stop the watchdog from counting
-while the system is in a debug halt state.  It may be simplest to set
-that non-counting mode in your debugger startup scripts.  You may however
+while the system is in a debug halt state. It may be simplest to set
+that non-counting mode in your debugger startup scripts. You may however
 need a different approach when, for example, a motor could be physically
-damaged by firmware remaining inactive in a debug halt state.  That might
+damaged by firmware remaining inactive in a debug halt state. That might
 involve a type of firmware mode where that "non-counting" mode is disabled
 at the beginning then re-enabled at the end; a watchdog reset might fire
 and complicate the debug session, but hardware (or people) would be
 protected.@footnote{Note that many systems support a "monitor mode" debug
-that is a somewhat cleaner way to address such issues.  You can think of
+that is a somewhat cleaner way to address such issues. You can think of
 it as only halting part of the system, maybe just one task,
 instead of the whole thing.
 At this writing, January 2010, OpenOCD based debugging does not support
@@ -1047,7 +1110,7 @@ toolchains@footnote{See chapter 8 "Semihosting" in
 @uref{http://infocenter.arm.com/help/topic/com.arm.doc.dui0203i/DUI0203I_rvct_developer_guide.pdf,
 ARM DUI 0203I}, the "RealView Compilation Tools Developer Guide".
 The CodeSourcery EABI toolchain also includes a semihosting library.},
-your target code can use I/O facilities on the debug host.  That library
+your target code can use I/O facilities on the debug host. That library
 provides a small set of system calls which are handled by OpenOCD.
 It can let the debugger provide your system console and a file system,
 helping with early debugging or providing a more capable environment
@@ -1094,7 +1157,7 @@ Your application may want to deliver various debugging messages
 over JTAG, by @emph{linking with a small library of code}
 provided with OpenOCD and using the utilities there to send
 various kinds of message.
-@xref{Software Debug Messages and Tracing}.
+@xref{softwaredebugmessagesandtracing,,Software Debug Messages and Tracing}.
 
 @end itemize
 
@@ -1102,7 +1165,7 @@ various kinds of message.
 
 Chip vendors often provide software development boards which
 are highly configurable, so that they can support all options
-that product boards may require.  @emph{Make sure that any
+that product boards may require. @emph{Make sure that any
 jumpers or switches match the system configuration you are
 working with.}
 
@@ -1121,13 +1184,13 @@ EMU0 and EMU1 signals (which OpenOCD won't currently control).
 
 @item @b{Boot Modes} ...
 Complex chips often support multiple boot modes, controlled
-by external jumpers.  Make sure this is set up correctly.
+by external jumpers. Make sure this is set up correctly.
 For example many i.MX boards from NXP need to be jumpered
 to "ATX mode" to start booting using the on-chip ROM, when
 using second stage bootloader code stored in a NAND flash chip.
 
 Such explicit configuration is common, and not limited to
-booting from NAND.  You might also need to set jumpers to
+booting from NAND. You might also need to set jumpers to
 start booting using code loaded from an MMC/SD card; external
 SPI flash; Ethernet, UART, or USB links; NOR flash; OneNAND
 flash; some external host; or various other sources.
@@ -1135,10 +1198,10 @@ flash; some external host; or various other sources.
 
 @item @b{Memory Addressing} ...
 Boards which support multiple boot modes may also have jumpers
-to configure memory addressing.  One board, for example, jumpers
+to configure memory addressing. One board, for example, jumpers
 external chipselect 0 (used for booting) to address either
 a large SRAM (which must be pre-loaded via JTAG), NOR flash,
-or NAND flash.  When it's jumpered to address NAND flash, that
+or NAND flash. When it's jumpered to address NAND flash, that
 board must also be told to start booting from on-chip ROM.
 
 Your @file{board.cfg} file may also need to be told this jumper
@@ -1147,7 +1210,7 @@ using @command{flash bank} or instead declare NAND flash with
 @command{nand device}; and likewise which probe to perform in
 its @code{reset-init} handler.
 
-A closely related issue is bus width.  Jumpers might need to
+A closely related issue is bus width. Jumpers might need to
 distinguish between 8 bit or 16 bit bus access for the flash
 used to start booting.
 
@@ -1158,8 +1221,8 @@ multiple audio codec chips).
 This interacts with software
 configuration of pin multiplexing, where for example a
 given pin may be routed either to the MMC/SD controller
-or the GPIO controller.  It also often interacts with
-configuration jumpers.  One jumper may be used to route
+or the GPIO controller. It also often interacts with
+configuration jumpers. One jumper may be used to route
 signals to an MMC/SD card slot or an expansion bus (which
 might in turn affect booting); others might control which
 audio or video codecs are used.
@@ -1170,10 +1233,10 @@ Plus you should of course have @code{reset-init} event handlers
 which set up the hardware to match that jumper configuration.
 That includes in particular any oscillator or PLL used to clock
 the CPU, and any memory controllers needed to access external
-memory and peripherals.  Without such handlers, you won't be
+memory and peripherals. Without such handlers, you won't be
 able to access those resources without working target firmware
 which can do that setup ... this can be awkward when you're
-trying to debug that target firmware.  Even if there's a ROM
+trying to debug that target firmware. Even if there's a ROM
 bootloader which handles a few issues, it rarely provides full
 access to all board-specific capabilities.
 
@@ -1194,59 +1257,138 @@ Use them as-is where you can; or as models for new files.
 These are for debug adapters.
 Files that configure JTAG adapters go here.
 @example
-$ ls interface
-arm-jtag-ew.cfg          hitex_str9-comstick.cfg  oocdlink.cfg
-arm-usb-ocd.cfg          icebear.cfg              openocd-usb.cfg
-at91rm9200.cfg           jlink.cfg                parport.cfg
-axm0432.cfg              jtagkey2.cfg             parport_dlc5.cfg
-calao-usb-a9260-c01.cfg  jtagkey.cfg              rlink.cfg
-calao-usb-a9260-c02.cfg  jtagkey-tiny.cfg         sheevaplug.cfg
-calao-usb-a9260.cfg      luminary.cfg             signalyzer.cfg
-chameleon.cfg            luminary-icdi.cfg        stm32-stick.cfg
-cortino.cfg              luminary-lm3s811.cfg     turtelizer2.cfg
-dummy.cfg                olimex-arm-usb-ocd.cfg   usbprog.cfg
-flyswatter.cfg           olimex-jtag-tiny.cfg     vsllink.cfg
+$ ls interface -R
+interface/:
+altera-usb-blaster.cfg    hilscher_nxhx50_re.cfg     openocd-usb-hs.cfg
+arm-jtag-ew.cfg           hitex_str9-comstick.cfg    openrd.cfg
+at91rm9200.cfg            icebear.cfg                osbdm.cfg
+axm0432.cfg               jlink.cfg                  parport.cfg
+busblaster.cfg            jtagkey2.cfg               parport_dlc5.cfg
+buspirate.cfg             jtagkey2p.cfg              redbee-econotag.cfg
+calao-usb-a9260-c01.cfg   jtagkey.cfg                redbee-usb.cfg
+calao-usb-a9260-c02.cfg   jtagkey-tiny.cfg           rlink.cfg
+calao-usb-a9260.cfg       jtag-lock-pick_tiny_2.cfg  sheevaplug.cfg
+chameleon.cfg             kt-link.cfg                signalyzer.cfg
+cortino.cfg               lisa-l.cfg                 signalyzer-h2.cfg
+digilent-hs1.cfg          luminary.cfg               signalyzer-h4.cfg
+dlp-usb1232h.cfg          luminary-icdi.cfg          signalyzer-lite.cfg
+dummy.cfg                 luminary-lm3s811.cfg       stlink-v1.cfg
+estick.cfg                minimodule.cfg             stlink-v2.cfg
+flashlink.cfg             neodb.cfg                  stm32-stick.cfg
+flossjtag.cfg             ngxtech.cfg                sysfsgpio-raspberrypi.cfg
+flossjtag-noeeprom.cfg    olimex-arm-usb-ocd.cfg     ti-icdi.cfg
+flyswatter2.cfg           olimex-arm-usb-ocd-h.cfg   turtelizer2.cfg
+flyswatter.cfg            olimex-arm-usb-tiny-h.cfg  ulink.cfg
+ftdi                      olimex-jtag-tiny.cfg       usb-jtag.cfg
+hilscher_nxhx10_etm.cfg   oocdlink.cfg               usbprog.cfg
+hilscher_nxhx500_etm.cfg  opendous.cfg               vpaclink.cfg
+hilscher_nxhx500_re.cfg   opendous_ftdi.cfg          vsllink.cfg
+hilscher_nxhx50_etm.cfg   openocd-usb.cfg            xds100v2.cfg
+
+interface/ftdi:
+axm0432.cfg               icebear.cfg                oocdlink.cfg
+calao-usb-a9260-c01.cfg   jtagkey2.cfg               opendous_ftdi.cfg
+calao-usb-a9260-c02.cfg   jtagkey2p.cfg              openocd-usb.cfg
+cortino.cfg               jtagkey.cfg                openocd-usb-hs.cfg
+dlp-usb1232h.cfg          jtag-lock-pick_tiny_2.cfg  openrd.cfg
+dp_busblaster.cfg         kt-link.cfg                redbee-econotag.cfg
+flossjtag.cfg             lisa-l.cfg                 redbee-usb.cfg
+flossjtag-noeeprom.cfg    luminary.cfg               sheevaplug.cfg
+flyswatter2.cfg           luminary-icdi.cfg          signalyzer.cfg
+flyswatter.cfg            luminary-lm3s811.cfg       signalyzer-lite.cfg
+hilscher_nxhx10_etm.cfg   minimodule.cfg             stm32-stick.cfg
+hilscher_nxhx500_etm.cfg  neodb.cfg                  turtelizer2-revB.cfg
+hilscher_nxhx500_re.cfg   ngxtech.cfg                turtelizer2-revC.cfg
+hilscher_nxhx50_etm.cfg   olimex-arm-usb-ocd.cfg     vpaclink.cfg
+hilscher_nxhx50_re.cfg    olimex-arm-usb-ocd-h.cfg   xds100v2.cfg
+hitex_lpc1768stick.cfg    olimex-arm-usb-tiny-h.cfg
+hitex_str9-comstick.cfg   olimex-jtag-tiny.cfg
 $
 @end example
 @item @file{board} ...
-think Circuit Board, PWA, PCB, they go by many names.  Board files
+think Circuit Board, PWA, PCB, they go by many names. Board files
 contain initialization items that are specific to a board.
 They reuse target configuration files, since the same
 microprocessor chips are used on many boards,
-but support for external parts varies widely.  For
+but support for external parts varies widely. For
 example, the SDRAM initialization sequence for the board, or the type
-of external flash and what address it uses.  Any initialization
+of external flash and what address it uses. Any initialization
 sequence to enable that external flash or SDRAM should be found in the
-board file. Boards may also contain multiple targets:  two CPUs; or
+board file. Boards may also contain multiple targets: two CPUs; or
 a CPU and an FPGA.
 @example
 $ ls board
-arm_evaluator7t.cfg               keil_mcb1700.cfg
-at91rm9200-dk.cfg                 keil_mcb2140.cfg
-at91sam9g20-ek.cfg                linksys_nslu2.cfg
-atmel_at91sam7s-ek.cfg            logicpd_imx27.cfg
-atmel_at91sam9260-ek.cfg          mini2440.cfg
-atmel_sam3u_ek.cfg                olimex_LPC2378STK.cfg
-crossbow_tech_imote2.cfg          olimex_lpc_h2148.cfg
-csb337.cfg                        olimex_sam7_ex256.cfg
-csb732.cfg                        olimex_sam9_l9260.cfg
-digi_connectcore_wi-9c.cfg        olimex_stm32_h103.cfg
-dm355evm.cfg                      omap2420_h4.cfg
-dm365evm.cfg                      osk5912.cfg
-dm6446evm.cfg                     pic-p32mx.cfg
-eir.cfg                           propox_mmnet1001.cfg
-ek-lm3s1968.cfg                   pxa255_sst.cfg
-ek-lm3s3748.cfg                   sheevaplug.cfg
-ek-lm3s811.cfg                    stm3210e_eval.cfg
-ek-lm3s9b9x.cfg                   stm32f10x_128k_eval.cfg
-hammer.cfg                        str910-eval.cfg
-hitex_lpc2929.cfg                 telo.cfg
-hitex_stm32-performancestick.cfg  ti_beagleboard.cfg
-hitex_str9-comstick.cfg           topas910.cfg
-iar_str912_sk.cfg                 topasa900.cfg
-imx27ads.cfg                      unknown_at91sam9260.cfg
-imx27lnst.cfg                     x300t.cfg
-imx31pdk.cfg                      zy1000.cfg
+actux3.cfg                        lpc1850_spifi_generic.cfg
+am3517evm.cfg                     lpc4350_spifi_generic.cfg
+arm_evaluator7t.cfg               lubbock.cfg
+at91cap7a-stk-sdram.cfg           mcb1700.cfg
+at91eb40a.cfg                     microchip_explorer16.cfg
+at91rm9200-dk.cfg                 mini2440.cfg
+at91rm9200-ek.cfg                 mini6410.cfg
+at91sam9261-ek.cfg                netgear-dg834v3.cfg
+at91sam9263-ek.cfg                olimex_LPC2378STK.cfg
+at91sam9g20-ek.cfg                olimex_lpc_h2148.cfg
+atmel_at91sam7s-ek.cfg            olimex_sam7_ex256.cfg
+atmel_at91sam9260-ek.cfg          olimex_sam9_l9260.cfg
+atmel_at91sam9rl-ek.cfg           olimex_stm32_h103.cfg
+atmel_sam3n_ek.cfg                olimex_stm32_h107.cfg
+atmel_sam3s_ek.cfg                olimex_stm32_p107.cfg
+atmel_sam3u_ek.cfg                omap2420_h4.cfg
+atmel_sam3x_ek.cfg                open-bldc.cfg
+atmel_sam4s_ek.cfg                openrd.cfg
+balloon3-cpu.cfg                  osk5912.cfg
+colibri.cfg                       phone_se_j100i.cfg
+crossbow_tech_imote2.cfg          phytec_lpc3250.cfg
+csb337.cfg                        pic-p32mx.cfg
+csb732.cfg                        propox_mmnet1001.cfg
+da850evm.cfg                      pxa255_sst.cfg
+digi_connectcore_wi-9c.cfg        redbee.cfg
+diolan_lpc4350-db1.cfg            rsc-w910.cfg
+dm355evm.cfg                      sheevaplug.cfg
+dm365evm.cfg                      smdk6410.cfg
+dm6446evm.cfg                     spear300evb.cfg
+efikamx.cfg                       spear300evb_mod.cfg
+eir.cfg                           spear310evb20.cfg
+ek-lm3s1968.cfg                   spear310evb20_mod.cfg
+ek-lm3s3748.cfg                   spear320cpu.cfg
+ek-lm3s6965.cfg                   spear320cpu_mod.cfg
+ek-lm3s811.cfg                    steval_pcc010.cfg
+ek-lm3s811-revb.cfg               stm320518_eval_stlink.cfg
+ek-lm3s8962.cfg                   stm32100b_eval.cfg
+ek-lm3s9b9x.cfg                   stm3210b_eval.cfg
+ek-lm3s9d92.cfg                   stm3210c_eval.cfg
+ek-lm4f120xl.cfg                  stm3210e_eval.cfg
+ek-lm4f232.cfg                    stm3220g_eval.cfg
+embedded-artists_lpc2478-32.cfg   stm3220g_eval_stlink.cfg
+ethernut3.cfg                     stm3241g_eval.cfg
+glyn_tonga2.cfg                   stm3241g_eval_stlink.cfg
+hammer.cfg                        stm32f0discovery.cfg
+hilscher_nxdb500sys.cfg           stm32f3discovery.cfg
+hilscher_nxeb500hmi.cfg           stm32f4discovery.cfg
+hilscher_nxhx10.cfg               stm32ldiscovery.cfg
+hilscher_nxhx500.cfg              stm32vldiscovery.cfg
+hilscher_nxhx50.cfg               str910-eval.cfg
+hilscher_nxsb100.cfg              telo.cfg
+hitex_lpc1768stick.cfg            ti_am335xevm.cfg
+hitex_lpc2929.cfg                 ti_beagleboard.cfg
+hitex_stm32-performancestick.cfg  ti_beagleboard_xm.cfg
+hitex_str9-comstick.cfg           ti_beaglebone.cfg
+iar_lpc1768.cfg                   ti_blaze.cfg
+iar_str912_sk.cfg                 ti_pandaboard.cfg
+icnova_imx53_sodimm.cfg           ti_pandaboard_es.cfg
+icnova_sam9g45_sodimm.cfg         topas910.cfg
+imx27ads.cfg                      topasa900.cfg
+imx27lnst.cfg                     twr-k60f120m.cfg
+imx28evk.cfg                      twr-k60n512.cfg
+imx31pdk.cfg                      tx25_stk5.cfg
+imx35pdk.cfg                      tx27_stk5.cfg
+imx53loco.cfg                     unknown_at91sam9260.cfg
+keil_mcb1700.cfg                  uptech_2410.cfg
+keil_mcb2140.cfg                  verdex.cfg
+kwikstik.cfg                      voipac.cfg
+linksys_nslu2.cfg                 voltcraft_dso-3062c.cfg
+lisa-l.cfg                        x300t.cfg
+logicpd_imx27.cfg                 zy1000.cfg
 $
 @end example
 @item @file{target} ...
@@ -1258,32 +1400,83 @@ When a chip has multiple TAPs (maybe it has both ARM and DSP cores),
 the target config file defines all of them.
 @example
 $ ls target
-aduc702x.cfg     imx27.cfg     pxa255.cfg
-ar71xx.cfg       imx31.cfg     pxa270.cfg
-at91eb40a.cfg    imx35.cfg     readme.txt
-at91r40008.cfg   is5114.cfg    sam7se512.cfg
-at91rm9200.cfg   ixp42x.cfg    sam7x256.cfg
-at91sam3u1c.cfg  lm3s1968.cfg  samsung_s3c2410.cfg
-at91sam3u1e.cfg  lm3s3748.cfg  samsung_s3c2440.cfg
-at91sam3u2c.cfg  lm3s6965.cfg  samsung_s3c2450.cfg
-at91sam3u2e.cfg  lm3s811.cfg   samsung_s3c4510.cfg
-at91sam3u4c.cfg  lm3s9b9x.cfg  samsung_s3c6410.cfg
-at91sam3u4e.cfg  lpc1768.cfg   sharp_lh79532.cfg
-at91sam3uXX.cfg  lpc2103.cfg   smdk6410.cfg
-at91sam7sx.cfg   lpc2124.cfg   smp8634.cfg
-at91sam9260.cfg  lpc2129.cfg   stm32.cfg
-c100.cfg         lpc2148.cfg   str710.cfg
-c100config.tcl   lpc2294.cfg   str730.cfg
-c100helper.tcl   lpc2378.cfg   str750.cfg
-c100regs.tcl     lpc2478.cfg   str912.cfg
-cs351x.cfg       lpc2900.cfg   telo.cfg
-davinci.cfg      mega128.cfg   ti_dm355.cfg
-dragonite.cfg    netx500.cfg   ti_dm365.cfg
-epc9301.cfg      omap2420.cfg  ti_dm6446.cfg
-feroceon.cfg     omap3530.cfg  tmpa900.cfg
-icepick.cfg      omap5912.cfg  tmpa910.cfg
-imx21.cfg        pic32mx.cfg   xba_revA3.cfg
-$
+aduc702x.cfg                       lpc1763.cfg
+am335x.cfg                         lpc1764.cfg
+amdm37x.cfg                        lpc1765.cfg
+ar71xx.cfg                         lpc1766.cfg
+at32ap7000.cfg                     lpc1767.cfg
+at91r40008.cfg                     lpc1768.cfg
+at91rm9200.cfg                     lpc1769.cfg
+at91sam3ax_4x.cfg                  lpc1788.cfg
+at91sam3ax_8x.cfg                  lpc17xx.cfg
+at91sam3ax_xx.cfg                  lpc1850.cfg
+at91sam3nXX.cfg                    lpc2103.cfg
+at91sam3sXX.cfg                    lpc2124.cfg
+at91sam3u1c.cfg                    lpc2129.cfg
+at91sam3u1e.cfg                    lpc2148.cfg
+at91sam3u2c.cfg                    lpc2294.cfg
+at91sam3u2e.cfg                    lpc2378.cfg
+at91sam3u4c.cfg                    lpc2460.cfg
+at91sam3u4e.cfg                    lpc2478.cfg
+at91sam3uxx.cfg                    lpc2900.cfg
+at91sam3XXX.cfg                    lpc2xxx.cfg
+at91sam4sd32x.cfg                  lpc3131.cfg
+at91sam4sXX.cfg                    lpc3250.cfg
+at91sam4XXX.cfg                    lpc4350.cfg
+at91sam7se512.cfg                  lpc4350.cfg.orig
+at91sam7sx.cfg                     mc13224v.cfg
+at91sam7x256.cfg                   nuc910.cfg
+at91sam7x512.cfg                   omap2420.cfg
+at91sam9260.cfg                    omap3530.cfg
+at91sam9260_ext_RAM_ext_flash.cfg  omap4430.cfg
+at91sam9261.cfg                    omap4460.cfg
+at91sam9263.cfg                    omap5912.cfg
+at91sam9.cfg                       omapl138.cfg
+at91sam9g10.cfg                    pic32mx.cfg
+at91sam9g20.cfg                    pxa255.cfg
+at91sam9g45.cfg                    pxa270.cfg
+at91sam9rl.cfg                     pxa3xx.cfg
+atmega128.cfg                      readme.txt
+avr32.cfg                          samsung_s3c2410.cfg
+c100.cfg                           samsung_s3c2440.cfg
+c100config.tcl                     samsung_s3c2450.cfg
+c100helper.tcl                     samsung_s3c4510.cfg
+c100regs.tcl                       samsung_s3c6410.cfg
+cs351x.cfg                         sharp_lh79532.cfg
+davinci.cfg                        smp8634.cfg
+dragonite.cfg                      spear3xx.cfg
+dsp56321.cfg                       stellaris.cfg
+dsp568013.cfg                      stellaris_icdi.cfg
+dsp568037.cfg                      stm32f0x_stlink.cfg
+efm32_stlink.cfg                   stm32f1x.cfg
+epc9301.cfg                        stm32f1x_stlink.cfg
+faux.cfg                           stm32f2x.cfg
+feroceon.cfg                       stm32f2x_stlink.cfg
+fm3.cfg                            stm32f3x.cfg
+hilscher_netx10.cfg                stm32f3x_stlink.cfg
+hilscher_netx500.cfg               stm32f4x.cfg
+hilscher_netx50.cfg                stm32f4x_stlink.cfg
+icepick.cfg                        stm32l.cfg
+imx21.cfg                          stm32lx_dual_bank.cfg
+imx25.cfg                          stm32lx_stlink.cfg
+imx27.cfg                          stm32_stlink.cfg
+imx28.cfg                          stm32w108_stlink.cfg
+imx31.cfg                          stm32xl.cfg
+imx35.cfg                          str710.cfg
+imx51.cfg                          str730.cfg
+imx53.cfg                          str750.cfg
+imx6.cfg                           str912.cfg
+imx.cfg                            swj-dp.tcl
+is5114.cfg                         test_reset_syntax_error.cfg
+ixp42x.cfg                         test_syntax_error.cfg
+k40.cfg                            ti-ar7.cfg
+k60.cfg                            ti_calypso.cfg
+lpc1751.cfg                        ti_dm355.cfg
+lpc1752.cfg                        ti_dm365.cfg
+lpc1754.cfg                        ti_dm6446.cfg
+lpc1756.cfg                        tmpa900.cfg
+lpc1758.cfg                        tmpa910.cfg
+lpc1759.cfg                        u8500.cfg
 @end example
 @item @emph{more} ... browse for other library files which may be useful.
 For example, there are various generic and CPU-specific utilities.
@@ -1310,7 +1503,7 @@ have only been used by the developer who created it.
 
 A separate chapter gives information about how to set these up.
 @xref{Debug Adapter Configuration}.
-Read the OpenOCD source code (and Developer's GUide)
+Read the OpenOCD source code (and Developer's Guide)
 if you have a new kind of hardware interface
 and need to provide a driver for it.
 
@@ -1331,15 +1524,15 @@ In summary the board files should contain (if present)
 
 @enumerate
 @item One or more @command{source [target/...cfg]} statements
-@item NOR flash configuration (@pxref{NOR Configuration})
-@item NAND flash configuration (@pxref{NAND Configuration})
+@item NOR flash configuration (@pxref{norconfiguration,,NOR Configuration})
+@item NAND flash configuration (@pxref{nandconfiguration,,NAND Configuration})
 @item Target @code{reset} handlers for SDRAM and I/O configuration
 @item JTAG adapter reset configuration (@pxref{Reset Configuration})
 @item All things that are not ``inside a chip''
 @end enumerate
 
 Generic things inside target chips belong in target config files,
-not board config files.  So for example a @code{reset-init} event
+not board config files. So for example a @code{reset-init} event
 handler should know board-specific oscillator and PLL parameters,
 which it passes to target-specific utility code.
 
@@ -1354,7 +1547,7 @@ In addition to target-specific utility code, another way that
 board and target config files communicate is by following a
 convention on how to use certain variables.
 
-The full Tcl/Tk language supports ``namespaces'', but JIM-Tcl does not.
+The full Tcl/Tk language supports ``namespaces'', but Jim-Tcl does not.
 Thus the rule we follow in OpenOCD is this: Variables that begin with
 a leading underscore are temporary in nature, and can be modified and
 used at will within a target configuration file.
@@ -1390,12 +1583,12 @@ or the @code{reset-init} event handlers to initialize external DRAM
 or (assuming it needs it) load a configuration into the FPGA.
 Such features are usually needed for low-level work with many boards,
 where ``low level'' implies that the board initialization software may
-not be working.  (That's a common reason to need JTAG tools.  Another
+not be working. (That's a common reason to need JTAG tools. Another
 is to enable working with microcontroller-based systems, which often
 have no debugging support except a JTAG connector.)
 
 Target config files may also export utility functions to board and user
-config files.  Such functions should use name prefixes, to help avoid
+config files. Such functions should use name prefixes, to help avoid
 naming collisions.
 
 Board files could also accept input variables from user config files.
@@ -1459,7 +1652,7 @@ handler is one of the most important.
 Except on microcontrollers, the basic job of @code{reset-init} event
 handlers is setting up flash and DRAM, as normally handled by boot loaders.
 Microcontrollers rarely use boot loaders; they run right out of their
-on-chip flash and SRAM memory.  But they may want to use one of these
+on-chip flash and SRAM memory. But they may want to use one of these
 handlers too, if just for developer convenience.
 
 @quotation Note
@@ -1468,7 +1661,7 @@ are included here.
 Instead, look at the board config files distributed with OpenOCD.
 If you have a boot loader, its source code will help; so will
 configuration files for other JTAG tools
-(@pxref{Translating Configuration Files}).
+(@pxref{translatingconfigurationfiles,,Translating Configuration Files}).
 @end quotation
 
 Some of this code could probably be shared between different boards.
@@ -1483,7 +1676,7 @@ the next developer doing such work.
 (@emph{You might be that next person} trying to reuse init code!)
 
 The last thing normally done in a @code{reset-init} handler is probing
-whatever flash memory was configured.  For most chips that needs to be
+whatever flash memory was configured. For most chips that needs to be
 done while the associated target is halted, either because JTAG memory
 access uses the CPU or to prevent conflicting CPU access.
 
@@ -1492,7 +1685,7 @@ access uses the CPU or to prevent conflicting CPU access.
 Before your @code{reset-init} handler has set up
 the PLLs and clocking, you may need to run with
 a low JTAG clock rate.
-@xref{JTAG Speed}.
+@xref{jtagspeed,,JTAG Speed}.
 Then you'd increase that rate after your handler has
 made it possible to use the faster JTAG clock.
 When the initial low speed is board-specific, for example
@@ -1516,10 +1709,53 @@ solution just avoids using that instruction with JTAG debuggers.
 If both the chip and the board support adaptive clocking,
 use the @command{jtag_rclk}
 command, in case your board is used with JTAG adapter which
-also supports it.  Otherwise use @command{adapter_khz}.
+also supports it. Otherwise use @command{adapter_khz}.
 Set the slow rate at the beginning of the reset sequence,
 and the faster rate as soon as the clocks are at full speed.
 
+@anchor{theinitboardprocedure}
+@subsection The init_board procedure
+@cindex init_board procedure
+
+The concept of @code{init_board} procedure is very similar to @code{init_targets}
+(@xref{theinittargetsprocedure,,The init_targets procedure}.) - it's a replacement of ``linear''
+configuration scripts. This procedure is meant to be executed when OpenOCD enters run stage
+(@xref{enteringtherunstage,,Entering the Run Stage},) after @code{init_targets}. The idea to have
+spearate @code{init_targets} and @code{init_board} procedures is to allow the first one to configure
+everything target specific (internal flash, internal RAM, etc.) and the second one to configure
+everything board specific (reset signals, chip frequency, reset-init event handler, external memory, etc.).
+Additionally ``linear'' board config file will most likely fail when target config file uses
+@code{init_targets} scheme (``linear'' script is executed before @code{init} and @code{init_targets} - after),
+so separating these two configuration stages is very convenient, as the easiest way to overcome this
+problem is to convert board config file to use @code{init_board} procedure. Board config scripts don't
+need to override @code{init_targets} defined in target config files when they only need to to add some specifics.
+
+Just as @code{init_targets}, the @code{init_board} procedure can be overriden by ``next level'' script (which sources
+the original), allowing greater code reuse.
+
+@example
+### board_file.cfg ###
+
+# source target file that does most of the config in init_targets
+source [find target/target.cfg]
+
+proc enable_fast_clock @{@} @{
+    # enables fast on-board clock source
+    # configures the chip to use it
+@}
+
+# initialize only board specifics - reset, clock, adapter frequency
+proc init_board @{@} @{
+    reset_config trst_and_srst trst_pulls_srst
+
+    $_TARGETNAME configure -event reset-init @{
+        adapter_khz 1
+        enable_fast_clock
+        adapter_khz 10000
+    @}
+@}
+@end example
+
 @section Target Config Files
 @cindex config file, target
 @cindex target config file
@@ -1579,7 +1815,7 @@ if @{ [info exists ENDIAN] @} @{
 @}
 
 # TAP identifiers may change as chips mature, for example with
-# new revision fields (the "3" here).  Pick a good default; you
+# new revision fields (the "3" here). Pick a good default; you
 # can pass several such identifiers to the "jtag newtap" command.
 if @{ [info exists CPUTAPID ] @} @{
    set _CPUTAPID $CPUTAPID
@@ -1636,7 +1872,7 @@ ERROR:      got: mfg: 0x787, part: 0xf0f0, ver: 0x3
 @end example
 
 There are more complex examples too, with chips that have
-multiple TAPs.  Ones worth looking at include:
+multiple TAPs. Ones worth looking at include:
 
 @itemize
 @item @file{target/omap3530.cfg} -- with disabled ARM and DSP,
@@ -1672,10 +1908,68 @@ $_TARGETNAME configure -work-area-phys 0x00200000 \
              -work-area-size 0x4000 -work-area-backup 0
 @end example
 
+@anchor{definecputargetsworkinginsmp}
+@subsection Define CPU targets working in SMP
+@cindex SMP
+After setting targets, you can define a list of targets working in SMP.
+
+@example
+set _TARGETNAME_1 $_CHIPNAME.cpu1
+set _TARGETNAME_2 $_CHIPNAME.cpu2
+target create $_TARGETNAME_1 cortex_a -chain-position $_CHIPNAME.dap \
+-coreid 0 -dbgbase $_DAP_DBG1
+target create $_TARGETNAME_2 cortex_a -chain-position $_CHIPNAME.dap \
+-coreid 1 -dbgbase $_DAP_DBG2
+#define 2 targets working in smp.
+target smp $_CHIPNAME.cpu2 $_CHIPNAME.cpu1
+@end example
+In the above example on cortex_a, 2 cpus are working in SMP.
+In SMP only one GDB instance is created and :
+@itemize @bullet
+@item a set of hardware breakpoint sets the same breakpoint on all targets in the list.
+@item halt command triggers the halt of all targets in the list.
+@item resume command triggers the write context and the restart of all targets in the list.
+@item following a breakpoint: the target stopped by the breakpoint is displayed to the GDB session.
+@item dedicated GDB serial protocol packets are implemented for switching/retrieving the target
+displayed by the GDB session @pxref{usingopenocdsmpwithgdb,,Using OpenOCD SMP with GDB}.
+@end itemize
+
+The SMP behaviour can be disabled/enabled dynamically. On cortex_a following
+command have been implemented.
+@itemize @bullet
+@item cortex_a smp_on : enable SMP mode, behaviour is as described above.
+@item cortex_a smp_off : disable SMP mode, the current target is the one
+displayed in the GDB session, only this target is now controlled by GDB
+session. This behaviour is useful during system boot up.
+@item cortex_a smp_gdb : display/fix the core id displayed in GDB session see
+following example.
+@end itemize
+
+@example
+>cortex_a smp_gdb
+gdb coreid  0 -> -1
+#0 : coreid 0 is displayed to GDB ,
+#-> -1 : next resume triggers a real resume
+> cortex_a smp_gdb 1
+gdb coreid  0 -> 1
+#0 :coreid 0 is displayed to GDB ,
+#->1  : next resume displays coreid 1 to GDB
+> resume
+> cortex_a smp_gdb
+gdb coreid  1 -> 1
+#1 :coreid 1 is displayed to GDB ,
+#->1 : next resume displays coreid 1 to GDB
+> cortex_a smp_gdb -1
+gdb coreid  1 -> -1
+#1 :coreid 1 is displayed to GDB,
+#->-1 : next resume triggers a real resume
+@end example
+
+
 @subsection Chip Reset Setup
 
 As a rule, you should put the @command{reset_config} command
-into the board file.  Most things you think you know about a
+into the board file. Most things you think you know about a
 chip can be tweaked by the board.
 
 Some chips have specific ways the TRST and SRST signals are
@@ -1692,7 +1986,7 @@ don't want to reset all targets at once.
 Such a handler might write to chip registers to force a reset,
 use a JRC to do that (preferable -- the target may be wedged!),
 or force a watchdog timer to trigger.
-(For Cortex-M3 targets, this is not necessary.  The target
+(For Cortex-M targets, this is not necessary.  The target
 driver knows how to use trigger an NVIC reset when SRST is
 not available.)
 
@@ -1713,7 +2007,7 @@ slower clock than they will use later.
 That means that after reset (and potentially, as OpenOCD
 first starts up) they must use a slower JTAG clock rate
 than they will use later.
-@xref{JTAG Speed}.
+@xref{jtagspeed,,JTAG Speed}.
 
 @quotation Important
 When you are debugging code that runs right after chip
@@ -1723,6 +2017,50 @@ OpenOCD verifies the scan chain after reset,
 look at how you are setting up JTAG clocking.
 @end quotation
 
+@anchor{theinittargetsprocedure}
+@subsection The init_targets procedure
+@cindex init_targets procedure
+
+Target config files can either be ``linear'' (script executed line-by-line when parsed in
+configuration stage, @xref{configurationstage,,Configuration Stage},) or they can contain a special
+procedure called @code{init_targets}, which will be executed when entering run stage
+(after parsing all config files or after @code{init} command, @xref{enteringtherunstage,,Entering the Run Stage}.)
+Such procedure can be overriden by ``next level'' script (which sources the original).
+This concept faciliates code reuse when basic target config files provide generic configuration
+procedures and @code{init_targets} procedure, which can then be sourced and enchanced or changed in
+a ``more specific'' target config file. This is not possible with ``linear'' config scripts,
+because sourcing them executes every initialization commands they provide.
+
+@example
+### generic_file.cfg ###
+
+proc setup_my_chip @{chip_name flash_size ram_size@} @{
+    # basic initialization procedure ...
+@}
+
+proc init_targets @{@} @{
+    # initializes generic chip with 4kB of flash and 1kB of RAM
+    setup_my_chip MY_GENERIC_CHIP 4096 1024
+@}
+
+### specific_file.cfg ###
+
+source [find target/generic_file.cfg]
+
+proc init_targets @{@} @{
+    # initializes specific chip with 128kB of flash and 64kB of RAM
+    setup_my_chip MY_CHIP_WITH_128K_FLASH_64KB_RAM 131072 65536
+@}
+@end example
+
+The easiest way to convert ``linear'' config files to @code{init_targets} version is to
+enclose every line of ``code'' (i.e. not @code{source} commands, procedures, etc.) in this procedure.
+
+For an example of this scheme see LPC2000 target config files.
+
+The @code{init_boards} procedure is a similar concept concerning board config files
+(@xref{theinitboardprocedure,,The init_board procedure}.)
+
 @subsection ARM Core Specific Hacks
 
 If the chip has a DCC, enable it. If the chip is an ARM9 with some
@@ -1731,10 +2069,10 @@ special high speed download features - enable it.
 If present, the MMU, the MPU and the CACHE should be disabled.
 
 Some ARM cores are equipped with trace support, which permits
-examination of the instruction and data bus activity.  Trace
+examination of the instruction and data bus activity. Trace
 activity is controlled through an ``Embedded Trace Module'' (ETM)
-on one of the core's scan chains.  The ETM emits voluminous data
-through a ``trace port''.  (@xref{ARM Hardware Tracing}.)
+on one of the core's scan chains. The ETM emits voluminous data
+through a ``trace port''. (@xref{armhardwaretracing,,ARM Hardware Tracing}.)
 If you are using an external trace port,
 configure it in your board config file.
 If you are using an on-chip ``Embedded Trace Buffer'' (ETB),
@@ -1762,7 +2100,7 @@ Examples:
 @item pxa270 - again - CS0 flash - it goes in the board file.
 @end itemize
 
-@anchor{Translating Configuration Files}
+@anchor{translatingconfigurationfiles}
 @section Translating Configuration Files
 @cindex translation
 If you have a configuration file for another hardware debugger
@@ -1809,7 +2147,7 @@ The commands here are commonly found in the openocd.cfg file and are
 used to specify what TCP/IP ports are used, and how GDB should be
 supported.
 
-@anchor{Configuration Stage}
+@anchor{configurationstage}
 @section Configuration Stage
 @cindex configuration stage
 @cindex config command
@@ -1835,6 +2173,7 @@ may access or activate TAPs.
 After it leaves this stage, configuration commands may no
 longer be issued.
 
+@anchor{enteringtherunstage}
 @section Entering the Run Stage
 
 The first thing OpenOCD does after leaving the configuration
@@ -1859,7 +2198,7 @@ entry to the run stage.
 
 @deffn {Config Command} init
 This command terminates the configuration stage and
-enters the run stage.  This helps when you need to have
+enters the run stage. This helps when you need to have
 the startup scripts manage tasks such as resetting the target,
 programming flash, etc. To reset the CPU upon startup, add "init" and
 "reset" at the end of the config script or at the end of the OpenOCD
@@ -1873,7 +2212,7 @@ configuration files and/or command line options.
 openocd.cfg file to force OpenOCD to ``initialize'' and make the
 targets ready. For example: If your openocd.cfg file needs to
 read/write memory on your target, @command{init} must occur before
-the memory read/write commands.  This includes @command{nand probe}.
+the memory read/write commands. This includes @command{nand probe}.
 @end deffn
 
 @deffn {Overridable Procedure} jtag_init
@@ -1892,7 +2231,7 @@ This is done by calling @command{jtag arp_init}
 (or @command{jtag arp_init-reset}).
 @end deffn
 
-@anchor{TCP/IP Ports}
+@anchor{tcpipports}
 @section TCP/IP Ports
 @cindex TCP port
 @cindex server
@@ -1915,7 +2254,7 @@ communicate via pipes(stdin/out or named pipes). The name
 "gdb_port" stuck because it covers probably more than 90% of
 the normal use cases.
 
-No arguments reports GDB port. "pipe" means listen to stdin 
+No arguments reports GDB port. "pipe" means listen to stdin
 output to stdout, an integer is base port number, "disable"
 disables the gdb server.
 
@@ -1925,11 +2264,11 @@ output to a file so as not to flood the stdin/out pipes.
 The -p/--pipe option is deprecated and a warning is printed
 as it is equivalent to passing in -c "gdb_port pipe; log_output openocd.log".
 
-Any other string is interpreted as named pipe to listen to. 
+Any other string is interpreted as named pipe to listen to.
 Output pipe is the same name as input pipe, but with 'o' appended,
 e.g. /var/gdb, /var/gdbo.
-                               
-The GDB port for the first target will be the base port, the 
+
+The GDB port for the first target will be the base port, the
 second target will listen on gdb_port + 1, and so on.
 When not specified during the configuration stage,
 the port @var{number} defaults to 3333.
@@ -1954,25 +2293,25 @@ the port @var{number} defaults to 4444.
 When specified as zero, this port is not activated.
 @end deffn
 
-@anchor{GDB Configuration}
+@anchor{gdbconfiguration}
 @section GDB Configuration
 @cindex GDB
 @cindex GDB configuration
 You can reconfigure some GDB behaviors if needed.
 The ones listed here are static and global.
-@xref{Target Configuration}, about configuring individual targets.
-@xref{Target Events}, about configuring target-specific event handling.
+@xref{targetconfiguration,,Target Configuration}, about configuring individual targets.
+@xref{targetevents,,Target Events}, about configuring target-specific event handling.
 
-@anchor{gdb_breakpoint_override}
+@anchor{gdbbreakpointoverride}
 @deffn {Command} gdb_breakpoint_override [@option{hard}|@option{soft}|@option{disable}]
 Force breakpoint type for gdb @command{break} commands.
 This option supports GDB GUIs which don't
 distinguish hard versus soft breakpoints, if the default OpenOCD and
-GDB behaviour is not sufficient.  GDB normally uses hardware
+GDB behaviour is not sufficient. GDB normally uses hardware
 breakpoints if the memory map has been set up for flash regions.
 @end deffn
 
-@anchor{gdb_flash_program}
+@anchor{gdbflashprogram}
 @deffn {Config Command} gdb_flash_program (@option{enable}|@option{disable})
 Set to @option{enable} to cause OpenOCD to program the flash memory when a
 vFlash packet is received.
@@ -1985,7 +2324,7 @@ requested. GDB will then know when to set hardware breakpoints, and program flas
 using the GDB load command. @command{gdb_flash_program enable} must also be enabled
 for flash programming to work.
 Default behaviour is @option{enable}.
-@xref{gdb_flash_program}.
+@xref{gdbflashprogram,,gdb_flash_program}.
 @end deffn
 
 @deffn {Config Command} gdb_report_data_abort (@option{enable}|@option{disable})
@@ -1995,7 +2334,7 @@ The default behaviour is @option{disable};
 use @option{enable} see these errors reported.
 @end deffn
 
-@anchor{Event Polling}
+@anchor{eventpolling}
 @section Event Polling
 
 Hardware debuggers are parts of asynchronous systems,
@@ -2036,7 +2375,7 @@ which is normally done in the background.
 
 @deffn Command poll [@option{on}|@option{off}]
 Poll the current target for its current state.
-(Also, @pxref{target curstate}.)
+(Also, @pxref{targetcurstate,,target curstate}.)
 If that target is in debug mode, architecture
 specific information about the current state is printed.
 An optional parameter
@@ -2063,16 +2402,16 @@ MMU: disabled, D-Cache: disabled, I-Cache: enabled
 @cindex interface config file
 
 Correctly installing OpenOCD includes making your operating system give
-OpenOCD access to debug adapters.  Once that has been done, Tcl commands
+OpenOCD access to debug adapters. Once that has been done, Tcl commands
 are used to select which one is used, and to configure how it is used.
 
 @quotation Note
 Because OpenOCD started out with a focus purely on JTAG, you may find
 places where it wrongly presumes JTAG is the only transport protocol
-in use.  Be aware that recent versions of OpenOCD are removing that
-limitation.  JTAG remains more functional than most other transports.
+in use. Be aware that recent versions of OpenOCD are removing that
+limitation. JTAG remains more functional than most other transports.
 Other transports do not support boundary scan operations, or may be
-specific to a given chip vendor.  Some might be usable only for
+specific to a given chip vendor. Some might be usable only for
 programming flash memory, instead of also for debugging.
 @end quotation
 
@@ -2174,6 +2513,10 @@ Cirrus Logic EP93xx based single-board computer bit-banging (in development)
 
 @deffn {Interface Driver} {ft2232}
 FTDI FT2232 (USB) based devices over one of the userspace libraries.
+
+Note that this driver has several flaws and the @command{ftdi} driver is
+recommended as its replacement.
+
 These interfaces have several commands, used to configure the driver
 before initializing the JTAG scan chain:
 
@@ -2201,15 +2544,15 @@ Currently valid layout @var{name} values include:
 @item @b{axm0432_jtag} Axiom AXM-0432
 @item @b{comstick} Hitex STR9 comstick
 @item @b{cortino} Hitex Cortino JTAG interface
-@item @b{evb_lm3s811} Luminary Micro EVB_LM3S811 as a JTAG interface,
+@item @b{evb_lm3s811} TI/Luminary Micro EVB_LM3S811 as a JTAG interface,
 either for the local Cortex-M3 (SRST only)
 or in a passthrough mode (neither SRST nor TRST)
 This layout can not support the SWO trace mechanism, and should be
 used only for older boards (before rev C).
-@item @b{luminary_icdi} This layout should be used with most Luminary
+@item @b{luminary_icdi} This layout should be used with most TI/Luminary
 eval boards, including Rev C LM3S811 eval boards and the eponymous
 ICDI boards, to debug either the local Cortex-M3 or in passthrough mode
-to debug some other target.  It can support the SWO trace mechanism.
+to debug some other target. It can support the SWO trace mechanism.
 @item @b{flyswatter} Tin Can Tools Flyswatter
 @item @b{icebear} ICEbear JTAG adapter from Section 5
 @item @b{jtagkey} Amontec JTAGkey and JTAGkey-Tiny (and compatibles)
@@ -2246,6 +2589,11 @@ also reduces the risk of timeouts before receiving the expected number of bytes.
 The OpenOCD default value is 2 and for some systems a value of 10 has proved useful.
 @end deffn
 
+@deffn {Config Command} {ft2232_channel} channel
+Used to select the channel of the ft2232 chip to use (between 1 and 4).
+The default value is 1.
+@end deffn
+
 For example, the interface config file for a
 Turtelizer JTAG Adapter looks something like this:
 
@@ -2257,9 +2605,159 @@ ft2232_vid_pid 0x0403 0xbdc8
 @end example
 @end deffn
 
+@deffn {Interface Driver} {ftdi}
+This driver is for adapters using the MPSSE (Multi-Protocol Synchronous Serial
+Engine) mode built into many FTDI chips, such as the FT2232, FT4232 and FT232H.
+It is a complete rewrite to address a large number of problems with the ft2232
+interface driver.
+
+The driver is using libusb-1.0 in asynchronous mode to talk to the FTDI device,
+bypassing intermediate libraries like libftdi of D2XX. Performance-wise it is
+consistently faster than the ft2232 driver, sometimes several times faster.
+
+A major improvement of this driver is that support for new FTDI based adapters
+can be added competely through configuration files, without the need to patch
+and rebuild OpenOCD.
+
+The driver uses a signal abstraction to enable Tcl configuration files to
+define outputs for one or several FTDI GPIO. These outputs can then be
+controlled using the @command{ftdi_set_signal} command. Special signal names
+are reserved for nTRST, nSRST and LED (for blink) so that they, if defined,
+will be used for their customary purpose.
+
+Depending on the type of buffer attached to the FTDI GPIO, the outputs have to
+be controlled differently. In order to support tristateable signals such as
+nSRST, both a data GPIO and an output-enable GPIO can be specified for each
+signal. The following output buffer configurations are supported:
+
+@itemize @minus
+@item Push-pull with one FTDI output as (non-)inverted data line
+@item Open drain with one FTDI output as (non-)inverted output-enable
+@item Tristate with one FTDI output as (non-)inverted data line and another
+      FTDI output as (non-)inverted output-enable
+@item Unbuffered, using the FTDI GPIO as a tristate output directly by
+      switching data and direction as necessary
+@end itemize
+
+These interfaces have several commands, used to configure the driver
+before initializing the JTAG scan chain:
+
+@deffn {Config Command} {ftdi_vid_pid} [vid pid]+
+The vendor ID and product ID of the adapter. If not specified, the FTDI
+default values are used.
+Currently, up to eight [@var{vid}, @var{pid}] pairs may be given, e.g.
+@example
+ftdi_vid_pid 0x0403 0xcff8 0x15ba 0x0003
+@end example
+@end deffn
+
+@deffn {Config Command} {ftdi_device_desc} description
+Provides the USB device description (the @emph{iProduct string})
+of the adapter. If not specified, the device description is ignored
+during device selection.
+@end deffn
+
+@deffn {Config Command} {ftdi_serial} serial-number
+Specifies the @var{serial-number} of the adapter to use,
+in case the vendor provides unique IDs and more than one adapter
+is connected to the host.
+If not specified, serial numbers are not considered.
+(Note that USB serial numbers can be arbitrary Unicode strings,
+and are not restricted to containing only decimal digits.)
+@end deffn
+
+@deffn {Config Command} {ftdi_channel} channel
+Selects the channel of the FTDI device to use for MPSSE operations. Most
+adapters use the default, channel 0, but there are exceptions.
+@end deffn
+
+@deffn {Config Command} {ftdi_layout_init} data direction
+Specifies the initial values of the FTDI GPIO data and direction registers.
+Each value is a 16-bit number corresponding to the concatenation of the high
+and low FTDI GPIO registers. The values should be selected based on the
+schematics of the adapter, such that all signals are set to safe levels with
+minimal impact on the target system. Avoid floating inputs, conflicting outputs
+and initially asserted reset signals.
+@end deffn
+
+@deffn {Config Command} {ftdi_layout_signal} name [@option{-data}|@option{-ndata} data_mask] [@option{-oe}|@option{-noe} oe_mask]
+Creates a signal with the specified @var{name}, controlled by one or more FTDI
+GPIO pins via a range of possible buffer connections. The masks are FTDI GPIO
+register bitmasks to tell the driver the connection and type of the output
+buffer driving the respective signal. @var{data_mask} is the bitmask for the
+pin(s) connected to the data input of the output buffer. @option{-ndata} is
+used with inverting data inputs and @option{-data} with non-inverting inputs.
+The @option{-oe} (or @option{-noe}) option tells where the output-enable (or
+not-output-enable) input to the output buffer is connected.
+
+Both @var{data_mask} and @var{oe_mask} need not be specified. For example, a
+simple open-collector transistor driver would be specified with @option{-oe}
+only. In that case the signal can only be set to drive low or to Hi-Z and the
+driver will complain if the signal is set to drive high. Which means that if
+it's a reset signal, @command{reset_config} must be specified as
+@option{srst_open_drain}, not @option{srst_push_pull}.
+
+A special case is provided when @option{-data} and @option{-oe} is set to the
+same bitmask. Then the FTDI pin is considered being connected straight to the
+target without any buffer. The FTDI pin is then switched between output and
+input as necessary to provide the full set of low, high and Hi-Z
+characteristics. In all other cases, the pins specified in a signal definition
+are always driven by the FTDI.
+@end deffn
+
+@deffn {Command} {ftdi_set_signal} name @option{0}|@option{1}|@option{z}
+Set a previously defined signal to the specified level.
+@itemize @minus
+@item @option{0}, drive low
+@item @option{1}, drive high
+@item @option{z}, set to high-impedance
+@end itemize
+@end deffn
+
+For example adapter definitions, see the configuration files shipped in the
+@file{interface/ftdi} directory.
+@end deffn
+
+@deffn {Interface Driver} {remote_bitbang}
+Drive JTAG from a remote process. This sets up a UNIX or TCP socket connection
+with a remote process and sends ASCII encoded bitbang requests to that process
+instead of directly driving JTAG.
+
+The remote_bitbang driver is useful for debugging software running on
+processors which are being simulated.
+
+@deffn {Config Command} {remote_bitbang_port} number
+Specifies the TCP port of the remote process to connect to or 0 to use UNIX
+sockets instead of TCP.
+@end deffn
+
+@deffn {Config Command} {remote_bitbang_host} hostname
+Specifies the hostname of the remote process to connect to using TCP, or the
+name of the UNIX socket to use if remote_bitbang_port is 0.
+@end deffn
+
+For example, to connect remotely via TCP to the host foobar you might have
+something like:
+
+@example
+interface remote_bitbang
+remote_bitbang_port 3335
+remote_bitbang_host foobar
+@end example
+
+To connect to another process running locally via UNIX sockets with socket
+named mysocket:
+
+@example
+interface remote_bitbang
+remote_bitbang_port 0
+remote_bitbang_host mysocket
+@end example
+@end deffn
+
 @deffn {Interface Driver} {usb_blaster}
 USB JTAG/USB-Blaster compatibles over one of the userspace libraries
-for FTDI chips.  These interfaces have several commands, used to
+for FTDI chips. These interfaces have several commands, used to
 configure the driver before initializing the JTAG scan chain:
 
 @deffn {Config Command} {usb_blaster_device_desc} description
@@ -2310,11 +2808,56 @@ This is a write-once setting.
 @end deffn
 
 @deffn {Interface Driver} {jlink}
-Segger jlink USB adapter
-@c command:    jlink_info
-@c     dumps status
-@c command:    jlink_hw_jtag (2|3)
-@c     sets version 2 or 3
+Segger J-Link family of USB adapters. It currently supports only the JTAG transport.
+
+@quotation Compatibility Note
+Segger released many firmware versions for the many harware versions they
+produced. OpenOCD was extensively tested and intended to run on all of them,
+but some combinations were reported as incompatible. As a general
+recommendation, it is advisable to use the latest firmware version
+available for each hardware version. However the current V8 is a moving
+target, and Segger firmware versions released after the OpenOCD was
+released may not be compatible. In such cases it is recommended to
+revert to the last known functional version. For 0.5.0, this is from
+"Feb  8 2012 14:30:39", packed with 4.42c. For 0.6.0, the last known
+version is from "May  3 2012 18:36:22", packed with 4.46f.
+@end quotation
+
+@deffn {Command} {jlink caps}
+Display the device firmware capabilities.
+@end deffn
+@deffn {Command} {jlink info}
+Display various device information, like hardware version, firmware version, current bus status.
+@end deffn
+@deffn {Command} {jlink hw_jtag} [@option{2}|@option{3}]
+Set the JTAG protocol version to be used. Without argument, show the actual JTAG protocol version.
+@end deffn
+@deffn {Command} {jlink config}
+Display the J-Link configuration.
+@end deffn
+@deffn {Command} {jlink config kickstart} [val]
+Set the Kickstart power on JTAG-pin 19. Without argument, show the Kickstart configuration.
+@end deffn
+@deffn {Command} {jlink config mac_address} [@option{ff:ff:ff:ff:ff:ff}]
+Set the MAC address of the J-Link Pro. Without argument, show the MAC address.
+@end deffn
+@deffn {Command} {jlink config ip} [@option{A.B.C.D}(@option{/E}|@option{F.G.H.I})]
+Set the IP configuration of the J-Link Pro, where A.B.C.D is the IP address,
+     E the bit of the subnet mask and
+     F.G.H.I the subnet mask. Without arguments, show the IP configuration.
+@end deffn
+@deffn {Command} {jlink config usb_address} [@option{0x00} to @option{0x03} or @option{0xff}]
+Set the USB address; this will also change the product id. Without argument, show the USB address.
+@end deffn
+@deffn {Command} {jlink config reset}
+Reset the current configuration.
+@end deffn
+@deffn {Command} {jlink config save}
+Save the current configuration to the internal persistent storage.
+@end deffn
+@deffn {Config} {jlink pid} val
+Set the USB PID of the interface. As a configuration command, it can be used only before 'init'.
+@end deffn
 @end deffn
 
 @deffn {Interface Driver} {parport}
@@ -2394,7 +2937,7 @@ commands given in OpenOCD scripts and event handlers.
 
 You can do something similar with many digital multimeters, but note
 that you'll probably need to run the clock continuously for several
-seconds before it decides what clock rate to show.  Adjust the
+seconds before it decides what clock rate to show. Adjust the
 toggling time up or down until the measured clock rate is a good
 match for the adapter_khz rate you specified; be conservative.
 @end quotation
@@ -2439,6 +2982,42 @@ which are not currently documented here.
 @end quotation
 @end deffn
 
+@deffn {Interface Driver} {hla}
+This is a driver that supports multiple High Level Adapters.
+This type of adapter does not expose some of the lower level api's
+that OpenOCD would normally use to access the target.
+
+Currently supported adapters include the ST STLINK and TI ICDI.
+
+@deffn {Config Command} {hla_device_desc} description
+Currently Not Supported.
+@end deffn
+
+@deffn {Config Command} {hla_serial} serial
+Currently Not Supported.
+@end deffn
+
+@deffn {Config Command} {hla_layout} (@option{stlink}|@option{icdi})
+Specifies the adapter layout to use.
+@end deffn
+
+@deffn {Config Command} {hla_vid_pid} vid pid
+The vendor ID and product ID of the device.
+@end deffn
+
+@deffn {Config Command} {stlink_api} api_level
+Manually sets the stlink api used, valid options are 1 or 2. (@b{STLINK Only}).
+@end deffn
+@end deffn
+
+@deffn {Interface Driver} {opendous}
+opendous-jtag is a freely programmable USB adapter.
+@end deffn
+
+@deffn {Interface Driver} {ulink}
+This is the Keil ULINK v1 JTAG debugger.
+@end deffn
+
 @deffn {Interface Driver} {ZY1000}
 This is the Zylin ZY1000 JTAG debugger.
 @end deffn
@@ -2454,6 +3033,7 @@ No arguments: print status.
 @end deffn
 
 @section Transport Configuration
+@cindex Transport
 As noted earlier, depending on the version of OpenOCD you use,
 and the debug adapter you are using,
 several transports may be available to
@@ -2465,12 +3045,13 @@ version of OpenOCD.
 
 @deffn Command {transport select} transport_name
 Select which of the supported transports to use in this OpenOCD session.
-The transport must be supported by the debug adapter hardware  and by the
+The transport must be supported by the debug adapter hardware and by the
 version of OPenOCD you are using (including the adapter's driver).
 No arguments: returns name of session's selected transport.
 @end deffn
 
 @subsection JTAG Transport
+@cindex JTAG
 JTAG is the original transport supported by OpenOCD, and most
 of the OpenOCD commands support it.
 JTAG transports expose a chain of one or more Test Access Points (TAPs),
@@ -2478,18 +3059,33 @@ each of which must be explicitly declared.
 JTAG supports both debugging and boundary scan testing.
 Flash programming support is built on top of debug support.
 @subsection SWD Transport
+@cindex SWD
+@cindex Serial Wire Debug
 SWD (Serial Wire Debug) is an ARM-specific transport which exposes one
 Debug Access Point (DAP, which must be explicitly declared.
 (SWD uses fewer signal wires than JTAG.)
-SWD is debug-oriented, and does not support  boundary scan testing.
+SWD is debug-oriented, and does not support boundary scan testing.
 Flash programming support is built on top of debug support.
 (Some processors support both JTAG and SWD.)
+@deffn Command {swd newdap} ...
+Declares a single DAP which uses SWD transport.
+Parameters are currently the same as "jtag newtap" but this is
+expected to change.
+@end deffn
+@deffn Command {swd wcr trn prescale}
+Updates TRN (turnaraound delay) and prescaling.fields of the
+Wire Control Register (WCR).
+No parameters: displays current settings.
+@end deffn
+
 @subsection SPI Transport
+@cindex SPI
+@cindex Serial Peripheral Interface
 The Serial Peripheral Interface (SPI) is a general purpose transport
-which uses four wire signaling.  Some processors use it as part of a
+which uses four wire signaling. Some processors use it as part of a
 solution for flash programming.
 
-@anchor{JTAG Speed}
+@anchor{jtagspeed}
 @section JTAG Speed
 JTAG clock setup is part of system setup.
 It @emph{does not belong with interface setup} since any interface
@@ -2508,7 +3104,7 @@ It can then be reconfigured to a faster speed by a
 @code{reset-init} target event handler after it reprograms those
 CPU clocks, or manually (if something else, such as a boot loader,
 sets up those clocks).
-@xref{Target Events}.
+@xref{targetevents,,Target Events}.
 When the initial low JTAG speed is a chip characteristic, perhaps
 because of a required oscillator speed, provide such a handler
 in the target config file.
@@ -2536,7 +3132,7 @@ which support adaptive clocking.
 @deffn {Command} adapter_khz max_speed_kHz
 A non-zero speed is in KHZ. Hence: 3000 is 3mhz.
 JTAG interfaces usually support a limited number of
-speeds.  The speed actually used won't be faster
+speeds. The speed actually used won't be faster
 than the speed specified.
 
 Chip data sheets generally include a top JTAG clock rate.
@@ -2545,7 +3141,7 @@ and is normally less than that peak rate.
 For example, most ARM cores accept at most one sixth of the CPU clock.
 
 Speed 0 (khz) selects RTCK method.
-@xref{FAQ RTCK}.
+@xref{faqrtck,,FAQ RTCK}.
 If your system uses RTCK, you won't need to change the
 JTAG clocking after setup.
 Not all interfaces, boards, or targets support ``rtck''.
@@ -2573,7 +3169,7 @@ Every system configuration may require a different reset
 configuration. This can also be quite confusing.
 Resets also interact with @var{reset-init} event handlers,
 which do things like setting up clocks and DRAM, and
-JTAG clock rates.  (@xref{JTAG Speed}.)
+JTAG clock rates. (@xref{jtagspeed,,JTAG Speed}.)
 They can also interact with JTAG routers.
 Please see the various board files for examples.
 
@@ -2602,16 +3198,16 @@ That's part of why reset configuration can be error prone.
 @item
 @emph{System Reset} ... the @emph{SRST} hardware signal
 resets all chips connected to the JTAG adapter, such as processors,
-power management chips, and I/O controllers.  Normally resets triggered
+power management chips, and I/O controllers. Normally resets triggered
 with this signal behave exactly like pressing a RESET button.
 @item
 @emph{JTAG TAP Reset} ... the @emph{TRST} hardware signal resets
 just the TAP controllers connected to the JTAG adapter.
 Such resets should not be visible to the rest of the system; resetting a
-device's the TAP controller just puts that controller into a known state.
+device's TAP controller just puts that controller into a known state.
 @item
 @emph{Emulation Reset} ... many devices can be reset through JTAG
-commands.  These resets are often distinguishable from system
+commands. These resets are often distinguishable from system
 resets, either explicitly (a "reset reason" register says so)
 or implicitly (not all parts of the chip get reset).
 @item
@@ -2630,25 +3226,25 @@ halted under debugger control before any code has executed.
 This is the behavior required to support the @command{reset halt}
 and @command{reset init} commands; after @command{reset init} a
 board-specific script might do things like setting up DRAM.
-(@xref{Reset Command}.)
+(@xref{resetcommand,,Reset Command}.)
 
-@anchor{SRST and TRST Issues}
+@anchor{srstandtrstissues}
 @section SRST and TRST Issues
 
 Because SRST and TRST are hardware signals, they can have a
-variety of system-specific constraints.  Some of the most
+variety of system-specific constraints. Some of the most
 common issues are:
 
 @itemize @bullet
 
 @item @emph{Signal not available} ... Some boards don't wire
-SRST or TRST to the JTAG connector.  Some JTAG adapters don't
+SRST or TRST to the JTAG connector. Some JTAG adapters don't
 support such signals even if they are wired up.
 Use the @command{reset_config} @var{signals} options to say
 when either of those signals is not connected.
 When SRST is not available, your code might not be able to rely
 on controllers having been fully reset during code startup.
-Missing TRST is not a problem, since JTAG level resets can
+Missing TRST is not a problem, since JTAG-level resets can
 be triggered using with TMS signaling.
 
 @item @emph{Signals shorted} ... Sometimes a chip, board, or
@@ -2659,7 +3255,7 @@ when those signals aren't properly independent.
 @item @emph{Timing} ... Reset circuitry like a resistor/capacitor
 delay circuit, reset supervisor, or on-chip features can extend
 the effect of a JTAG adapter's reset for some time after the adapter
-stops issuing the reset.  For example, there may be chip or board
+stops issuing the reset. For example, there may be chip or board
 requirements that all reset pulses last for at least a
 certain amount of time; and reset buttons commonly have
 hardware debouncing.
@@ -2668,14 +3264,14 @@ commands to say when extra delays are needed.
 
 @item @emph{Drive type} ... Reset lines often have a pullup
 resistor, letting the JTAG interface treat them as open-drain
-signals.  But that's not a requirement, so the adapter may need
+signals. But that's not a requirement, so the adapter may need
 to use push/pull output drivers.
 Also, with weak pullups it may be advisable to drive
 signals to both levels (push/pull) to minimize rise times.
 Use the @command{reset_config} @var{trst_type} and
 @var{srst_type} parameters to say how to drive reset signals.
 
-@item @emph{Special initialization} ...  Targets sometimes need
+@item @emph{Special initialization} ... Targets sometimes need
 special JTAG initialization sequences to handle chip-specific
 issues (not limited to errata).
 For example, certain JTAG commands might need to be issued while
@@ -2733,7 +3329,7 @@ of your combination of JTAG board and target in target
 configuration scripts.
 
 Information earlier in this section describes the kind of problems
-the command is intended to address (@pxref{SRST and TRST Issues}).
+the command is intended to address (@pxref{srstandtrstissues,,SRST and TRST Issues}).
 As a rule this command belongs only in board config files,
 describing issues like @emph{board doesn't connect TRST};
 or in user config files, addressing limitations derived
@@ -2742,10 +3338,9 @@ from a particular combination of interface and board.
 with a board that only wires up SRST.)
 
 The @var{mode_flag} options can be specified in any order, but only one
-of each type -- @var{signals}, @var{combination},
-@var{gates},
-@var{trst_type},
-and @var{srst_type} -- may be specified at a time.
+of each type -- @var{signals}, @var{combination}, @var{gates},
+@var{trst_type}, @var{srst_type} and @var{connect_type}
+-- may be specified at a time.
 If you don't provide a new value for a given type, its previous
 value (perhaps the default) is unchanged.
 For example, this means that you don't need to say anything at all about
@@ -2787,12 +3382,24 @@ JTAG clock. This means that no communication can happen on JTAG
 while SRST is asserted.
 Its converse is @option{srst_nogate}, indicating that JTAG commands
 can safely be issued while SRST is active.
+
+@item
+The @var{connect_type} tokens control flags that describe some cases where
+SRST is asserted while connecting to the target. @option{srst_nogate}
+is required to use this option.
+@option{connect_deassert_srst} (default)
+indicates that SRST will not be asserted while connecting to the target.
+Its converse is @option{connect_assert_srst}, indicating that SRST will
+be asserted before any target connection.
+Only some targets support this feature, STM32 and STR9 are examples.
+This feature is useful if you are unable to connect to your target due
+to incorrect options byte config or illegal program execution.
 @end itemize
 
 The optional @var{trst_type} and @var{srst_type} parameters allow the
-driver mode of each reset line to be specified.  These values only affect
+driver mode of each reset line to be specified. These values only affect
 JTAG interfaces with support for different driver modes, like the Amontec
-JTAGkey and JTAG Accelerator.  Also, they are necessarily ignored if the
+JTAGkey and JTAG Accelerator. Also, they are necessarily ignored if the
 relevant signal (TRST or SRST) is not connected.
 
 @itemize
@@ -2841,11 +3448,11 @@ to find a sequence of operations that works.
 @xref{JTAG Commands}.
 When you find a working sequence, it can be used to override
 @command{jtag_init}, which fires during OpenOCD startup
-(@pxref{Configuration Stage});
+(@pxref{configurationstage,,Configuration Stage});
 or @command{init_reset}, which fires during reset processing.
 
 You might also want to provide some project-specific reset
-schemes.  For example, on a multi-target board the standard
+schemes. For example, on a multi-target board the standard
 @command{reset} command would reset all targets, but you
 may need the ability to reset only one target at time and
 thus want to avoid using the board-wide SRST signal.
@@ -2951,7 +3558,7 @@ Here's what the scan chain might look like for a chip more than one TAP:
 @end verbatim
 
 OpenOCD can detect some of that information, but not all
-of it.  @xref{Autoprobing}.
+of it. @xref{autoprobing,,Autoprobing}.
 Unfortunately those TAPs can't always be autoconfigured,
 because not all devices provide good support for that.
 JTAG doesn't require supporting IDCODE instructions, and
@@ -2974,7 +3581,7 @@ and so forth.
 Note that @emph{the order in which TAPs are declared is very important.}
 It must match the order in the JTAG scan chain, both inside
 a single chip and between them.
-@xref{FAQ TAP Order}.
+@xref{faqtaporder,,FAQ TAP Order}.
 
 For example, the ST Microsystems STR912 chip has
 three separate TAPs@footnote{See the ST
@@ -3014,7 +3621,7 @@ but systems with a JTAG router can
 enable or disable TAPs dynamically.
 @end deffn
 
-@c FIXME!  "jtag cget" should be able to return all TAP
+@c FIXME! "jtag cget" should be able to return all TAP
 @c attributes, like "$target_name cget" does for targets.
 
 @c Probably want "jtag eventlist", and a "tap-reset" event
@@ -3029,11 +3636,11 @@ name of a module (usually a chip) and a label for the TAP.
 For example: @code{xilinx.tap}, @code{str912.flash},
 @code{omap3530.jrc}, @code{dm6446.dsp}, or @code{stm32.cpu}.
 Many other commands use that dotted.name to manipulate or
-refer to the TAP.  For example, CPU configuration uses the
+refer to the TAP. For example, CPU configuration uses the
 name, as does declaration of NAND or NOR flash banks.
 
 The components of a dotted name should follow ``C'' symbol
-name rules:  start with an alphabetic character, then numbers
+name rules: start with an alphabetic character, then numbers
 and underscores are OK; while others (including dots!) are not.
 
 @quotation Tip
@@ -3050,7 +3657,6 @@ reusing those scripts on boards with multiple targets.
 @section TAP Declaration Commands
 
 @c shouldn't this be(come) a {Config Command}?
-@anchor{jtag newtap}
 @deffn Command {jtag newtap} chipname tapname configparams...
 Declares a new TAP with the dotted name @var{chipname}.@var{tapname},
 and configured according to the various @var{configparams}.
@@ -3098,7 +3704,7 @@ linked in to the scan chain after a reset using either TRST
 or the JTAG state machine's @sc{reset} state.
 You may use @code{-enable} to highlight the default state
 (the TAP is linked in).
-@xref{Enabling and Disabling TAPs}.
+@xref{enablinganddisablingtaps,,Enabling and Disabling TAPs}.
 @item @code{-expected-id} @var{number}
 @*A non-zero @var{number} represents a 32-bit IDCODE
 which you expect to find when the scan chain is examined.
@@ -3109,23 +3715,23 @@ Specify @var{number} as zero to suppress warnings about IDCODE
 values that were found but not included in the list.
 
 Provide this value if at all possible, since it lets OpenOCD
-tell when the scan chain it sees isn't right.  These values
+tell when the scan chain it sees isn't right. These values
 are provided in vendors' chip documentation, usually a technical
-reference manual.  Sometimes you may need to probe the JTAG
+reference manual. Sometimes you may need to probe the JTAG
 hardware to find these values.
-@xref{Autoprobing}.
+@xref{autoprobing,,Autoprobing}.
 @item @code{-ignore-version}
 @*Specify this to ignore the JTAG version field in the @code{-expected-id}
-option.  When vendors put out multiple versions of a chip, or use the same
+option. When vendors put out multiple versions of a chip, or use the same
 JTAG-level ID for several largely-compatible chips, it may be more practical
 to ignore the version field than to update config files to handle all of
-the various chip IDs.
+the various chip IDs. The version field is defined as bit 28-31 of the IDCODE.
 @item @code{-ircapture} @var{NUMBER}
 @*The bit pattern loaded by the TAP into the JTAG shift register
 on entry to the @sc{ircapture} state, such as 0x01.
 JTAG requires the two LSBs of this value to be 01.
 By default, @code{-ircapture} and @code{-irmask} are set
-up to verify that two-bit value.  You may provide
+up to verify that two-bit value. You may provide
 additional bits, if you know them, or indicate that
 a TAP doesn't conform to the JTAG specification.
 @item @code{-irmask} @var{NUMBER}
@@ -3151,7 +3757,6 @@ a TCL string which is evaluated when the event is triggered.
 The @code{cget} subcommand returns that handler.
 @end deffn
 
-@anchor{TAP Events}
 @section TAP Events
 @cindex events
 @cindex TAP events
@@ -3179,11 +3784,11 @@ of any particular target.
 @* The scan chain has been reset and verified.
 This handler may enable TAPs as needed.
 @item @b{tap-disable}
-@* The TAP needs to be disabled.  This handler should
+@* The TAP needs to be disabled. This handler should
 implement @command{jtag tapdisable}
 by issuing the relevant JTAG commands.
 @item @b{tap-enable}
-@* The TAP needs to be enabled.  This handler should
+@* The TAP needs to be enabled. This handler should
 implement @command{jtag tapenable}
 by issuing the relevant JTAG commands.
 @end itemize
@@ -3200,7 +3805,7 @@ jtag configure CHIP.jrc -event post-reset @{
 @end example
 
 
-@anchor{Enabling and Disabling TAPs}
+@anchor{enablinganddisablingtaps}
 @section Enabling and Disabling TAPs
 @cindex JTAG Route Controller
 @cindex jrc
@@ -3288,13 +3893,13 @@ for querying the state of the JTAG taps.
 @end quotation
 @end deffn
 
-@anchor{Autoprobing}
+@anchor{autoprobing}
 @section Autoprobing
 @cindex autoprobe
 @cindex JTAG autoprobe
 
 TAP configuration is the first thing that needs to be done
-after interface and reset configuration.  Sometimes it's
+after interface and reset configuration. Sometimes it's
 hard finding out what TAPs exist, or how they are identified.
 Vendor documentation is not always easy to find and use.
 
@@ -3315,7 +3920,7 @@ jtag_rclk 8
 @end example
 
 When you start the server without any TAPs configured, it will
-attempt to autoconfigure the TAPs.  There are two parts to this:
+attempt to autoconfigure the TAPs. There are two parts to this:
 
 @enumerate
 @item @emph{TAP discovery} ...
@@ -3335,12 +3940,12 @@ as chip data sheets or BSDL files.
 @end enumerate
 
 In many cases your board will have a simple scan chain with just
-a single device.  Here's what OpenOCD reported with one board
+a single device. Here's what OpenOCD reported with one board
 that's a bit more complex:
 
 @example
 clock speed 8 kHz
-There are no enabled taps.  AUTO PROBING MIGHT NOT WORK!!
+There are no enabled taps. AUTO PROBING MIGHT NOT WORK!!
 AUTO auto0.tap - use "jtag newtap auto0 tap -expected-id 0x2b900f0f ..."
 AUTO auto1.tap - use "jtag newtap auto1 tap -expected-id 0x07926001 ..."
 AUTO auto2.tap - use "jtag newtap auto2 tap -expected-id 0x0b73b02f ..."
@@ -3351,8 +3956,8 @@ no gdb ports allocated as no target has been specified
 @end example
 
 Given that information, you should be able to either find some existing
-config files to use, or create your own.  If you create your own, you
-would configure from the bottom up:  first a @file{target.cfg} file
+config files to use, or create your own. If you create your own, you
+would configure from the bottom up: first a @file{target.cfg} file
 with these TAPs, any targets associated with them, and any on-chip
 resources; then a @file{board.cfg} with off-chip resources, clocking,
 and so forth.
@@ -3364,7 +3969,7 @@ and so forth.
 This chapter discusses how to set up GDB debug targets for CPUs.
 You can also access these targets without GDB
 (@pxref{Architecture and Core Commands},
-and @ref{Target State handling}) and
+and @ref{targetstatehandling,,Target State handling}) and
 through various kinds of NAND and NOR flash commands.
 If you have multiple CPUs you can have multiple such targets.
 
@@ -3386,7 +3991,7 @@ look like with more than one:
     TargetName         Type       Endian TapName            State
 --  ------------------ ---------- ------ ------------------ ------------
  0* at91rm9200.cpu     arm920t    little at91rm9200.cpu     running
- 1  MyTarget           cortex_m3  little mychip.foo         tap-disabled
+ 1  MyTarget           cortex_m   little mychip.foo         tap-disabled
 @end verbatim
 
 One member of that list is the @dfn{current target}, which
@@ -3445,7 +4050,7 @@ puts [format "Target %d is: %s\n" $x $thename]
 @c plus maybe "target setdefault".
 
 @deffn Command targets [name]
-@emph{Note: the name of this command is plural.  Other target
+@emph{Note: the name of this command is plural. Other target
 command names are singular.}
 
 With no parameter, this command displays a table of all known
@@ -3462,7 +4067,7 @@ only relevant on boards which have more than one target.
 @cindex CPU variant
 
 Each target has a @dfn{CPU type}, as shown in the output of
-the @command{targets} command.  You need to specify that type
+the @command{targets} command. You need to specify that type
 when calling @command{target create}.
 The CPU type indicates more than just the instruction set.
 It also indicates how that instruction set is implemented,
@@ -3482,7 +4087,7 @@ since there's a command to list them.
 However, there is currently no way to list what target variants
 are supported (other than by reading the OpenOCD source code).
 
-@anchor{target types}
+@anchor{targettypes}
 @deffn Command {target types}
 Lists all supported target types.
 At this writing, the supported CPU types and variants are:
@@ -3497,24 +4102,17 @@ At this writing, the supported CPU types and variants are:
 @item @code{arm9tdmi} -- this is an ARMv4 core
 @item @code{avr} -- implements Atmel's 8-bit AVR instruction set.
 (Support for this is preliminary and incomplete.)
-@item @code{cortex_a8} -- this is an ARMv7 core with an MMU
-@item @code{cortex_m3} -- this is an ARMv7 core, supporting only the
-compact Thumb2 instruction set.  It supports one variant:
-@itemize @minus
-@item @code{lm3s} ... Use this when debugging older Stellaris LM3S targets.
-This will cause OpenOCD to use a software reset rather than asserting
-SRST, to avoid a issue with clearing the debug registers.
-This is fixed in Fury Rev B, DustDevil Rev B, Tempest; these revisions will
-be detected and the normal reset behaviour used.
-@end itemize
+@item @code{cortex_a} -- this is an ARMv7 core with an MMU
+@item @code{cortex_m} -- this is an ARMv7 core, supporting only the
+compact Thumb2 instruction set.
 @item @code{dragonite} -- resembles arm966e
 @item @code{dsp563xx} -- implements Freescale's 24-bit DSP.
 (Support for this is still incomplete.)
 @item @code{fa526} -- resembles arm920 (w/o Thumb)
 @item @code{feroceon} -- resembles arm926
-@item @code{mips_m4k} -- a MIPS core.  This supports one variant:
+@item @code{mips_m4k} -- a MIPS core. This supports one variant:
 @item @code{xscale} -- this is actually an architecture,
-not a CPU type.  It is based on the ARMv5 architecture.
+not a CPU type. It is based on the ARMv5 architecture.
 There are several variants defined:
 @itemize @minus
 @item @code{ixp42x}, @code{ixp45x}, @code{ixp46x},
@@ -3536,7 +4134,7 @@ reflect design generations;
 while names like ARMv4, ARMv5, ARMv6, and ARMv7
 reflect an architecture version implemented by a CPU design.
 
-@anchor{Target Configuration}
+@anchor{targetconfiguration}
 @section Target Configuration
 
 Before creating a ``target'', you must have added its TAP to the scan chain.
@@ -3546,7 +4144,7 @@ The chip-specific configuration file will normally configure its CPU(s)
 right after it adds all of the chip's TAPs to the scan chain.
 
 Although you can set up a target in one step, it's often clearer if you
-use shorter commands and do it in two steps:  create it, then configure
+use shorter commands and do it in two steps: create it, then configure
 optional parts.
 All operations on the target after it's created will use a new
 command, created as part of target creation.
@@ -3554,12 +4152,12 @@ command, created as part of target creation.
 The two main things to configure after target creation are
 a work area, which usually has target-specific defaults even
 if the board setup code overrides them later;
-and event handlers (@pxref{Target Events}), which tend
+and event handlers (@pxref{targetevents,,Target Events}), which tend
 to be much more board-specific.
 The key steps you use might look something like this
 
 @example
-target create MyTarget cortex_m3 -chain-position mychip.cpu
+target create MyTarget cortex_m -chain-position mychip.cpu
 $MyTarget configure -work-area-phys 0x08000 -work-area-size 8096
 $MyTarget configure -event reset-deassert-pre @{ jtag_rclk 5 @}
 $MyTarget configure -event reset-init @{ myboard_reinit @}
@@ -3599,7 +4197,7 @@ command (@command{@var{target_name}}) which is used for various
 purposes including additional configuration.
 
 @itemize @bullet
-@item @var{target_name} ...  is the name of the debug target.
+@item @var{target_name} ... is the name of the debug target.
 By convention this should be the same as the @emph{dotted.name}
 of the TAP associated with this target, which must be specified here
 using the @code{-chain-position @var{dotted.name}} configparam.
@@ -3607,8 +4205,8 @@ using the @code{-chain-position @var{dotted.name}} configparam.
 This name is also used to create the target object command,
 referred to here as @command{$target_name},
 and in other places the target needs to be identified.
-@item @var{type} ... specifies the target type.  @xref{target types}.
-@item @var{configparams} ...  all parameters accepted by
+@item @var{type} ... specifies the target type. @xref{targettypes,,target types}.
+@item @var{configparams} ... all parameters accepted by
 @command{$target_name configure} are permitted.
 If the target is big-endian, set it here with @code{-endian big}.
 If the variant matters, set it here with @code{-variant}.
@@ -3636,7 +4234,7 @@ used to access this target.
 whether the CPU uses big or little endian conventions
 
 @item @code{-event} @var{event_name} @var{event_body} --
-@xref{Target Events}.
+@xref{targetevents,,Target Events}.
 Note that this updates a list of named event handlers.
 Calling this twice with two different event names assigns
 two different handlers, but calling it twice with the
@@ -3654,7 +4252,7 @@ For example, the beginning of an SRAM block is likely to
 be used by most build systems, but the end is often unused.
 
 @item @code{-work-area-size} @var{size} -- specify work are size,
-in bytes.  The same size applies regardless of whether its physical
+in bytes. The same size applies regardless of whether its physical
 or virtual address is being used.
 
 @item @code{-work-area-phys} @var{address} -- set the work area
@@ -3666,6 +4264,10 @@ base @var{address} to be used when an MMU is active.
 The value should normally correspond to a static mapping for the
 @code{-work-area-phys} address, set up by the current operating system.
 
+@item @code{-rtos} @var{rtos_type} -- enable rtos support for target,
+@var{rtos_type} can be one of @option{auto}|@option{eCos}|@option{ThreadX}|
+@option{FreeRTOS}|@option{linux}|@option{ChibiOS}.
+
 @end itemize
 @end deffn
 
@@ -3767,20 +4369,20 @@ foreach name [target names] @{
 @end example
 @end deffn
 
-@anchor{target curstate}
+@anchor{targetcurstate}
 @deffn Command {$target_name curstate}
 Displays the current target state:
 @code{debug-running},
 @code{halted},
 @code{reset},
 @code{running}, or @code{unknown}.
-(Also, @pxref{Event Polling}.)
+(Also, @pxref{eventpolling,,Event Polling}.)
 @end deffn
 
 @deffn Command {$target_name eventlist}
 Displays a table listing all event handlers
 currently associated with this target.
-@xref{Target Events}.
+@xref{targetevents,,Target Events}.
 @end deffn
 
 @deffn Command {$target_name invoke-event} event_name
@@ -3808,7 +4410,7 @@ Writes the specified @var{word} (32 bits),
 at the specified address @var{addr}.
 @end deffn
 
-@anchor{Target Events}
+@anchor{targetevents}
 @section Target Events
 @cindex target events
 @cindex events
@@ -3832,7 +4434,7 @@ These are set up by @command{$target_name configure -event} or
 @command{target create ... -event}.
 
 The programmer's model matches the @code{-command} option used in Tcl/Tk
-buttons and events.  The two examples below act the same, but one creates
+buttons and events. The two examples below act the same, but one creates
 and invokes a small procedure while the other inlines it.
 
 @example
@@ -3857,14 +4459,12 @@ The following target events are defined:
 @* The target has resumed (i.e.: gdb said run)
 @item @b{early-halted}
 @* Occurs early in the halt process
-@ignore
-@item @b{examine-end}
-@* Currently not used (goal: when JTAG examine completes)
 @item @b{examine-start}
-@* Currently not used (goal: when JTAG examine starts)
-@end ignore
+@* Before target examine is called.
+@item @b{examine-end}
+@* After target examine is called with no errors.
 @item @b{gdb-attach}
-@* When GDB connects. This is before any communication with the target, so this 
+@* When GDB connects. This is before any communication with the target, so this
 can be used to set up the target so it is possible to probe flash. Probing flash
 is necessary during gdb connect if gdb load is to write the image to flash. Another
 use of the flash memory map is for GDB to automatically hardware/software breakpoints
@@ -3885,12 +4485,6 @@ depending on whether the breakpoint is in RAM or read only memory.
 @* Before the target steps, gdb is trying to start/resume the target
 @item @b{halted}
 @* The target has halted
-@ignore
-@item @b{old-gdb_program_config}
-@* DO NOT USE THIS: Used internally
-@item @b{old-pre_resume}
-@* DO NOT USE THIS: Used internally
-@end ignore
 @item @b{reset-assert-pre}
 @* Issued as part of @command{reset} processing
 after @command{reset_init} was triggered
@@ -3950,13 +4544,10 @@ when reset disables PLLs needed to use a fast clock.
 @* Before any target is resumed
 @item @b{resume-end}
 @* After all targets have resumed
-@item @b{resume-ok}
-@* Success
 @item @b{resumed}
 @* Target has resumed
 @end itemize
 
-
 @node Flash Commands
 @chapter Flash Commands
 
@@ -3966,7 +4557,7 @@ the ``nand'' command works with NAND flash.
 This partially reflects different hardware technologies:
 NOR flash usually supports direct CPU instruction and data bus access,
 while data from a NAND flash must be copied to memory before it can be
-used.  (SPI flash must also be copied to memory before use.)
+used. (SPI flash must also be copied to memory before use.)
 However, the documentation also uses ``flash'' as a generic term;
 for example, ``Put flash configuration in board-specific files''.
 
@@ -3977,12 +4568,12 @@ Flash Steps:
 passing parameters as needed by the driver.
 @item Operate on the flash via @command{flash subcommand}
 @* Often commands to manipulate the flash are typed by a human, or run
-via a script in some automated way.  Common tasks include writing a
+via a script in some automated way. Common tasks include writing a
 boot loader, operating system, or other data.
 @item GDB Flashing
 @* Flashing via GDB requires the flash be configured via ``flash
 bank'', and the GDB flash features be enabled.
-@xref{GDB Configuration}.
+@xref{gdbconfiguration,,GDB Configuration}.
 @end enumerate
 
 Many CPUs have the ablity to ``boot'' from the first flash bank.
@@ -3991,7 +4582,7 @@ so that it can't boot.
 JTAG tools, like OpenOCD, are often then used to ``de-brick'' the
 board by (re)installing working boot firmware.
 
-@anchor{NOR Configuration}
+@anchor{norconfiguration}
 @section Flash Configuration Commands
 @cindex flash configuration
 
@@ -4004,12 +4595,12 @@ see the driver-specific documentation.
 
 @itemize @bullet
 @item @var{name} ... may be used to reference the flash bank
-in other flash commands.  A number is also available.
+in other flash commands. A number is also available.
 @item @var{driver} ... identifies the controller driver
 associated with the flash bank being declared.
 This is usually @code{cfi} for external flash, or else
 the name of a microcontroller with embedded flash memory.
-@xref{Flash Driver List}.
+@xref{flashdriverlist,,Flash Driver List}.
 @item @var{base} ... Base address of the flash chip.
 @item @var{size} ... Size of the chip, in bytes.
 For some drivers, this value is detected from the hardware.
@@ -4021,7 +4612,7 @@ chip, in bytes; ignored for most microcontroller drivers.
 commands to the flash controller.
 @comment Actually, it's currently a controller-specific parameter...
 @item @var{driver_options} ... drivers may support, or require,
-additional parameters.  See the driver-specific documentation
+additional parameters. See the driver-specific documentation
 for more information.
 @end itemize
 @quotation Note
@@ -4031,7 +4622,7 @@ Use it in board specific configuration files, not interactively.
 @end deffn
 
 @comment the REAL name for this command is "ocd_flash_banks"
-@comment less confusing would be:  "flash list" (like "nand list")
+@comment less confusing would be: "flash list" (like "nand list")
 @deffn Command {flash banks}
 Prints a one-line summary of each device that was
 declared using @command{flash bank}, numbered from zero.
@@ -4059,22 +4650,23 @@ but most don't bother.
 @cindex flash reading
 @cindex flash writing
 @cindex flash programming
+@anchor{flashprogrammingcommands}
 
 One feature distinguishing NOR flash from NAND or serial flash technologies
 is that for read access, it acts exactly like any other addressible memory.
 This means you can use normal memory read commands like @command{mdw} or
 @command{dump_image} with it, with no special @command{flash} subcommands.
-@xref{Memory access}, and @ref{Image access}.
+@xref{memoryaccess,,Memory access}, and @ref{imageaccess,,Image access}.
 
-Write access works differently.  Flash memory normally needs to be erased
-before it's written.  Erasing a sector turns all of its bits to ones, and
-writing can turn ones into zeroes.  This is why there are special commands
+Write access works differently. Flash memory normally needs to be erased
+before it's written. Erasing a sector turns all of its bits to ones, and
+writing can turn ones into zeroes. This is why there are special commands
 for interactive erasing and writing, and why GDB needs to know which parts
 of the address space hold NOR flash memory.
 
 @quotation Note
 Most of these erase and write commands leverage the fact that NOR flash
-chips consume target address space.  They implicitly refer to the current
+chips consume target address space. They implicitly refer to the current
 JTAG target, and map from an address in that target's address space
 back to a flash bank.
 @comment In May 2009, those mappings may fail if any bank associated
@@ -4090,9 +4682,8 @@ For such systems, erasing and writing may require sector protection to be
 disabled first.
 Examples include CFI flash such as ``Intel Advanced Bootblock flash'',
 and AT91SAM7 on-chip flash.
-@xref{flash protect}.
+@xref{flashprotect,,flash protect}.
 
-@anchor{flash erase_sector}
 @deffn Command {flash erase_sector} num first last
 Erase sectors in bank @var{num}, starting at sector @var{first}
 up to and including @var{last}.
@@ -4113,7 +4704,7 @@ the specified length must stay within that bank.
 As a special case, when @var{length} is zero and @var{address} is
 the start of the bank, the whole flash is erased.
 If @option{unlock} is specified, then the flash is unprotected
-before erase starts. 
+before erase starts.
 @end deffn
 
 @deffn Command {flash fillw} address word length
@@ -4132,14 +4723,12 @@ each block, and the specified length must stay within that bank.
 @end deffn
 @comment no current checks for errors if fill blocks touch multiple banks!
 
-@anchor{flash write_bank}
 @deffn Command {flash write_bank} num filename offset
 Write the binary @file{filename} to flash bank @var{num},
 starting at @var{offset} bytes from the beginning of the bank.
 The @var{num} parameter is a value shown by @command{flash banks}.
 @end deffn
 
-@anchor{flash write_image}
 @deffn Command {flash write_image} [erase] [unlock] filename [offset] [type]
 Write the image @file{filename} to the current target's flash bank(s).
 A relocation @var{offset} may be specified, in which case it is added
@@ -4192,7 +4781,7 @@ This command will first query the hardware, it does not print cached
 and possibly stale information.
 @end deffn
 
-@anchor{flash protect}
+@anchor{flashprotect}
 @deffn Command {flash protect} num first last (@option{on}|@option{off})
 Enable (@option{on}) or disable (@option{off}) protection of flash sectors
 in flash bank @var{num}, starting at sector @var{first}
@@ -4202,7 +4791,14 @@ specifies "to the end of the flash bank".
 The @var{num} parameter is a value shown by @command{flash banks}.
 @end deffn
 
-@anchor{Flash Driver List}
+@anchor{program}
+@deffn Command {program} filename [verify] [reset] [offset]
+This is a helper script that simplifies using OpenOCD as a standalone
+programmer. The only required parameter is @option{filename}, the others are optional.
+@xref{Flash Programming}.
+@end deffn
+
+@anchor{flashdriverlist}
 @section Flash Driver List
 As noted above, the @command{flash bank} command requires a driver name,
 and allows driver-specific options and behaviors.
@@ -4252,14 +4848,39 @@ flash bank $_FLASHNAME cfi 0x00000000 0x02000000 2 4 $_TARGETNAME
 @c "cfi part_id" disabled
 @end deffn
 
-@deffn {Flash Driver} spearsmi
-@cindex SPEAr Serial Memory Interface
+@deffn {Flash Driver} lpcspifi
+@cindex NXP SPI Flash Interface
+@cindex SPIFI
+@cindex lpcspifi
+NXP's LPC43xx and LPC18xx families include a proprietary SPI
+Flash Interface (SPIFI) peripheral that can drive and provide
+memory mapped access to external SPI flash devices.
+
+The lpcspifi driver initializes this interface and provides
+program and erase functionality for these serial flash devices.
+Use of this driver @b{requires} a working area of at least 1kB
+to be configured on the target device; more than this will
+significantly reduce flash programming times.
+
+The setup command only requires the @var{base} parameter. All
+other parameters are ignored, and the flash size and layout
+are configured by the driver.
+
+@example
+flash bank $_FLASHNAME lpcspifi 0x14000000 0 0 0 $_TARGETNAME
+@end example
+
+@end deffn
+
+@deffn {Flash Driver} stmsmi
+@cindex STMicroelectronics Serial Memory Interface
 @cindex SMI
-@cindex spearsmi
-All members of SPEAr MPU family from STMicroelectronics include a
+@cindex stmsmi
+Some devices form STMicroelectronics (e.g. STR75x MCU family,
+SPEAr MPU family) include a proprietary
 ``Serial Memory Interface'' (SMI) controller able to drive external
 SPI flash devices.
-Depending on specific MPU and board configuration, up to 4 external
+Depending on specific device and board configuration, up to 4 external
 flash devices can be connected.
 
 SMI makes the flash content directly accessible in the CPU address
@@ -4274,7 +4895,7 @@ All other parameters are ignored. Additional information, like
 flash size, are detected automatically.
 
 @example
-flash bank $_FLASHNAME spearsmi 0xf8000000 0 0 0 $_TARGETNAME
+flash bank $_FLASHNAME stmsmi 0xf8000000 0 0 0 $_TARGETNAME
 @end example
 
 @end deffn
@@ -4293,6 +4914,7 @@ flash bank $_FLASHNAME aduc702x 0 0 0 0 $_TARGETNAME
 @end example
 @end deffn
 
+@anchor{at91sam3}
 @deffn {Flash Driver} at91sam3
 @cindex at91sam3
 All members of the AT91SAM3 microcontroller family from
@@ -4305,7 +4927,7 @@ readers/updaters: Please remove this worrysome comment after other
 chips are confirmed.}
 
 The AT91SAM3U4[E/C] (256K) chips have two flash banks; most other chips
-have one flash bank.  In all cases the flash banks are at
+have one flash bank. In all cases the flash banks are at
 the following fixed locations:
 
 @example
@@ -4321,7 +4943,7 @@ to the @command{flash bank} command:
 
 @itemize
 @item @emph{N-Banks:} 256K chips have 2 banks, others have 1 bank.
-@item @emph{Bank Size:}  128K/64K Per flash bank
+@item @emph{Bank Size:} 128K/64K Per flash bank
 @item @emph{Sectors:} 16 or 8 per bank
 @item @emph{SectorSize:} 8K Per Sector
 @item @emph{PageSize:} 256 bytes per page. Note that OpenOCD operates on 'sector' sizes, not page sizes.
@@ -4357,9 +4979,16 @@ This command shows/sets the slow clock frequency used in the
 @end deffn
 @end deffn
 
+@deffn {Flash Driver} at91sam4
+@cindex at91sam4
+All members of the AT91SAM4 microcontroller family from
+Atmel include internal flash and use ARM's Cortex-M4 core.
+This driver uses the same cmd names/syntax as @xref{at91sam3}.
+@end deffn
+
 @deffn {Flash Driver} at91sam7
 All members of the AT91SAM7 microcontroller family from Atmel include
-internal flash and use ARM7TDMI cores.  The driver automatically
+internal flash and use ARM7TDMI cores. The driver automatically
 recognizes a number of these chips using the chip identification
 register, and autoconfigures itself.
 
@@ -4394,7 +5023,7 @@ plane (of up to 256KB), and it will be used automatically when you issue
 
 @deffn Command {at91sam7 gpnvm} bitnum (@option{set}|@option{clear})
 Set or clear a ``General Purpose Non-Volatile Memory'' (GPNVM)
-bit for the processor.   Each processor has a number of such bits,
+bit for the processor. Each processor has a number of such bits,
 used for controlling features such as brownout detection (so they
 are not truly general purpose).
 @quotation Note
@@ -4410,16 +5039,22 @@ The AVR 8-bit microcontrollers from Atmel integrate flash memory.
 @comment - defines mass_erase ... pointless given flash_erase_address
 @end deffn
 
-@deffn {Flash Driver} ecosflash
-@emph{No idea what this is...}
-The @var{ecosflash} driver defines one mandatory parameter,
-the name of a modules of target code which is downloaded
-and executed.
+@deffn {Flash Driver} efm32
+All members of the EFM32 microcontroller family from Energy Micro include
+internal flash and use ARM Cortex M3 cores. The driver automatically recognizes
+a number of these chips using the chip identification register, and
+autoconfigures itself.
+@example
+flash bank $_FLASHNAME efm32 0 0 0 0 $_TARGETNAME
+@end example
+@emph{The current implementation is incomplete. Unprotecting flash pages is not
+supported.}
 @end deffn
 
 @deffn {Flash Driver} lpc2000
-Most members of the LPC1700 and LPC2000 microcontroller families from NXP
-include internal flash and use Cortex-M3 (LPC1700) or ARM7TDMI (LPC2000) cores.
+Most members of the LPC1700, LPC1800, LPC2000 and LPC4300 microcontroller
+families from NXP include internal flash and use Cortex-M3 (LPC1700, LPC1800),
+Cortex-M4 (LPC4300) or ARM7TDMI (LPC2000) cores.
 
 @quotation Note
 There are LPC2000 devices which are not supported by the @var{lpc2000}
@@ -4435,7 +5070,9 @@ which must appear in the following order:
 @item @var{variant} ... required, may be
 @option{lpc2000_v1} (older LPC21xx and LPC22xx)
 @option{lpc2000_v2} (LPC213x, LPC214x, LPC210[123], LPC23xx and LPC24xx)
-or @option{lpc1700} (LPC175x and LPC176x)
+@option{lpc1700} (LPC175x and LPC176x)
+or @option{lpc4300} - available also as @option{lpc1800} alias (LPC18x[2357] and
+LPC43x[2357])
 @item @var{clock_kHz} ... the frequency, in kiloHertz,
 at which the core is running
 @item @option{calc_checksum} ... optional (but you probably want to provide this!),
@@ -4641,7 +5278,6 @@ standard @command{flash erase_address} command.}
 @example
 flash bank $_FLASHNAME stellaris 0 0 0 0 $_TARGETNAME
 @end example
-@end deffn
 
 @deffn Command {stellaris recover bank_id}
 Performs the @emph{Recovering a "Locked" Device} procedure to
@@ -4657,45 +5293,102 @@ if more than one Stellaris chip is connected, the procedure is
 applied to all of them.
 @end quotation
 @end deffn
+@end deffn
 
-@deffn {Flash Driver} stm32x
-All members of the STM32 microcontroller family from ST Microelectronics
-include internal flash and use ARM Cortex M3 cores.
+@deffn {Flash Driver} stm32f1x
+All members of the STM32F0, STM32F1 and STM32F3 microcontroller families
+from ST Microelectronics include internal flash and use ARM Cortex-M0/M3/M4 cores.
 The driver automatically recognizes a number of these chips using
 the chip identification register, and autoconfigures itself.
 
 @example
-flash bank $_FLASHNAME stm32x 0 0 0 0 $_TARGETNAME
+flash bank $_FLASHNAME stm32f1x 0 0 0 0 $_TARGETNAME
+@end example
+
+Note that some devices have been found that have a flash size register that contains
+an invalid value, to workaround this issue you can override the probed value used by
+the flash driver.
+
+@example
+flash bank $_FLASHNAME stm32f1x 0 0x20000 0 0 $_TARGETNAME
+@end example
+
+If you have a target with dual flash banks then define the second bank
+as per the following example.
+@example
+flash bank $_FLASHNAME stm32f1x 0x08080000 0 0 0 $_TARGETNAME
 @end example
 
-Some stm32x-specific commands
-@footnote{Currently there is a @command{stm32x mass_erase} command.
+Some stm32f1x-specific commands
+@footnote{Currently there is a @command{stm32f1x mass_erase} command.
 That seems pointless since the same effect can be had using the
 standard @command{flash erase_address} command.}
 are defined:
 
-@deffn Command {stm32x lock} num
+@deffn Command {stm32f1x lock} num
 Locks the entire stm32 device.
 The @var{num} parameter is a value shown by @command{flash banks}.
 @end deffn
 
-@deffn Command {stm32x unlock} num
+@deffn Command {stm32f1x unlock} num
 Unlocks the entire stm32 device.
 The @var{num} parameter is a value shown by @command{flash banks}.
 @end deffn
 
-@deffn Command {stm32x options_read} num
+@deffn Command {stm32f1x options_read} num
 Read and display the stm32 option bytes written by
-the @command{stm32x options_write} command.
+the @command{stm32f1x options_write} command.
 The @var{num} parameter is a value shown by @command{flash banks}.
 @end deffn
 
-@deffn Command {stm32x options_write} num (@option{SWWDG}|@option{HWWDG}) (@option{RSTSTNDBY}|@option{NORSTSTNDBY}) (@option{RSTSTOP}|@option{NORSTSTOP})
+@deffn Command {stm32f1x options_write} num (@option{SWWDG}|@option{HWWDG}) (@option{RSTSTNDBY}|@option{NORSTSTNDBY}) (@option{RSTSTOP}|@option{NORSTSTOP})
 Writes the stm32 option byte with the specified values.
 The @var{num} parameter is a value shown by @command{flash banks}.
 @end deffn
 @end deffn
 
+@deffn {Flash Driver} stm32f2x
+All members of the STM32F2 and STM32F4 microcontroller families from ST Microelectronics
+include internal flash and use ARM Cortex-M3/M4 cores.
+The driver automatically recognizes a number of these chips using
+the chip identification register, and autoconfigures itself.
+
+Note that some devices have been found that have a flash size register that contains
+an invalid value, to workaround this issue you can override the probed value used by
+the flash driver.
+
+@example
+flash bank $_FLASHNAME stm32f2x 0 0x20000 0 0 $_TARGETNAME
+@end example
+
+Some stm32f2x-specific commands are defined:
+
+@deffn Command {stm32f2x lock} num
+Locks the entire stm32 device.
+The @var{num} parameter is a value shown by @command{flash banks}.
+@end deffn
+
+@deffn Command {stm32f2x unlock} num
+Unlocks the entire stm32 device.
+The @var{num} parameter is a value shown by @command{flash banks}.
+@end deffn
+@end deffn
+
+@deffn {Flash Driver} stm32lx
+All members of the STM32L microcontroller families from ST Microelectronics
+include internal flash and use ARM Cortex-M3 cores.
+The driver automatically recognizes a number of these chips using
+the chip identification register, and autoconfigures itself.
+
+Note that some devices have been found that have a flash size register that contains
+an invalid value, to workaround this issue you can override the probed value used by
+the flash driver.
+
+@example
+flash bank $_FLASHNAME stm32lx 0 0x20000 0 0 $_TARGETNAME
+@end example
+@end deffn
+
 @deffn {Flash Driver} str7x
 All members of the STR7 microcontroller family from ST Microelectronics
 include internal flash and use ARM7TDMI cores.
@@ -4778,6 +5471,19 @@ flash bank vbank1 virtual 0x9fc00000 0 0 0 $_TARGETNAME $_FLASHNAME
 @end example
 @end deffn
 
+@deffn {Flash Driver} fm3
+All members of the FM3 microcontroller family from Fujitsu
+include internal flash and use ARM Cortex M3 cores.
+The @var{fm3} driver uses the @var{target} parameter to select the
+correct bank config, it can currently be one of the following:
+@code{mb9bfxx1.cpu}, @code{mb9bfxx2.cpu}, @code{mb9bfxx3.cpu},
+@code{mb9bfxx4.cpu}, @code{mb9bfxx5.cpu} or @code{mb9bfxx6.cpu}.
+
+@example
+flash bank $_FLASHNAME fm3 0 0 0 0 $_TARGETNAME
+@end example
+@end deffn
+
 @subsection str9xpec driver
 @cindex str9xpec
 
@@ -4936,41 +5642,74 @@ Write the binary file @var{filename} to mflash bank @var{num}, starting at
 @var{offset} bytes from the beginning of the bank.
 @end deffn
 
+@node Flash Programming
+@chapter Flash Programming
+
+OpenOCD implements numerous ways to program the target flash, whether internal or external.
+Programming can be acheived by either using GDB @ref{programmingusinggdb,,Programming using GDB},
+or using the cmds given in @ref{flashprogrammingcommands,,Flash Programming Commands}.
+
+@*To simplify using the flash cmds directly a jimtcl script is available that handles the programming and verify stage.
+OpenOCD will program/verify/reset the target and shutdown.
+
+The script is executed as follows and by default the following actions will be peformed.
+@enumerate
+@item 'init' is executed.
+@item 'reset init' is called to reset and halt the target, any 'reset init' scripts are executed.
+@item @code{flash write_image} is called to erase and write any flash using the filename given.
+@item @code{verify_image} is called if @option{verify} parameter is given.
+@item @code{reset run} is called if @option{reset} parameter is given.
+@item OpenOCD is shutdown.
+@end enumerate
+
+An example of usage is given below. @xref{program}.
+
+@example
+# program and verify using elf/hex/s19. verify and reset
+# are optional parameters
+openocd -f board/stm32f3discovery.cfg \
+       -c "program filename.elf verify reset"
+
+# binary files need the flash address passing
+openocd -f board/stm32f3discovery.cfg \
+       -c "program filename.bin 0x08000000"
+@end example
+
 @node NAND Flash Commands
 @chapter NAND Flash Commands
 @cindex NAND
 
 Compared to NOR or SPI flash, NAND devices are inexpensive
-and high density.  Today's NAND chips, and multi-chip modules,
+and high density. Today's NAND chips, and multi-chip modules,
 commonly hold multiple GigaBytes of data.
 
 NAND chips consist of a number of ``erase blocks'' of a given
 size (such as 128 KBytes), each of which is divided into a
-number of pages (of perhaps 512 or 2048 bytes each).  Each
+number of pages (of perhaps 512 or 2048 bytes each). Each
 page of a NAND flash has an ``out of band'' (OOB) area to hold
 Error Correcting Code (ECC) and other metadata, usually 16 bytes
 of OOB for every 512 bytes of page data.
 
 One key characteristic of NAND flash is that its error rate
-is higher than that of NOR flash.  In normal operation, that
-ECC is used to correct and detect errors.  However, NAND
+is higher than that of NOR flash. In normal operation, that
+ECC is used to correct and detect errors. However, NAND
 blocks can also wear out and become unusable; those blocks
-are then marked "bad".  NAND chips are even shipped from the
-manufacturer with a few bad blocks.  The highest density chips
+are then marked "bad". NAND chips are even shipped from the
+manufacturer with a few bad blocks. The highest density chips
 use a technology (MLC) that wears out more quickly, so ECC
 support is increasingly important as a way to detect blocks
 that have begun to fail, and help to preserve data integrity
 with techniques such as wear leveling.
 
-Software is used to manage the ECC.  Some controllers don't
+Software is used to manage the ECC. Some controllers don't
 support ECC directly; in those cases, software ECC is used.
 Other controllers speed up the ECC calculations with hardware.
-Single-bit error correction hardware is routine.  Controllers
+Single-bit error correction hardware is routine. Controllers
 geared for newer MLC chips may correct 4 or more errors for
 every 512 bytes of data.
 
 You will need to make sure that any data you write using
-OpenOCD includes the apppropriate kind of ECC.  For example,
+OpenOCD includes the apppropriate kind of ECC. For example,
 that may mean passing the @code{oob_softecc} flag when
 writing NAND data, or ensuring that the correct hardware
 ECC mode is used.
@@ -4986,7 +5725,7 @@ such as in its reset-init script or in procures defined
 to access that device.
 @item Operate on the flash via @command{nand subcommand}
 @* Often commands to manipulate the flash are typed by a human, or run
-via a script in some automated way.  Common task include writing a
+via a script in some automated way. Common task include writing a
 boot loader, operating system, or other data needed to initialize or
 de-brick a board.
 @end enumerate
@@ -5000,7 +5739,7 @@ is larger than 0xffffffff, the largest 32-bit unsigned integer.)
 Some larger devices will work, since they are actually multi-chip
 modules with two smaller chips and individual chipselect lines.
 
-@anchor{NAND Configuration}
+@anchor{nandconfiguration}
 @section NAND Configuration Commands
 @cindex NAND configuration
 
@@ -5018,20 +5757,20 @@ In some cases, configuring a device will activate extra
 commands; see the controller-specific documentation.
 
 @b{NOTE:} This command is not available after OpenOCD
-initialization has completed.  Use it in board specific
+initialization has completed. Use it in board specific
 configuration files, not interactively.
 
 @itemize @bullet
 @item @var{name} ... may be used to reference the NAND bank
-in most other NAND commands.  A number is also available.
+in most other NAND commands. A number is also available.
 @item @var{driver} ... identifies the NAND controller driver
 associated with the NAND device being declared.
-@xref{NAND Driver List}.
+@xref{nanddriverlist,,NAND Driver List}.
 @item @var{target} ... names the target used when issuing
 commands to the NAND controller.
 @comment Actually, it's currently a controller-specific parameter...
 @item @var{configparams} ... controllers may support, or require,
-additional parameters.  See the controller-specific documentation
+additional parameters. See the controller-specific documentation
 for more information.
 @end itemize
 @end deffn
@@ -5070,7 +5809,7 @@ Use a complete path name for @var{filename}, so you don't depend
 on the directory used to start the OpenOCD server.
 
 The @var{offset} and @var{length} must be exact multiples of the
-device's page size.  They describe a data region; the OOB data
+device's page size. They describe a data region; the OOB data
 associated with each such page may also be accessed.
 
 @b{NOTE:} At the time this text was written, no error correction
@@ -5119,7 +5858,7 @@ will still report that the block ``is'' bad.
 @cindex NAND writing
 @cindex NAND programming
 Writes binary data from the file into the specified NAND device,
-starting at the specified offset.  Those pages should already
+starting at the specified offset. Those pages should already
 have been erased; you can't change zero bits to one bits.
 The @var{num} parameter is the value shown by @command{nand list}.
 
@@ -5130,14 +5869,14 @@ The @var{offset} must be an exact multiple of the device's page size.
 All data in the file will be written, assuming it doesn't run
 past the end of the device.
 Only full pages are written, and any extra space in the last
-page will be filled with 0xff bytes.  (That includes OOB data,
+page will be filled with 0xff bytes. (That includes OOB data,
 if that's being written.)
 
 @b{NOTE:} At the time this text was written, bad blocks are
-ignored.  That is, this routine will not skip bad blocks,
-but will instead try to write them.  This can cause problems.
+ignored. That is, this routine will not skip bad blocks,
+but will instead try to write them. This can cause problems.
 
-Provide at most one @var{option} parameter.  With some
+Provide at most one @var{option} parameter. With some
 NAND drivers, the meanings of these parameters may change
 if @command{nand raw_access} was used to disable hardware ECC.
 @itemize @bullet
@@ -5149,7 +5888,7 @@ a @code{write_page} routine, that routine may write the OOB
 with hardware-computed ECC data.
 @item @code{oob_only}
 @*File has only raw OOB data, which is written to the OOB area.
-Each page's data area stays untouched.  @i{This can be a dangerous
+Each page's data area stays untouched. @i{This can be a dangerous
 option}, since it can invalidate the ECC data.
 You may need to force raw access to use this mode.
 @item @code{oob_raw}
@@ -5196,7 +5935,7 @@ can be compared against the contents produced from @command{nand dump}.
 
 @b{NOTE:} This will not work when the underlying NAND controller
 driver's @code{write_page} routine must update the OOB with a
-hardward-computed ECC before the data is written.  This limitation may
+hardward-computed ECC before the data is written. This limitation may
 be removed in a future release.
 @end deffn
 
@@ -5205,7 +5944,7 @@ be removed in a future release.
 
 @deffn Command {nand check_bad_blocks} num [offset length]
 Checks for manufacturer bad block markers on the specified NAND
-device.  If no parameters are provided, checks the whole
+device. If no parameters are provided, checks the whole
 device; otherwise, starts at the specified @var{offset} and
 continues for @var{length} bytes.
 Both of those values must be exact multiples of the device's
@@ -5229,21 +5968,21 @@ Sets or clears an flag affecting how page I/O is done.
 The @var{num} parameter is the value shown by @command{nand list}.
 
 This flag is cleared (disabled) by default, but changing that
-value won't affect all NAND devices.  The key factor is whether
+value won't affect all NAND devices. The key factor is whether
 the underlying driver provides @code{read_page} or @code{write_page}
-methods.  If it doesn't provide those methods, the setting of
+methods. If it doesn't provide those methods, the setting of
 this flag is irrelevant; all access is effectively ``raw''.
 
 When those methods exist, they are normally used when reading
 data (@command{nand dump} or reading bad block markers) or
-writing it (@command{nand write}).  However, enabling
+writing it (@command{nand write}). However, enabling
 raw access (setting the flag) prevents use of those methods,
 bypassing hardware ECC logic.
 @i{This can be a dangerous option}, since writing blocks
 with the wrong ECC data can cause them to be marked as bad.
 @end deffn
 
-@anchor{NAND Driver List}
+@anchor{nanddriverlist}
 @section NAND Driver List
 As noted above, the @command{nand device} command allows
 driver-specific options and behaviors.
@@ -5251,35 +5990,35 @@ Some controllers also activate controller-specific commands.
 
 @deffn {NAND Driver} at91sam9
 This driver handles the NAND controllers found on AT91SAM9 family chips from
-Atmel.  It takes two extra parameters: address of the NAND chip;
+Atmel. It takes two extra parameters: address of the NAND chip;
 address of the ECC controller.
 @example
 nand device $NANDFLASH at91sam9 $CHIPNAME 0x40000000 0xfffffe800
 @end example
 AT91SAM9 chips support single-bit ECC hardware. The @code{write_page} and
 @code{read_page} methods are used to utilize the ECC hardware unless they are
-disabled by using the @command{nand raw_access} command.  There are four
+disabled by using the @command{nand raw_access} command. There are four
 additional commands that are needed to fully configure the AT91SAM9 NAND
-controller.  Two are optional; most boards use the same wiring for ALE/CLE:
+controller. Two are optional; most boards use the same wiring for ALE/CLE:
 @deffn Command {at91sam9 cle} num addr_line
-Configure the address line used for latching commands.  The @var{num}
+Configure the address line used for latching commands. The @var{num}
 parameter is the value shown by @command{nand list}.
 @end deffn
 @deffn Command {at91sam9 ale} num addr_line
-Configure the address line used for latching addresses.  The @var{num}
+Configure the address line used for latching addresses. The @var{num}
 parameter is the value shown by @command{nand list}.
 @end deffn
 
 For the next two commands, it is assumed that the pins have already been
 properly configured for input or output.
 @deffn Command {at91sam9 rdy_busy} num pio_base_addr pin
-Configure the RDY/nBUSY input from the NAND device.  The @var{num}
-parameter is the value shown by @command{nand list}.  @var{pio_base_addr}
+Configure the RDY/nBUSY input from the NAND device. The @var{num}
+parameter is the value shown by @command{nand list}. @var{pio_base_addr}
 is the base address of the PIO controller and @var{pin} is the pin number.
 @end deffn
 @deffn Command {at91sam9 ce} num pio_base_addr pin
-Configure the chip enable input to the NAND device.  The @var{num}
-parameter is the value shown by @command{nand list}.  @var{pio_base_addr}
+Configure the chip enable input to the NAND device. The @var{num}
+parameter is the value shown by @command{nand list}. @var{pio_base_addr}
 is the base address of the PIO controller and @var{pin} is the pin number.
 @end deffn
 @end deffn
@@ -5304,7 +6043,7 @@ the @command{nand raw_access} command.
 
 @deffn {NAND Driver} lpc3180
 These controllers require an extra @command{nand device}
-parameter:  the clock rate used by the controller.
+parameter: the clock rate used by the controller.
 @deffn Command {lpc3180 select} num [mlc|slc]
 Configures use of the MLC or SLC controller mode.
 MLC implies use of hardware ECC.
@@ -5312,15 +6051,36 @@ The @var{num} parameter is the value shown by @command{nand list}.
 @end deffn
 
 At this writing, this driver includes @code{write_page}
-and @code{read_page} methods.  Using @command{nand raw_access}
+and @code{read_page} methods. Using @command{nand raw_access}
 to disable those methods will prevent use of hardware ECC
 in the MLC controller mode, but won't change SLC behavior.
 @end deffn
 @comment current lpc3180 code won't issue 5-byte address cycles
 
+@deffn {NAND Driver} mx3
+This driver handles the NAND controller in i.MX31. The mxc driver
+should work for this chip aswell.
+@end deffn
+
+@deffn {NAND Driver} mxc
+This driver handles the NAND controller found in Freescale i.MX
+chips. It has support for v1 (i.MX27 and i.MX31) and v2 (i.MX35).
+The driver takes 3 extra arguments, chip (@option{mx27},
+@option{mx31}, @option{mx35}), ecc (@option{noecc}, @option{hwecc})
+and optionally if bad block information should be swapped between
+main area and spare area (@option{biswap}), defaults to off.
+@example
+nand device mx35.nand mxc imx35.cpu mx35 hwecc biswap
+@end example
+@deffn Command {mxc biswap} bank_num [enable|disable]
+Turns on/off bad block information swaping from main area,
+without parameter query status.
+@end deffn
+@end deffn
+
 @deffn {NAND Driver} orion
 These controllers require an extra @command{nand device}
-parameter:  the address of the controller.
+parameter: the address of the controller.
 @example
 nand device orion 0xd8000000
 @end example
@@ -5457,7 +6217,7 @@ Useful in connection with script files
 Close the OpenOCD daemon, disconnecting all clients (GDB, telnet, other).
 @end deffn
 
-@anchor{debug_level}
+@anchor{debuglevel}
 @deffn Command debug_level [n]
 @cindex message level
 Display debug level.
@@ -5491,7 +6251,7 @@ the initial log output channel is stderr.
 Add @var{directory} to the file/script search path.
 @end deffn
 
-@anchor{Target State handling}
+@anchor{targetstatehandling}
 @section Target State handling
 @cindex reset
 @cindex halt
@@ -5501,14 +6261,14 @@ In this section ``target'' refers to a CPU configured as
 shown earlier (@pxref{CPU Configuration}).
 These commands, like many, implicitly refer to
 a current target which is used to perform the
-various operations.  The current target may be changed
+various operations. The current target may be changed
 by using @command{targets} command with the name of the
 target which should become current.
 
 @deffn Command reg [(number|name) [value]]
 Access a single register by @var{number} or by its @var{name}.
 The target must generally be halted before access to CPU core
-registers is allowed.  Depending on the hardware, some other
+registers is allowed. Depending on the hardware, some other
 registers may be accessible while the target is running.
 
 @emph{With no arguments}:
@@ -5523,7 +6283,7 @@ are flagged as such.
 @emph{With both number/name and value}: set register's value.
 Writes may be held in a writeback cache internal to OpenOCD,
 so that setting the value marks the register as dirty instead
-of immediately flushing that value.  Resuming CPU execution
+of immediately flushing that value. Resuming CPU execution
 (including by single stepping) or otherwise activating the
 relevant module will flush such values.
 
@@ -5546,7 +6306,7 @@ Debug and trace infrastructure:
 @deffnx Command wait_halt [ms]
 The @command{halt} command first sends a halt request to the target,
 which @command{wait_halt} doesn't.
-Otherwise these behave the same:  wait up to @var{ms} milliseconds,
+Otherwise these behave the same: wait up to @var{ms} milliseconds,
 or 5 seconds if there is no parameter, for the target to halt
 (and enter debug mode).
 Using 0 as the @var{ms} parameter prevents OpenOCD from waiting.
@@ -5558,7 +6318,7 @@ This is because that operation also puts the core into a low
 power mode by gating the core clock;
 but the core clock is needed to detect JTAG clock transitions.
 
-One partial workaround uses adaptive clocking:  when the core is
+One partial workaround uses adaptive clocking: when the core is
 interrupted the operation completes, then JTAG clocks are accepted
 at least until the interrupt handler completes.
 However, this workaround is often unusable since the processor, board,
@@ -5588,7 +6348,7 @@ Single-step the target at its current code position,
 or the optional @var{address} if it is provided.
 @end deffn
 
-@anchor{Reset Command}
+@anchor{resetcommand}
 @deffn Command reset
 @deffnx Command {reset run}
 @deffnx Command {reset halt}
@@ -5657,7 +6417,7 @@ into @file{dest_filename}.
 @emph{No description provided.}
 @end deffn
 
-@deffn Command  meminfo
+@deffn Command meminfo
 Display available RAM memory on OpenOCD host.
 Used in OpenOCD regression testing scripts.
 @end deffn
@@ -5679,7 +6439,7 @@ Unlinks the file @file{filename}.
 Removes all data in the file @file{filename}.
 @end deffn
 
-@anchor{Memory access}
+@anchor{memoryaccess}
 @section Memory access commands
 @cindex memory access
 
@@ -5723,13 +6483,11 @@ Otherwise, or if the optional @var{phys} flag is specified,
 @var{addr} is interpreted as a physical address.
 @end deffn
 
-
-@anchor{Image access}
+@anchor{imageaccess}
 @section Image loading commands
 @cindex image loading
 @cindex image dumping
 
-@anchor{dump_image}
 @deffn Command {dump_image} filename address size
 Dump @var{size} bytes of target memory starting at @var{address} to the
 binary file named @var{filename}.
@@ -5740,22 +6498,21 @@ Loads an image stored in memory by @command{fast_load_image} to the
 current target. Must be preceeded by fast_load_image.
 @end deffn
 
-@deffn Command {fast_load_image} filename address [@option{bin}|@option{ihex}|@option{elf}]
+@deffn Command {fast_load_image} filename address [@option{bin}|@option{ihex}|@option{elf}|@option{s19}]
 Normally you should be using @command{load_image} or GDB load. However, for
 testing purposes or when I/O overhead is significant(OpenOCD running on an embedded
 host), storing the image in memory and uploading the image to the target
 can be a way to upload e.g. multiple debug sessions when the binary does not change.
 Arguments are the same as @command{load_image}, but the image is stored in OpenOCD host
-memory, i.e. does not affect target.  This approach is also useful when profiling
+memory, i.e. does not affect target. This approach is also useful when profiling
 target programming performance as I/O and target programming can easily be profiled
 separately.
 @end deffn
 
-@anchor{load_image}
-@deffn Command {load_image} filename address [[@option{bin}|@option{ihex}|@option{elf}] @option{min_addr} @option{max_length}]
-Load image from file @var{filename} to target memory offset by @var{address} from its load address. 
+@deffn Command {load_image} filename address [[@option{bin}|@option{ihex}|@option{elf}|@option{s19}] @option{min_addr} @option{max_length}]
+Load image from file @var{filename} to target memory offset by @var{address} from its load address.
 The file format may optionally be specified
-(@option{bin}, @option{ihex}, or @option{elf}).
+(@option{bin}, @option{ihex}, @option{elf}, or @option{s19}).
 In addition the following arguments may be specifed:
 @var{min_addr} - ignore data below @var{min_addr} (this is w.r.t. to the target's load address + @var{address})
 @var{max_length} - maximum number of bytes to load.
@@ -5763,7 +6520,7 @@ In addition the following arguments may be specifed:
 proc load_image_bin @{fname foffset address length @} @{
     # Load data from fname filename at foffset offset to
     # target at address. Load at most length bytes.
-    load_image $fname [expr $address - $foffset] bin $address $length      
+    load_image $fname [expr $address - $foffset] bin $address $length
 @}
 @end example
 @end deffn
@@ -5800,7 +6557,7 @@ at @var{address} for @var{length} bytes.
 This is a software breakpoint, unless @option{hw} is specified
 in which case it will be a hardware breakpoint.
 
-(@xref{arm9 vector_catch}, or @pxref{xscale vector_catch},
+(@xref{arm9vectorcatch,,arm9 vector_catch}, or @pxref{xscalevectorcatch,,xscale vector_catch},
 for similar mechanisms that do not consume hardware breakpoints.)
 @end deffn
 
@@ -5819,7 +6576,7 @@ The watch point is an "access" watchpoint unless
 the @option{r} or @option{w} parameter is provided,
 defining it as respectively a read or write watchpoint.
 If a @var{value} is provided, that value is used when determining if
-the watchpoint should trigger.  The value may be first be masked
+the watchpoint should trigger. The value may be first be masked
 using @var{mask} to mark ``don't care'' fields.
 @end deffn
 
@@ -5851,7 +6608,7 @@ OpenOCD packages most such operations in its standard command framework.
 Some of those operations don't fit well in that framework, so they are
 exposed here as architecture or implementation (core) specific commands.
 
-@anchor{ARM Hardware Tracing}
+@anchor{armhardwaretracing}
 @section ARM Hardware Tracing
 @cindex tracing
 @cindex ETM
@@ -5876,7 +6633,7 @@ in the board-specific configuration file.
 @item
 If the CPU doesn't provide an external interface, it probably
 has an ``Embedded Trace Buffer'' (ETB) on the chip, which is a
-dedicated SRAM.  4KBytes is one common ETB size.
+dedicated SRAM. 4KBytes is one common ETB size.
 Configuring an ETM coupled only to an ETB belongs in the CPU-specific
 (target) configuration file, since it works the same on all boards.
 @end itemize
@@ -5904,7 +6661,7 @@ with the current XScale trace support, or should be
 shared with eventual Nexus-style trace module support.
 
 At this writing (November 2009) only ARM7, ARM9, and ARM11 support
-for ETM modules is available.  The code should be able to
+for ETM modules is available. The code should be able to
 work with some newer cores; but not all of them support
 this original style of JTAG access.
 @end quotation
@@ -5914,7 +6671,7 @@ ETM setup is coupled with the trace port driver configuration.
 
 @deffn {Config Command} {etm config} target width mode clocking driver
 Declares the ETM associated with @var{target}, and associates it
-with a given trace port @var{driver}.  @xref{Trace Port Drivers}.
+with a given trace port @var{driver}. @xref{traceportdrivers,,Trace Port Drivers}.
 
 Several of the parameters must reflect the trace port capabilities,
 which are a function of silicon capabilties (exposed later
@@ -5974,10 +6731,10 @@ The value is one of
 @option{address} (save addresses),
 @option{all} (save data and addresses)
 @item @var{context_id_bits} ... 0, 8, 16, or 32
-@item @var{cycle_accurate} ...  @option{enable} or @option{disable}
+@item @var{cycle_accurate} ... @option{enable} or @option{disable}
 cycle-accurate instruction tracing.
 Before ETMv3, enabling this causes much extra data to be recorded.
-@item @var{branch_output} ...  @option{enable} or @option{disable}.
+@item @var{branch_output} ... @option{enable} or @option{disable}.
 Disable this unless you need to try reconstructing the instruction
 trace stream without an image of the code.
 @end itemize
@@ -6005,17 +6762,17 @@ various trace registers using @command{reg ETM_*} commands.
 For the definitions of these registers, read ARM publication
 @emph{IHI 0014, ``Embedded Trace Macrocell, Architecture Specification''}.
 Be aware that most of the relevant registers are write-only,
-and that ETM resources are limited.  There are only a handful
+and that ETM resources are limited. There are only a handful
 of address comparators, data comparators, counters, and so on.
 
 Examples of scenarios you might arrange to trace include:
 
 @itemize
 @item Code flow within a function, @emph{excluding} subroutines
-it calls.  Use address range comparators to enable tracing
+it calls. Use address range comparators to enable tracing
 for instruction access within that function's body.
 @item Code flow within a function, @emph{including} subroutines
-it calls.  Use the sequencer and address comparators to activate
+it calls. Use the sequencer and address comparators to activate
 tracing on an ``entered function'' state, then deactivate it by
 exiting that state when the function's exit code is invoked.
 @item Code flow starting at the fifth invocation of a function,
@@ -6055,7 +6812,7 @@ Starts trace data collection.
 Stops trace data collection.
 @end deffn
 
-@anchor{Trace Port Drivers}
+@anchor{traceportdrivers}
 @subsection Trace Port Drivers
 
 To use an ETM trace port it must be associated with a driver.
@@ -6103,7 +6860,7 @@ how the event caused trouble.
 
 @deffn {Trace Port Driver} oocd_trace
 This driver isn't available unless OpenOCD was explicitly configured
-with the @option{--enable-oocd_trace} option.  You probably don't want
+with the @option{--enable-oocd_trace} option. You probably don't want
 to configure it unless you've built the appropriate prototype hardware;
 it's @emph{proof-of-concept} software.
 
@@ -6234,7 +6991,6 @@ unsafe, especially with targets running at very low speeds. This command was int
 with OpenOCD rev. 60, and requires a few bytes of working area.
 @end deffn
 
-@anchor{arm7_9 fast_memory_access}
 @deffn Command {arm7_9 fast_memory_access} [@option{enable}|@option{disable}]
 Displays the value of the flag controlling use of memory writes and reads
 that don't check completion of the operation.
@@ -6269,12 +7025,12 @@ ARM9-family cores are built around ARM9TDMI or ARM9E (including ARM9EJS)
 integer processors.
 Such cores include the ARM920T, ARM926EJ-S, and ARM966.
 
-@c 9-june-2009:  tried this on arm920t, it didn't work.
+@c 9-june-2009: tried this on arm920t, it didn't work.
 @c no-params always lists nothing caught, and that's how it acts.
-@c 23-oct-2009:  doesn't work _consistently_ ... as if the ICE
+@c 23-oct-2009: doesn't work _consistently_ ... as if the ICE
 @c versions have different rules about when they commit writes.
 
-@anchor{arm9 vector_catch}
+@anchor{arm9vectorcatch}
 @deffn Command {arm9 vector_catch} [@option{all}|@option{none}|list]
 @cindex vector_catch
 Vector Catch hardware provides a sort of dedicated breakpoint
@@ -6413,34 +7169,34 @@ _vectors:
 
 Alternatively, you may choose to keep some or all of the mini-IC
 vector table entries synced with those written to memory by your
-system software.  The mini-IC can not be modified while the processor
+system software. The mini-IC can not be modified while the processor
 is executing, but for each vector table entry not previously defined
 using the @code{xscale vector_table} command, OpenOCD will copy the
 value from memory to the mini-IC every time execution resumes from a
-halt.  This is done for both high and low vector tables (although the
+halt. This is done for both high and low vector tables (although the
 table not in use may not be mapped to valid memory, and in this case
-that copy operation will silently fail).  This means that you will
+that copy operation will silently fail). This means that you will
 need to briefly halt execution at some strategic point during system
 start-up; e.g., after the software has initialized the vector table,
-but before exceptions are enabled.  A breakpoint can be used to
+but before exceptions are enabled. A breakpoint can be used to
 accomplish this once the appropriate location in the start-up code has
-been identified.  A watchpoint over the vector table region is helpful
-in finding the location if you're not sure.  Note that the same
+been identified. A watchpoint over the vector table region is helpful
+in finding the location if you're not sure. Note that the same
 situation exists any time the vector table is modified by the system
 software.
 
 The debug handler must be placed somewhere in the address space using
-the @code{xscale debug_handler} command.  The allowed locations for the
+the @code{xscale debug_handler} command. The allowed locations for the
 debug handler are either (0x800 - 0x1fef800) or (0xfe000800 -
 0xfffff800). The default value is 0xfe000800.
 
 XScale has resources to support two hardware breakpoints and two
-watchpoints.  However, the following restrictions on watchpoint
+watchpoints. However, the following restrictions on watchpoint
 functionality apply: (1) the value and mask arguments to the @code{wp}
 command are not supported, (2) the watchpoint length must be a
 power of two and not less than four, and can not be greater than the
 watchpoint address, and (3) a watchpoint with a length greater than
-four consumes all the watchpoint hardware resources.  This means that
+four consumes all the watchpoint hardware resources. This means that
 at any one time, you can have enabled either two watchpoints with a
 length of four, or one watchpoint with a length greater than four.
 
@@ -6499,7 +7255,7 @@ The image @var{type} may be one of
 @option{mem}, or @option{builder}.
 @end deffn
 
-@anchor{xscale vector_catch}
+@anchor{xscalevectorcatch}
 @deffn Command {xscale vector_catch} [mask]
 @cindex vector_catch
 Display a bitmask showing the hardware vectors to catch.
@@ -6518,7 +7274,6 @@ The mask bits correspond with bit 16..23 in the DCSR:
 @end example
 @end deffn
 
-@anchor{xscale vector_table}
 @deffn Command {xscale vector_table} [(@option{low}|@option{high}) index value]
 @cindex vector_table
 
@@ -6583,7 +7338,7 @@ cores @emph{except the ARM1176} use the same six bits.
 @cindex Debug Access Port
 @cindex DAP
 These commands are specific to ARM architecture v7 Debug Access Port (DAP),
-included on Cortex-M3 and Cortex-A8 systems.
+included on Cortex-M and Cortex-A systems.
 They are available in addition to other core-specific commands that may be available.
 
 @deffn Command {dap apid} [num]
@@ -6611,14 +7366,32 @@ memory bus access [0-255], giving additional time to respond to reads.
 If @var{value} is defined, first assigns that.
 @end deffn
 
-@subsection Cortex-M3 specific commands
-@cindex Cortex-M3
+@deffn Command {dap apcsw} [0 / 1]
+fix CSW_SPROT from register AP_REG_CSW on selected dap.
+Defaulting to 0.
+@end deffn
 
-@deffn Command {cortex_m3 maskisr} (@option{on}|@option{off})
+@subsection Cortex-M specific commands
+@cindex Cortex-M
+
+@deffn Command {cortex_m maskisr} (@option{auto}|@option{on}|@option{off})
 Control masking (disabling) interrupts during target step/resume.
+
+The @option{auto} option handles interrupts during stepping a way they get
+served but don't disturb the program flow. The step command first allows
+pending interrupt handlers to execute, then disables interrupts and steps over
+the next instruction where the core was halted. After the step interrupts
+are enabled again. If the interrupt handlers don't complete within 500ms,
+the step command leaves with the core running.
+
+Note that a free breakpoint is required for the @option{auto} option. If no
+breakpoint is available at the time of the step, then the step is taken
+with interrupts enabled, i.e. the same way the @option{off} option does.
+
+Default is @option{auto}.
 @end deffn
 
-@deffn Command {cortex_m3 vector_catch} [@option{all}|@option{none}|list]
+@deffn Command {cortex_m vector_catch} [@option{all}|@option{none}|list]
 @cindex vector_catch
 Vector Catch hardware provides dedicated breakpoints
 for certain hardware events.
@@ -6645,7 +7418,7 @@ must also be explicitly enabled.
 This finishes by listing the current vector catch configuration.
 @end deffn
 
-@deffn Command {cortex_m3 reset_config} (@option{srst}|@option{sysresetreq}|@option{vectreset})
+@deffn Command {cortex_m reset_config} (@option{srst}|@option{sysresetreq}|@option{vectreset})
 Control reset handling. The default @option{srst} is to use srst if fitted,
 otherwise fallback to @option{vectreset}.
 @itemize @minus
@@ -6653,14 +7426,14 @@ otherwise fallback to @option{vectreset}.
 @item @option{sysresetreq} use NVIC SYSRESETREQ to reset system.
 @item @option{vectreset} use NVIC VECTRESET to reset system.
 @end itemize
-Using @option{vectreset} is a safe option for all current Cortex-M3 cores.
+Using @option{vectreset} is a safe option for all current Cortex-M cores.
 This however has the disadvantage of only resetting the core, all peripherals
 are uneffected. A solution would be to use a @code{reset-init} event handler to manually reset
 the peripherals.
-@xref{Target Events}.
+@xref{targetevents,,Target Events}.
 @end deffn
 
-@anchor{Software Debug Messages and Tracing}
+@anchor{softwaredebugmessagesandtracing}
 @section Software Debug Messages and Tracing
 @cindex Linux-ARM DCC support
 @cindex tracing
@@ -6672,11 +7445,11 @@ The most powerful mechanism is semihosting, but there is also
 a lighter weight mechanism using only the DCC channel.
 
 Currently @command{target_request debugmsgs}
-is supported only for @option{arm7_9} and @option{cortex_m3} cores.
+is supported only for @option{arm7_9} and @option{cortex_m} cores.
 These messages are received as part of target polling, so
 you need to have @command{poll on} active to receive them.
 They are intrusive in that they will affect program execution
-times.  If that is a problem, @pxref{ARM Hardware Tracing}.
+times. If that is a problem, @pxref{armhardwaretracing,,ARM Hardware Tracing}.
 
 See @file{libdcc} in the contrib dir for more details.
 In addition to sending strings, characters, and
@@ -6739,7 +7512,7 @@ With the parameter @option{clear}, erases all current trace point counters.
 With a numeric @var{identifier} parameter, creates a new a trace point counter
 and associates it with that identifier.
 
-@emph{Important:}  The identifier and the trace point number
+@emph{Important:} The identifier and the trace point number
 are not related except by this command.
 These trace point numbers always start at zero (from server startup,
 or after @command{trace point clear}) and count up from there.
@@ -6750,7 +7523,7 @@ or after @command{trace point clear}) and count up from there.
 @chapter JTAG Commands
 @cindex JTAG Commands
 Most general purpose JTAG commands have been presented earlier.
-(@xref{JTAG Speed}, @ref{Reset Configuration}, and @ref{TAP Declaration}.)
+(@xref{jtagspeed,,JTAG Speed}, @ref{Reset Configuration}, and @ref{TAP Declaration}.)
 Lower level JTAG commands, as presented here,
 may be needed to work with targets which require special
 attention during operations such as reset or initialization.
@@ -6797,7 +7570,7 @@ of those fields.
 For example, a 38 bit number might be specified as one
 field of 32 bits then one of 6 bits.
 @emph{For portability, never pass fields which are more
-than 32 bits long.  Many OpenOCD implementations do not
+than 32 bits long. Many OpenOCD implementations do not
 support 64-bit (or larger) integer values.}
 
 All TAPs other than @var{tap} must be in BYPASS mode.
@@ -6899,14 +7672,14 @@ to execute before they take effect.
 
 @deffn Command {verify_ircapture} (@option{enable}|@option{disable})
 Verify values captured during @sc{ircapture} and returned
-during IR scans.  Default is enabled, but this can be
+during IR scans. Default is enabled, but this can be
 overridden by @command{verify_jtag}.
 This flag is ignored when validating JTAG chain configuration.
 @end deffn
 
 @deffn Command {verify_jtag} (@option{enable}|@option{disable})
 Enables verification of DR and IR scans, to help detect
-programming errors.  For IR scans, @command{verify_ircapture}
+programming errors. For IR scans, @command{verify_ircapture}
 must also be enabled.
 Default is enabled.
 @end deffn
@@ -6945,12 +7718,12 @@ for update or more shifting
 
 Note that only six of those states are fully ``stable'' in the
 face of TMS fixed (low except for @sc{reset})
-and a free-running JTAG clock.  For all the
+and a free-running JTAG clock. For all the
 others, the next TCK transition changes to a new state.
 
 @itemize @bullet
 @item From @sc{drshift} and @sc{irshift}, clock transitions will
-produce side effects by changing register contents.  The values
+produce side effects by changing register contents. The values
 to be latched in upcoming @sc{drupdate} or @sc{irupdate} states
 may not be as expected.
 @item @sc{run/idle}, @sc{drpause}, and @sc{irpause} are reasonable
@@ -7062,7 +7835,7 @@ Setting up GDB to work with OpenOCD can involve several components:
 
 @itemize
 @item The OpenOCD server support for GDB may need to be configured.
-@xref{GDB Configuration}.
+@xref{gdbconfiguration,,GDB Configuration}.
 @item GDB's support for OpenOCD may need configuration,
 as shown in this chapter.
 @item If you have a GUI environment like Eclipse,
@@ -7070,13 +7843,12 @@ that also will probably need to be configured.
 @end itemize
 
 Of course, the version of GDB you use will need to be one which has
-been built to know about the target CPU you're using.  It's probably
-part of the tool chain you're using.  For example, if you are doing
+been built to know about the target CPU you're using. It's probably
+part of the tool chain you're using. For example, if you are doing
 cross-development for ARM on an x86 PC, instead of using the native
 x86 @command{gdb} command you might use @command{arm-none-eabi-gdb}
 if that's the tool chain used to compile your code.
 
-@anchor{Connecting to GDB}
 @section Connecting to GDB
 @cindex Connecting to GDB
 Use GDB 6.7 or newer with OpenOCD if you run into trouble. For
@@ -7093,6 +7865,11 @@ A socket (TCP/IP) connection is typically started as follows:
 target remote localhost:3333
 @end example
 This would cause GDB to connect to the gdbserver on the local pc using port 3333.
+
+It is also possible to use the GDB extended remote protocol as follows:
+@example
+target extended-remote localhost:3333
+@end example
 @item
 A pipe connection is typically started as follows:
 @example
@@ -7165,7 +7942,7 @@ set remote hardware-watchpoint-limit 4
 @end example
 
 With that particular hardware (Cortex-M3) the hardware breakpoints
-only work for code running from flash memory.  Most other ARM systems
+only work for code running from flash memory. Most other ARM systems
 do not have such restrictions.
 
 Another example of useful GDB configuration came from a user who
@@ -7174,10 +7951,10 @@ and an RTOS until he told GDB to disable the IRQs while stepping:
 
 @example
 define hook-step
-mon cortex_m3 maskisr on
+mon cortex_m maskisr on
 end
 define hookpost-step
-mon cortex_m3 maskisr off
+mon cortex_m maskisr off
 end
 @end example
 
@@ -7188,6 +7965,7 @@ using @command{gdb -x filename}.
 
 @section Programming using GDB
 @cindex Programming using GDB
+@anchor{programmingusinggdb}
 
 By default the target memory map is sent to GDB. This can be disabled by
 the following OpenOCD configuration option:
@@ -7201,7 +7979,7 @@ working area.
 Informing GDB of the memory map of the target will enable GDB to protect any
 flash areas of the target and use hardware breakpoints by default. This means
 that the OpenOCD option @command{gdb_breakpoint_override} is not required when
-using a memory map. @xref{gdb_breakpoint_override}.
+using a memory map. @xref{gdbbreakpointoverride,,gdb_breakpoint_override}.
 
 To view the configured memory map in GDB, use the GDB command @option{info mem}
 All other unassigned addresses within GDB are treated as RAM.
@@ -7227,6 +8005,55 @@ $_TARGETNAME configure -event EVENTNAME BODY
 
 To verify any flash programming the GDB command @option{compare-sections}
 can be used.
+@anchor{usingopenocdsmpwithgdb}
+@section Using OpenOCD SMP with GDB
+@cindex SMP
+For SMP support following GDB serial protocol packet have been defined :
+@itemize @bullet
+@item j - smp status request
+@item J - smp set request
+@end itemize
+
+OpenOCD implements :
+@itemize @bullet
+@item @option{jc} packet for reading core id displayed by
+GDB connection. Reply is @option{XXXXXXXX} (8 hex digits giving core id) or
+ @option{E01} for target not smp.
+@item @option{JcXXXXXXXX} (8 hex digits) packet for setting core id displayed at next GDB continue
+(core id -1 is reserved for returning to normal resume mode). Reply @option{E01}
+for target not smp or @option{OK} on success.
+@end itemize
+
+Handling of this packet within GDB can be done :
+@itemize @bullet
+@item by the creation of an internal variable (i.e @option{_core}) by mean
+of function allocate_computed_value allowing following GDB command.
+@example
+set $_core 1
+#Jc01 packet is sent
+print $_core
+#jc packet is sent and result is affected in $
+@end example
+
+@item by the usage of GDB maintenance command as described in following example (2 cpus in SMP with
+core id 0 and 1 @pxref{definecputargetsworkinginsmp,,Define CPU targets working in SMP}).
+
+@example
+# toggle0 : force display of coreid 0
+define toggle0
+maint packet Jc0
+continue
+main packet Jc-1
+end
+# toggle1 : force display of coreid 1
+define toggle1
+maint packet Jc1
+continue
+main packet Jc-1
+end
+@end example
+@end itemize
+
 
 @node Tcl Scripting API
 @chapter Tcl Scripting API
@@ -7261,7 +8088,7 @@ The result is:
 
 Thus, to get the names of the associative array is easy:
 
-     foreach  { name value }   [set foo]   {
+     foreach { name value } [set foo] {
                 puts "Name: $name, Value: $value"
      }
 @end verbatim
@@ -7322,7 +8149,7 @@ is jim, not real tcl).
 @chapter FAQ
 @cindex faq
 @enumerate
-@anchor{FAQ RTCK}
+@anchor{faqrtck}
 @item @b{RTCK, also known as: Adaptive Clocking - What is it?}
 @cindex RTCK
 @cindex adaptive clocking
@@ -7335,7 +8162,7 @@ The two clocks are not synchronised, they are ``asynchronous''
 
 In order for the two to work together they must be synchronised
 well enough to work; JTAG can't go ten times faster than the CPU,
-for example.  There are 2 basic options:
+for example. There are 2 basic options:
 @enumerate
 @item
 Use a special "adaptive clocking" circuit to change the JTAG
@@ -7353,16 +8180,16 @@ situations where the CPU clock rate changes (perhaps to save
 power).
 
 For example, Atmel AT91SAM chips start operation from reset with
-a 32kHz system clock.  Boot firmware may activate the main oscillator
+a 32kHz system clock. Boot firmware may activate the main oscillator
 and PLL before switching to a faster clock (perhaps that 500 MHz
 ARM926 scenario).
 If you're using JTAG to debug that startup sequence, you must slow
-the JTAG clock to sometimes 1 to 4kHz.  After startup completes,
+the JTAG clock to sometimes 1 to 4kHz. After startup completes,
 JTAG can use a faster clock.
 
 Consider also debugging a 500MHz ARM926 hand held battery powered
 device that enters a low power ``deep sleep'' mode, at 32kHz CPU
-clock, between keystrokes unless it has work to do.   When would
+clock, between keystrokes unless it has work to do. When would
 that 5 MHz JTAG clock be usable?
 
 @b{Solution #1 - A special circuit}
@@ -7406,7 +8233,7 @@ ARM11 cores use an 8:1 division.
 @b{Xilinx rule of thumb} is 1/12 the clock speed.
 
 Note: most full speed FT2232 based JTAG adapters are limited to a
-maximum of 6MHz.  The ones using USB high speed chips (FT2232H)
+maximum of 6MHz. The ones using USB high speed chips (FT2232H)
 often support faster clock rates (and adaptive clocking).
 
 You can still debug the 'low power' situations - you just need to
@@ -7423,7 +8250,7 @@ Note that on ARM you may need to avoid using the @emph{wait for interrupt}
 operation in your idle loops even if you don't otherwise change the CPU
 clock rate.
 That operation gates the CPU clock, and thus the JTAG clock; which
-prevents JTAG access.  One consequence is not being able to @command{halt}
+prevents JTAG access. One consequence is not being able to @command{halt}
 cores which are executing that @emph{wait for interrupt} operation.
 
 To set the JTAG frequency use the command:
@@ -7545,11 +8372,11 @@ has closed the connection to OpenOCD. This might be a GDB issue.
 
 @item @b{LPC2000 Flash} In the configuration file in the section where flash device configurations
 are described, there is a parameter for specifying the clock frequency
-for LPC2000 internal flash devices (e.g.  @option{flash bank $_FLASHNAME lpc2000
+for LPC2000 internal flash devices (e.g. @option{flash bank $_FLASHNAME lpc2000
 0x0 0x40000 0 0 $_TARGETNAME lpc2000_v1 14746 calc_checksum}), which must be
 specified in kilohertz. However, I do have a quartz crystal of a
 frequency that contains fractions of kilohertz (e.g. 14,745,600 Hz,
-i.e. 14,745.600 kHz).  Is it possible to specify real numbers for the
+i.e. 14,745.600 kHz). Is it possible to specify real numbers for the
 clock frequency?
 
 No. The clock frequency specified here must be given as an integral number.
@@ -7571,11 +8398,11 @@ references a jtag newtap and a flash bank references a target).
 You can use the ``scan_chain'' command to verify and display the tap order.
 
 Also, some commands can't execute until after @command{init} has been
-processed.  Such commands include @command{nand probe} and everything
+processed. Such commands include @command{nand probe} and everything
 else that needs to write to controller registers, perhaps for setting
 up DRAM and loading it with code.
 
-@anchor{FAQ TAP Order}
+@anchor{faqtaporder}
 @item @b{JTAG TAP Order} Do I have to declare the TAPS in some
 particular order?
 
@@ -7584,7 +8411,7 @@ the same order used by the hardware.
 
 Many newer devices have multiple JTAG TAPs. For example: ST
 Microsystems STM32 chips have two TAPs, a ``boundary scan TAP'' and
-``Cortex-M3'' TAP.  Example: The STM32 reference manual, Document ID:
+``Cortex-M3'' TAP. Example: The STM32 reference manual, Document ID:
 RM0008, Section 26.5, Figure 259, page 651/681, the ``TDI'' pin is
 connected to the boundary scan TAP, which then connects to the
 Cortex-M3 TAP, which then connects to the TDO pin.
@@ -7630,7 +8457,7 @@ learning Tcl, the intent of this chapter is to give you some idea of
 how the Tcl scripts work.
 
 This chapter is written with two audiences in mind. (1) OpenOCD users
-who need to understand a bit more of how JIM-Tcl works so they can do
+who need to understand a bit more of how Jim-Tcl works so they can do
 something useful, and (2) those that want to add a new command to
 OpenOCD.
 
@@ -7713,7 +8540,7 @@ is a string}
 @*@b{@{Curly-Braces@}} are magic: $VARIABLES and [square-brackets] are
 parsed, but are NOT expanded or executed. @{Curly-Braces@} are like
 'single-quote' operators in BASH shell scripts, with the added
-feature: @{curly-braces@} can be nested, single quotes can not.  @{@{@{this is
+feature: @{curly-braces@} can be nested, single quotes can not. @{@{@{this is
 nested 3 times@}@}@} NOTE: [date] is a bad example;
 at this writing, Jim/OpenOCD does not have a date command.
 @end itemize
@@ -7768,7 +8595,7 @@ command stores these items in a table somewhere so it can be found by
 
 @subsection The FOR command
 
-The most interesting command to look at is the FOR command.  In Tcl,
+The most interesting command to look at is the FOR command. In Tcl,
 the FOR command is normally implemented in C. Remember, FOR is a
 command just like any other command.
 
@@ -7850,7 +8677,7 @@ MyForCommand( void *interp,
         // Execute the body
         Execute_AsciiString( interp, argv[3] );
 
-        // Execute the LOOP  part
+        // Execute the LOOP part
         Execute_AsciiString( interp, argv[4] );
     @}
 
@@ -7906,7 +8733,7 @@ it reads a file and executes as a script.
    proc someproc @{@} @{
        ... multiple lines of stuff ...
    @}
-   $_TARGETNAME configure -event FOO  someproc
+   $_TARGETNAME configure -event FOO someproc
 #2 Good - no variables
    $_TARGETNAME confgure -event foo "this ; that;"
 #3 Good Curly Braces
@@ -7933,7 +8760,7 @@ command.
 @end enumerate
 
 In the end, when the target event FOO occurs the TCLBODY is
-evaluated. Method @b{#1} and @b{#2} are functionally identical.  For
+evaluated. Method @b{#1} and @b{#2} are functionally identical. For
 Method @b{#3} and @b{#4} it is more interesting. What is the TCLBODY?
 
 Remember the parsing rules. In case #3, @{curly-braces@} mean the
@@ -7950,7 +8777,7 @@ simple terms: Inside a PROC, if you need to access a global variable
 you must say so. See also ``upvar''. Example:
 @example
 proc myproc @{ @} @{
-     set y 0  #Local variable Y
+     set y 0 #Local variable Y
      global x #Global variable X
      puts [format "X=%d, Y=%d" $x $y]
 @}
@@ -7959,13 +8786,13 @@ proc myproc @{ @} @{
 @b{Dynamic variable creation}
 @example
 # Dynamically create a bunch of variables.
-for @{ set x 0  @} @{ $x < 32 @} @{ set x [expr $x + 1]@} @{
+for @{ set x 0 @} @{ $x < 32 @} @{ set x [expr $x + 1]@} @{
     # Create var name
     set vn [format "BIT%d" $x]
     # Make it a global
     global $vn
     # Set it.
-    set $vn   [expr (1 << $x)]
+    set $vn [expr (1 << $x)]
 @}
 @end example
 @b{Dynamic proc/command creation}

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)