Open Ocd
Open Ocd
Short Contents
About . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1 OpenOCD Developer Resources . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2 Debug Adapter Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3 About Jim-Tcl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
4 Running . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
5 OpenOCD Project Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
6 Config File Guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
7 Server Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
8 Debug Adapter Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
9 Reset Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
10 TAP Declaration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
11 CPU Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
12 Flash Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
13 Flash Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
14 PLD/FPGA Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
15 General Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
16 Architecture and Core Commands . . . . . . . . . . . . . . . . . . . . . . 131
17 JTAG Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
18 Boundary Scan Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
19 Utility Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
20 GDB and OpenOCD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
21 Tcl Scripting API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
22 FAQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
23 Tcl Crash Course . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
A The GNU Free Documentation License. . . . . . . . . . . . . . . . . . . 183
OpenOCD Concept Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
Command and Driver Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
ii
Table of Contents
About . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
What is OpenOCD? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
OpenOCD Web Site . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Latest User’s Guide: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
OpenOCD User’s Forum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
OpenOCD User’s Mailing List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
OpenOCD IRC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
3 About Jim-Tcl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
4 Running. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4.1 Simple setup, no customization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4.2 What OpenOCD does as it starts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
7 Server Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
7.1 Configuration Stage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
7.2 Entering the Run Stage. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
7.3 TCP/IP Ports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
7.4 GDB Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
7.5 Event Polling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
9 Reset Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
9.1 Types of Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
9.2 SRST and TRST Issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
9.3 Commands for Handling Resets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
9.4 Custom Reset Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
iv
10 TAP Declaration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
10.1 Scan Chains . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
10.2 TAP Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
10.3 TAP Declaration Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
10.4 Other TAP commands. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
10.5 TAP Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
10.6 Enabling and Disabling TAPs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
10.7 Autoprobing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
10.8 DAP declaration (ARMv6-M, ARMv7 and ARMv8 targets) . . . 65
11 CPU Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
11.1 Target List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
11.2 Target CPU Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
11.3 Target Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
11.4 Other $target name Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
11.5 Target Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
12 Flash Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
12.1 Flash Configuration Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
12.2 Preparing a Target before Flash Programming . . . . . . . . . . . . . . . . 79
12.3 Erasing, Reading, Writing to Flash . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
12.4 Other Flash commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
12.5 Flash Driver List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
12.5.1 External Flash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
12.5.2 Internal Flash (Microcontrollers) . . . . . . . . . . . . . . . . . . . . . . . . . 88
12.6 NAND Flash Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
12.6.1 NAND Configuration Commands . . . . . . . . . . . . . . . . . . . . . . . 114
12.6.2 Erasing, Reading, Writing to NAND Flash . . . . . . . . . . . . . . 115
12.6.3 Other NAND commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
12.6.4 NAND Driver List. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
22 FAQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
About
OpenOCD was created by Dominic Rath as part of a 2005 diploma thesis written at the
University of Applied Sciences Augsburg (http://www.hs-augsburg.de). Since that time,
the project has grown into an active open-source project, supported by a diverse community
of software and hardware developers from around the world.
What is OpenOCD?
The Open On-Chip Debugger (OpenOCD) aims to provide debugging, in-system program-
ming and boundary-scan testing for embedded target devices.
It does so with the assistance of a debug adapter, which is a small hardware module which
helps provide the right kind of 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 transport protocols, each of which involves dif-
ferent electrical signaling (and uses 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.)
These adapters are sometimes packaged as discrete dongles, which may generically be called
hardware interface dongles. Some development boards also integrate them directly, which
may let the development board connect directly to the debug host over USB (and sometimes
also to power it over USB).
For example, a JTAG Adapter supports JTAG signaling, and is used to communicate with
JTAG (IEEE 1149.1) compliant TAPs on your target board. A 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 scan operations.
There are also SWD Adapters that support Serial Wire Debug (SWD) signaling to commu-
nicate with some newer ARM cores, as well as debug adapters which support both JTAG
and SWD transports. SWD supports only debugging, whereas JTAG also supports bound-
ary scan operations.
For some chips, there are also Programming Adapters supporting special transports used
only to write code to flash memory, without support for on-chip debugging or boundary
scan. (At this writing, OpenOCD does not support such non-debug adapters.)
Dongles: OpenOCD currently supports many types of hardware dongles: USB-based, par-
allel port-based, and other standalone boxes that run OpenOCD internally. See Chapter 2
[Debug Adapter Hardware], page 5.
GDB Debug: It allows ARM7 (ARM7TDMI and ARM720t), ARM9 (ARM920T,
ARM922T, ARM926EJ–S, ARM966E–S), XScale (PXA25x, IXP42x), Cortex-M3 (Stellaris
LM3, STMicroelectronics STM32 and Energy Micro EFM32) and Intel Quark (x10xx)
based cores to be debugged via the GDB protocol.
Flash Programming: Flash writing is supported for external CFI-compatible NOR flashes
(Intel and AMD/Spansion command set) and several 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) is included.
About 2
OpenOCD IRC
Support can also be found on irc: irc://irc.libera.chat/openocd
3
test, discuss and vote for changes in Gerrit. The feedback provides the basis for a maintainer
to eventually submit the change to the main Git repository.
The HACKING file, also available as the Patch Guide in the Doxygen Developer Manual,
contains basic information about how to connect a repository to Gerrit, prepare and push
patches. Patch authors are expected to maintain their changes while they’re in Gerrit,
respond to feedback and if necessary rework and push improved versions of the change.
• signalyzer
See: http://www.signalyzer.com
• Stellaris Eval Boards
See: 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. These boards can also be used in a "pass through" mode as JTAG
adapters to other target boards, disabling the Stellaris chip.
• TI/Luminary ICDI
See: 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 Stellaris eval boards, they can be used to debug other target
boards.
• olimex-jtag
See: http://www.olimex.com
• Flyswatter/Flyswatter2
See: http://www.tincantools.com
• turtelizer2
See: Turtelizer 2 (http://www.ethernut.de/en/hardware/turtelizer/index.
html), or http://www.ethernut.de
• comstick
Link: http://www.hitex.com/index.php?id=383
• stm32stick
Link http://www.hitex.com/stm32-stick
• axm0432 jtag
Axiom AXM-0432 Link http://www.axman.com - NOTE: This JTAG does not appear
to be available anymore as of April 2012.
• cortino
Link http://www.hitex.com/index.php?id=cortino
• dlp-usb1232h
Link http://www.dlpdesign.com/usb/usb1232h.shtml
• digilent-hs1
Link http://www.digilentinc.com/Products/Detail.cfm?Prod=JTAG-HS1
• opendous
Link http://code.google.com/p/opendous/wiki/JTAG FT2232H-based (OpenHard-
ware).
• JTAG-lock-pick Tiny 2
Link http://www.distortec.com/jtag-lock-pick-tiny-2 FT232H-based
• GW16042
Link: http://shop.gateworks.com/index.php?route=product/product&
path=70_80&product_id=64 FT2232H-based
For info the original ST-LINK enumerates using the mass storage usb class; however, its
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:
• modprobe -r usb-storage && modprobe usb-storage quirks=483:3744:i
• add "options usb-storage quirks=483:3744:i" to /etc/modprobe.conf
Link: https://software-dl.ti.com/ccs/esd/documents/xdsdebugprobes/
emu_xds_software_package_download.html#xds110-support-utilities
2.12 Other...
• ep93xx
An EP93xx based Linux machine using the GPIO pins directly.
• at91rm9200
Like the EP93xx - but an ATMEL AT91RM9200 based solution using the GPIO pins
on the chip.
Chapter 2: Debug Adapter Hardware 10
• bcm2835gpio
A BCM2835-based board (e.g. Raspberry Pi) using the GPIO pins of the expansion
header.
• imx gpio
A NXP i.MX-based board (e.g. Wandboard) using the GPIO pins (should work on any
i.MX processor).
• jtag vpi
A JTAG driver acting as a client for the JTAG VPI server interface.
Link: http://github.com/fjullien/jtag_vpi
• jtag dpi
A JTAG driver acting as a client for the SystemVerilog Direct Programming Interface
(DPI) for JTAG devices. DPI allows OpenOCD to connect to the JTAG interface of
a hardware model written in SystemVerilog, for example, on an emulation model of
target hardware.
• xlnx pcie xvc
A JTAG driver exposing Xilinx Virtual Cable over PCI Express to OpenOCD as
JTAG/SWD interface.
• linuxgpiod
A bitbang JTAG driver using Linux GPIO through library libgpiod.
• sysfsgpio
A bitbang JTAG driver using Linux legacy sysfs GPIO. This is deprecated from Linux
v5.3; prefer using linuxgpiod.
11
3 About 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. You can use them as
simple commands, without needing to learn much of anything about Tcl. Alternatively,
you can write Tcl programs with them.
You can learn more about Jim at its website, http://jim.tcl.tk. 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.
• Jim vs. Tcl
Jim-Tcl is a stripped down version of the well known Tcl language, which can be found
here: 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.
• Missing Features
Our practice has been: Add/clone the real Tcl feature if/when 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.
• Scripts
OpenOCD configuration scripts are Jim-Tcl Scripts. OpenOCD’s command interpreter
today is a mixture of (newer) Jim-Tcl commands, and the (older) original command
interpreter.
• Commands
At the OpenOCD telnet command line (or via the GDB monitor command) one can
type a Tcl for() loop, set variables, etc. Some of the commands documented in this
guide are implemented as Tcl scripts, from a startup.tcl file internal to the server.
• Historical Note
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.
• Need a crash course in Tcl?
See Chapter 23 [Tcl Crash Course], page 176.
12
4 Running
Properly installing OpenOCD sets up your operating system to grant it access to the de-
bug adapters. On Linux, this usually involves installing a file in /etc/udev/rules.d, so
OpenOCD has permissions. An example rules file that works for many common adapters
is shipped with OpenOCD in the contrib directory. MS-Windows needs complex and con-
fusing 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 tell it how each
debug session should work. The --help option shows:
bash$ openocd --help
The first found file with a matching file name will be used.
Note: Don’t try to use configuration script names or paths which include the
"#" character. That character begins Tcl comments.
Chapter 4: Running 13
6. Power up the target board. Unless you just let the magic smoke escape, you’re now
ready to set up the OpenOCD server so you can use JTAG to work with that board.
Talk with the OpenOCD server using telnet (telnet localhost 4444 on many systems) or
GDB. See Chapter 20 [GDB and OpenOCD], page 163.
When you write config files, separate the reusable parts (things every user of that interface,
chip, or board needs) from ones specific to your environment and debugging approach.
• For example, a gdb-attach event handler that invokes the reset init command will
interfere with debugging early boot code, which performs some of the same actions
that the reset-init event handler does.
• Likewise, the arm9 vector_catch command (or its siblings xscale vector_catch and
cortex_m vector_catch) can be a time-saver 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. (See [Software Debug Messages and
Tracing], page 155.)
• You might need to override some defaults. For example, you might need to move,
shrink, or back up the target’s work area if your application needs much SRAM.
• TCP/IP port configuration is another example of something which is environment-
specific, and should only appear in a user config file. See [TCP/IP Ports], page 33.
# Start running.
resume 0x20000000
}
Then once that code is working you will need to make it boot from NOR flash; a different
utility would help. Alternatively, some developers write to flash using GDB. (You might
use a similar script if you’re working with a flash based microcontroller application instead
of a boot loader.)
proc newboot { } {
# 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
Chapter 5: OpenOCD Project Setup 18
debugger provide your system console and a file system, helping with early debugging
or providing a more capable environment for sometimes-complex tasks like installing
system firmware onto NAND or SPI flash.
• ARM Wait-For-Interrupt... Many ARM chips synchronize the JTAG clock using the
core clock. Low power states which stop that core clock thus prevent JTAG access. Idle
loops in tasking environments often enter those low power states via the WFI instruction
(or its coprocessor equivalent, before ARMv7).
You may want to disable that instruction in source code, or otherwise prevent using that
state, to ensure you can get JTAG access at any time.3 For example, the OpenOCD
halt command may not work for an idle processor otherwise.
• Delay after reset... Not all chips have good support for debugger access right after
reset; many LPC2xxx chips have issues here. Similarly, applications that reconfigure
pins used for JTAG access as they start will also block debugger access.
To work with boards like this, enable a short delay loop the first thing after reset, before
"real" startup activities. For example, one second’s delay is usually more than enough
time for a JTAG debugger to attach, so that early code execution can be debugged or
firmware can be replaced.
• Debug Communications Channel (DCC)... Some processors include mechanisms to
send messages over JTAG. Many ARM cores support these, as do some cores from
other vendors. (OpenOCD may be able to use this DCC internally, speeding up some
operations like writing to memory.)
Your application may want to deliver various debugging messages over JTAG, by linking
with a small library of code provided with OpenOCD and using the utilities there to
send various kinds of message. See [Software Debug Messages and Tracing], page 155.
3
As a more polite alternative, some processors have special debug-oriented registers which can be used to
change various features including how the low power states are clocked while debugging. The STM32
DBGMCU CR register is an example; at the cost of extra power consumption, JTAG can be used during
low power states.
Chapter 5: OpenOCD Project Setup 20
Such explicit configuration is common, and not limited 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.
• Memory Addressing ... Boards which support multiple boot modes may also have
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 board must also be told to start booting from on-chip ROM.
Your board.cfg file may also need to be told this jumper configuration, so that it can
know whether to declare NOR flash using flash bank or instead declare NAND flash
with nand device; and likewise which probe to perform in its reset-init handler.
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.
• Peripheral Access ... Development boards generally provide access to every periph-
eral on the chip, sometimes in multiple modes (such as by providing 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 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.
Plus you should of course have 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 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 bootloader which handles a
few issues, it rarely provides full access to all board-specific capabilities.
21
Target config files may also export utility functions to board and user config files. Such
functions should use name prefixes, to help avoid naming collisions.
Board files could also accept input variables from user config files. For example, there might
be a J4_JUMPER setting used to identify what kind of flash memory a development board is
using, or how to set up other clocks and peripherals.
watchdog. Structure the code cleanly, and provide comments to help the next developer
doing such work. (You might be that next person trying to reuse init code!)
The last thing normally done in a reset-init handler is probing 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.
proc enable_fast_clock {} {
# enables fast on-board clock source
# configures the chip to use it
}
There are more complex examples too, with chips that have multiple TAPs. Ones worth
looking at include:
• target/omap3530.cfg – with disabled ARM and DSP, plus a JRC to enable them
• target/str912.cfg – with flash, CPU, and boundary scan
• target/ti_dm355.cfg – with ETM, ARM, and JRC (this JRC is not currently used)
• 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.
• cortex a smp : display current SMP mode.
• cortex a smp gdb : display/fix the core id displayed in GDB session see following
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
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. See [JTAG Speed], page 54.
Important: When you are debugging code that runs right after chip reset,
getting these issues right is critical. In particular, if you see intermittent failures
when OpenOCD verifies the scan chain after reset, look at how you are setting
up JTAG clocking.
proc init_targets {} {
# initializes generic chip with 4kB of flash and 1kB of RAM
setup_my_chip MY_GENERIC_CHIP 4096 1024
}
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
}
The easiest way to convert “linear” config files to init_targets version is to enclose every
line of “code” (i.e. not source commands, procedures, etc.) in this procedure.
For an example of this scheme see LPC2000 target config files.
The init_boards procedure is a similar concept concerning board config files (See [The
init board procedure], page 24.)
page 24.) It is used to set up default target events for the targets that do not have those
events already assigned.
7 Server Configuration
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.
The default implementation first tries jtag arp_init, which uses only a lightweight
JTAG reset before examining the scan chain. If that fails, it tries again, using a
harder reset from the overridable procedure init_reset.
Implementations must have verified the JTAG scan chain before they return. This is
done by calling jtag arp_init (or jtag arp_init-reset).
armjtagew_info [Command]
Logs some status
− Tristate with one FTDI output as (non-)inverted data line and another FTDI
output as (non-)inverted output-enable
− Unbuffered, using the FTDI GPIO as a tristate output directly by switching data
and direction as necessary
These interfaces have several commands, used to configure the driver before initializ-
ing the JTAG scan chain:
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.
If -alias or -nalias is used, the signal is created identical (or with data
inverted) to an already specified signal name.
For example adapter definitions, see the configuration files shipped in the
interface/ftdi directory.
FT232R
− bit 7 - RI
− bit 6 - DCD
− bit 5 - DSR
− bit 4 - DTR
− bit 3 - CTS
− bit 2 - RTS
− bit 1 - RXD
− bit 0 - TXD
These interfaces have several commands, used to configure the driver before initializ-
ing the JTAG scan chain:
For example, to connect remotely via TCP to the host foobar you might have some-
thing like:
adapter driver remote_bitbang
remote_bitbang port 3335
remote_bitbang host foobar
To connect to another process running locally via UNIX sockets with socket named
mysocket:
adapter driver remote_bitbang
remote_bitbang port 0
remote_bitbang host mysocket
be used with this driver, and must either be used with the cmsis-dap driver or switched
back to KitProg mode. See the Cypress KitProg User Guide for instructions on how
to switch KitProg modes.
Known limitations:
• The frequency of SWCLK cannot be configured, and varies between 1.6 MHz and
2.7 MHz.
• For firmware versions below 2.14, "JTAG to SWD" sequences are replaced by
"SWD line reset" in the driver. This is for two reasons. First, the KitProg does
not support sending arbitrary SWD sequences, and only firmware 2.14 and later
implement both "JTAG to SWD" and "SWD line reset" in firmware. Earlier
firmware versions only implement "SWD line reset". Second, due to a firmware
quirk, an SWD sequence must be sent after every target reset in order to re-
establish communications with the target.
• Due in part to the limitation above, KitProg devices with firmware below version
2.14 will need to use kitprog_init_acquire_psoc in order to communicate with
PSoC 5LP devices. This is because, assuming debug is not disabled on the
PSoC, the PSoC 5LP needs its JTAG interface switched to SWD mode before
communication can begin, but prior to firmware 2.14, "JTAG to SWD" could
only be sent with an acquisition sequence.
kitprog_init_acquire_psoc [Config Command]
Indicate that a PSoC acquisition sequence needs to be run during adapter init.
Please be aware that the acquisition sequence hard-resets the target.
kitprog acquire_psoc [Command]
Run a PSoC acquisition sequence immediately. Typically, this should not be
used outside of the target-specific configuration scripts since it hard-resets the
target as a side-effect. This is necessary for "reset halt" on some PSoC 4 series
devices.
kitprog info [Command]
Display various adapter information, such as the hardware version, firmware
version, and target voltage.
parport [Interface Driver]
Supports PC parallel port bit-banging cables: Wigglers, PLD download cable, and
more. These interfaces have several commands, used to configure the driver before
initializing the JTAG scan chain:
parport cable name [Config Command]
Set the layout of the parallel port cable used to connect to the target. This is
a write-once setting. Currently valid cable name values include:
− altium Altium Universal JTAG cable.
− arm-jtag Same as original wiggler except SRST and TRST connections
reversed and TRST is also inverted.
− chameleon The Amontec Chameleon’s CPLD when operated in configu-
ration mode. This is only used to program the Chameleon itself, not a
connected target.
Chapter 8: Debug Adapter Configuration 46
the toggling time up or down until the measured clock rate is a good
match with the rate you specified in the adapter speed command;
be conservative.
For example, the interface configuration file for a classic “Wiggler” cable on LPT2
might look something like this:
adapter driver parport
parport port 0x278
parport cable wiggler
The newer SWD devices (SW-DP v2 or SWJ-DP v2) support the multi-drop extension of
SWD protocol: two or more devices can be connected to one SWD adapter. SWD transport
works in multi-drop mode if [dap create], page 66, is configured with both -dp-id and
-instance-id parameters regardless how many DAPs are created.
Not all adapters and adapter drivers support SWD multi-drop. Only the following adapter
drivers are SWD multi-drop capable: cmsis dap (use an adapter with CMSIS-DAP version
2.0), ftdi, all bitbang based.
must precede the target definition command target create target_name stm8 -chain-
position basename.tap_type.
9 Reset Configuration
Every system configuration may require a different reset configuration. This can also be
quite confusing. Resets also interact with reset-init event handlers, which do things like
setting up clocks and DRAM, and JTAG clock rates. (See [JTAG Speed], page 54.) They
can also interact with JTAG routers. Please see the various board files for examples.
Note: To maintainers and integrators: Reset configuration touches several
things at once. Normally the board configuration file should define it and as-
sume that the JTAG adapter supports everything that’s wired up to the board’s
JTAG connector.
However, the target configuration file could also make note of something the sil-
icon vendor has done inside the chip, which will be true for most (or all) boards
using that chip. And when the JTAG adapter doesn’t support everything,
the user configuration file will need to override parts of the reset configuration
provided by other files.
reset_config 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 be triggered using with TMS signaling.
• Signals shorted ... Sometimes a chip, board, or adapter will connect SRST to TRST,
instead of keeping them separate. Use the reset_config combination options to say
when those signals aren’t properly independent.
• 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 requirements
that all reset pulses last for at least a certain amount of time; and reset buttons
commonly have hardware debouncing. Use the adapter srst delay and jtag_ntrst_
delay commands to say when extra delays are needed.
• 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 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 reset_config
trst type and srst type parameters to say how to drive reset signals.
• Special initialization ... Targets sometimes need special JTAG initialization sequences
to handle chip-specific issues (not limited to errata). For example, certain JTAG com-
mands might need to be issued while the system as a whole is in a reset state (SRST
active) but the JTAG scan chain is usable (TRST inactive). Many systems treat com-
bined assertion of SRST and TRST as a trigger for a harder reset than SRST alone.
Such custom reset handling is discussed later in this chapter.
There can also be other issues. Some devices don’t fully conform to the JTAG specifications.
Trivial system-specific differences are common, such as SRST and TRST using slightly
different names. There are also vendors who distribute key JTAG documentation for their
chips only to developers who have signed a Non-Disclosure Agreement (NDA).
Sometimes there are chip-specific extensions like a requirement to use the normally-optional
TRST signal (precluding use of JTAG adapters which don’t pass TRST through), or needing
extra steps to complete a TAP reset.
In short, SRST and especially TRST handling may be very finicky, needing to cope with
both architecture and board specific constraints.
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.
The optional trst type and srst type parameters allow the 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 relevant signal (TRST or SRST) is not connected.
• Possible trst type driver modes for the test reset signal (TRST) are the default
trst_push_pull, and trst_open_drain. Most boards connect this signal to a
pulldown, so the JTAG TAPs never leave reset unless they are hooked up to a
JTAG adapter.
• Possible srst type driver modes for the system reset signal (SRST) are the default
srst_open_drain, and srst_push_pull. Most boards connect this signal to a
pullup, and allow the signal to be pulled low by various events including system
power-up and pressing a reset button.
10 TAP Declaration
Test Access Ports (TAPs) are the core of JTAG. TAPs serve many roles, including:
• Debug Target A CPU TAP can be used as a GDB debug target.
• Flash Programming Some chips program the flash directly via JTAG. Others do it
indirectly, making a CPU do it.
• Program Download Using the same CPU support GDB uses, you can initialize a DRAM
controller, download code to DRAM, and then start running that code.
• Boundary Scan Most chips support boundary scan, which helps test for board assembly
problems like solder bridges and missing connections.
OpenOCD must know about the active TAPs on your board(s). Setting up the TAPs is
the core task of your configuration files. Once those TAPs are set up, you can pass their
names to code which sets up CPUs and exports them as GDB targets, probes flash memory,
performs low-level JTAG operations, and more.
For example, the STMicroelectronics STR912 chip has three separate TAPs1 . To configure
those taps, target/str912.cfg includes commands something like this:
jtag newtap str912 flash ... params ...
jtag newtap str912 cpu ... params ...
jtag newtap str912 bs ... params ...
Actual config files typically use a variable such as $_CHIPNAME instead of literals like str912,
to support more than one chip of each type. See Chapter 6 [Config File Guidelines], page 21.
scan_chain [Command]
Displays the TAPs in the scan chain configuration, and their status. The set of TAPs
listed by this command is fixed by exiting the OpenOCD configuration stage, but
systems with a JTAG router can enable or disable TAPs dynamically.
• -ignore-syspwrupack
Specify this to ignore the CSYSPWRUPACK bit in the ARM DAP DP
CTRL/STAT register during initial examination and when checking the sticky
error bit. This bit is normally checked after setting the CSYSPWRUPREQ bit,
but some devices do not set the ack bit until sometime later.
10.7 Autoprobing
TAP configuration is the first thing that needs to be done after interface and reset con-
figuration. Sometimes it’s hard finding out what TAPs exist, or how they are identified.
Vendor documentation is not always easy to find and use.
To help you get past such problems, OpenOCD has a limited autoprobing ability to look at
the scan chain, doing a blind interrogation and then reporting the TAPs it finds. To use this
mechanism, start the OpenOCD server with only data that configures your JTAG interface,
and arranges to come up with a slow clock (many devices don’t support fast JTAG clocks
right when they come out of reset).
For example, your openocd.cfg file might have:
source [find interface/olimex-arm-usb-tiny-h.cfg]
reset_config trst_and_srst
jtag_rclk 8
When you start the server without any TAPs configured, it will attempt to autoconfigure
the TAPs. There are two parts to this:
1. TAP discovery ... After a JTAG reset (sometimes a system reset may be needed too),
each TAP’s data registers will hold the contents of either the IDCODE or BYPASS
register. If JTAG communication is working, OpenOCD will see each TAP, and report
what -expected-id to use with it.
2. IR Length discovery ... Unfortunately JTAG does not provide a reliable way to find out
the value of the -irlen parameter to use with a TAP that is discovered. If OpenOCD
can discover the length of a TAP’s instruction register, it will report it. Otherwise you
may need to consult vendor documentation, such as chip data sheets or BSDL files.
In many cases your board will have a simple scan chain with just a single device. Here’s
what OpenOCD reported with one board that’s a bit more complex:
clock speed 8 kHz
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 ..."
AUTO auto0.tap - use "... -irlen 4"
AUTO auto1.tap - use "... -irlen 4"
AUTO auto2.tap - use "... -irlen 6"
no gdb ports allocated as no target has been specified
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 target.cfg file with these TAPs, any targets associated with them, and any on-chip
resources; then a board.cfg with off-chip resources, clocking, and so forth.
For all ARMv6-M, ARMv7 and ARMv8 targets, the option "-dap dap name" has to be
used instead of "-chain-position dotted.name" when the target is created.
The dap command group supports the following sub-commands:
dap create dap name -chain-position dotted.name [Command]
configparams...
Declare a DAP instance named dap name linked to the JTAG tap dotted.name. This
also creates a new command (dap_name) which is used for various purposes including
additional configuration. There can only be one DAP for each JTAG tap in the
system.
A DAP may also provide optional configparams:
• -ignore-syspwrupack
Specify this to ignore the CSYSPWRUPACK bit in the ARM DAP DP
CTRL/STAT register during initial examination and when checking the sticky
error bit. This bit is normally checked after setting the CSYSPWRUPREQ bit,
but some devices do not set the ack bit until sometime later.
• -dp-id number
Debug port identification number for SWD DPv2 multidrop. The number is
written to bits 0..27 of DP TARGETSEL during DP selection. To find the id
number of a single connected device read DP TARGETID: device.dap dpreg
0x24 Use bits 0..27 of TARGETID.
• -instance-id number
Instance identification number for SWD DPv2 multidrop. The number is written
to bits 28..31 of DP TARGETSEL during DP selection. To find the instance
number of a single connected device read DP DLPIDR: device.dap dpreg 0x34
The instance number is in bits 28..31 of DLPIDR value.
dap names [Command]
This command returns a list of all registered DAP objects. It it useful mainly for
TCL scripting.
dap info [num] [Command]
Displays the ROM table for MEM-AP num, defaulting to the currently selected AP
of the currently selected target.
dap init [Command]
Initialize all registered DAPs. This command is used internally during initialization.
It can be issued at any time after the initialization, too.
The following commands exist as subcommands of DAP instances:
$dap_name info [num] [Command]
Displays the ROM table for MEM-AP num, defaulting to the currently selected AP.
$dap_name apid [num] [Command]
Displays ID register from AP num, defaulting to the currently selected AP.
$dap_name apreg ap num reg [value] [Command]
Displays content of a register reg from AP ap num or set a new value value. reg is
byte address of a word register, 0, 4, 8 ... 0xfc.
Chapter 10: TAP Declaration 67
11 CPU Configuration
This chapter discusses how to set up GDB debug targets for CPUs. You can also access
these targets without GDB (see Chapter 16 [Architecture and Core Commands], page 131,
and [Target State handling], page 124) and through various kinds of NAND and NOR flash
commands. If you have multiple CPUs you can have multiple such targets.
We’ll start by looking at how to examine the targets you have, then look at how to add one
more target and how to configure it.
support for new CPUs. It’s possible to connect a GDB client to this target (the
GDB port has to be specified, See [option -gdb-port], page 72.), and a fake ARM
core will be emulated to comply to GDB remote protocol.
• mips_m4k – a MIPS core.
• mips_mips64 – a MIPS64 core.
• nds32_v2 – this is an Andes NDS32 v2 core.
• nds32_v3 – this is an Andes NDS32 v3 core.
• nds32_v3m – this is an Andes NDS32 v3m core.
• or1k – this is an OpenRISC 1000 core. The current implementation supports
three JTAG TAP cores:
− OpenCores TAP (See: http://opencores.org/project,jtag)
− Altera Virtual JTAG TAP (See: http://www.altera.com/literature/
ug/ug_virtualjtag.pdf)
− Xilinx BSCAN_* virtual JTAG interface (See: http://www.xilinx.com/
support/documentation/sw_manuals/xilinx14_2/spartan6_hdl.pdf)
And two debug interfaces cores:
− Advanced debug interface
(See: http://opencores.org/project,adv_debug_sys)
− SoC Debug Interface
(See: http://opencores.org/project,dbg_interface)
• quark_d20xx – an Intel Quark D20xx core.
• quark_x10xx – an Intel Quark X10xx core.
• riscv – a RISC-V core.
• stm8 – implements an STM8 core.
• testee – a dummy target for cases without a real CPU, e.g. CPLD.
• xscale – this is actually an architecture, not a CPU type. It is based on the
ARMv5 architecture.
To avoid being confused by the variety of ARM based cores, remember this key point:
ARM is a technology licencing company. (See: http://www.arm.com.) The CPU name
used by OpenOCD will reflect the CPU design that was licensed, not a vendor brand which
incorporates that design. Name prefixes like arm7, arm9, arm11, and cortex reflect design
generations; while names like ARMv4, ARMv5, ARMv6, ARMv7 and ARMv8 reflect an
architecture version implemented by a CPU design.
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
(see [Target Events], page 74), which tend to be much more board-specific. The key steps
you use might look something like this
dap create mychip.dap -chain-position mychip.cpu
target create MyTarget cortex_m -dap mychip.dap
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 }
You should specify a working area if you can; typically it uses some on-chip SRAM. Such
a working area can speed up many things, including bulk writes to target memory; flash
operations like checking to see if memory needs to be erased; GDB memory checksumming;
and more.
Warning: On more complex chips, the work area can become inaccessible when
application code (such as an operating system) enables or disables the MMU.
For example, the particular MMU context used to access the virtual address
will probably matter ... and that context might not have easy access to other
addresses needed. At this writing, OpenOCD doesn’t have much MMU intelli-
gence.
It’s often very useful to define a reset-init event handler. For systems that are normally
used with a boot loader, common tasks include updating clocks and initializing memory
controllers. That may be needed to let you write the boot loader into flash, in order to
“de-brick” your board; or to load programs into external DDR memory without having run
the boot loader.
target create target name type configparams... [Config Command]
This command creates a GDB debug target that refers to a specific JTAG tap. It
enters that target into a list, and creates a new command (target_name) which is
used for various purposes including additional configuration.
• target name ... is the name of the debug target. By convention this should be
the same as the dotted.name of the TAP associated with this target, which must
be specified here using the -chain-position dotted.name configparam.
This name is also used to create the target object command, referred to here as
$target_name, and in other places the target needs to be identified.
• type ... specifies the target type. See [target types], page 69.
• configparams ... all parameters accepted by $target_name configure are per-
mitted. If the target is big-endian, set it here with -endian big.
You must set the -chain-position dotted.name or -dap dap_name here.
$target_name configure configparams... [Command]
The options accepted by this command may also be specified as parameters to target
create. Their values can later be queried one at a time by using the $target_name
cget command.
Warning: changing some of these after setup is dangerous. For example, moving a
target from one TAP to another; and changing its endianness.
• -chain-position dotted.name – names the TAP used to access this target.
Chapter 11: CPU Configuration 72
• -dap dap name – names the DAP used to access this target. See [DAP declara-
tion], page 65, on how to create and manage DAP instances.
• -endian (big|little) – specifies whether the CPU uses big or little endian
conventions
• -event event name event body – See [Target Events], page 74. 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 same
event name assigns only one handler.
Current target is temporarily overridden to the event issuing target before handler
code starts and switched back after handler is done.
• -work-area-backup (0|1) – says whether the work area gets backed up; by
default, it is not backed up. When possible, use a working area that doesn’t need
to be backed up, since performing a backup slows down operations. For example,
the beginning of an SRAM block is likely to be used by most build systems, but
the end is often unused.
• -work-area-size size – specify work are size, in bytes. The same size applies
regardless of whether its physical or virtual address is being used.
• -work-area-phys address – set the work area base address to be used when no
MMU is active.
• -work-area-virt address – set the work area base address to be used when an
MMU is active. Do not specify a value for this except on targets with an MMU.
The value should normally correspond to a static mapping for the -work-area-
phys address, set up by the current operating system.
• -rtos rtos type – enable rtos support for target, rtos type can be one of auto,
eCos, ThreadX, FreeRTOS, linux, ChibiOS, embKernel, mqx, uCOS-III, nuttx,
RIOT, Zephyr See [RTOS Support], page 166.
• -defer-examine – skip target examination at initial JTAG chain scan and after a
reset. A manual call to arp examine is required to access the target for debugging.
• -ap-num ap number – set DAP access port for target, ap number is the numeric
index of the DAP AP the target is connected to. Use this option with systems
where multiple, independent cores are connected to separate access ports of the
same DAP.
• -cti cti name – set Cross-Trigger Interface (CTI) connected to the target. Cur-
rently, only the aarch64 target makes use of this option, where it is a mandatory
configuration for the target run control. See [ARM Cross-Trigger Interface],
page 134, for instruction on how to declare and control a CTI instance.
• -gdb-port number – see command gdb_port for the possible values of the pa-
rameter number, which are not only numeric values. Use this option to override,
for this target only, the global parameter set with command gdb_port. See
[command gdb port], page 33.
• -gdb-max-connections number – EXPERIMENTAL: set the maximum number
of GDB connections that are allowed for the target. Default is 1. A negative value
for number means unlimited connections. See See [Using GDB as a non-intrusive
memory inspector], page 165.
Chapter 11: CPU Configuration 73
• -event event name – returns the handler for the event named event name. This
is a special case because setting a handler requires two parameters.
• -type – returns the target type. This is a special case because this is set using
target create and can’t be changed using $target_name configure.
For example, if you wanted to summarize information about all the targets you might
use something like this:
foreach name [target names] {
set y [$name cget -endian]
set z [$name cget -type]
puts [format "Chip %d is %s, Endian: %s, type: %s" \
$x $name $y $z]
}
is necessary during GDB connect if you want to use see [programming using GDB],
page 165. Another use of the flash memory map is for GDB to automatically choose
hardware or software breakpoints depending on whether the breakpoint is in RAM or
read only memory. Default is halt
• gdb-detach
When GDB disconnects
• gdb-end
When the target has halted and GDB is not doing anything (see early halt)
• gdb-flash-erase-start
Before the GDB flash process tries to erase the flash (default is reset init)
• gdb-flash-erase-end
After the GDB flash process has finished erasing the flash
• gdb-flash-write-start
Before GDB writes to the flash
• gdb-flash-write-end
After GDB writes to the flash (default is reset halt)
• gdb-start
Before the target steps, GDB is trying to start/resume the target
• halted
The target has halted
• reset-assert-pre
Issued as part of reset processing after reset-start was triggered but before either
SRST alone is asserted on the scan chain, or reset-assert is triggered.
• reset-assert
Issued as part of reset processing after reset-assert-pre was triggered. When such a
handler is present, cores which support this event will use it instead of asserting SRST.
This support is essential for debugging with JTAG interfaces which don’t include an
SRST line (JTAG doesn’t require SRST), and for selective reset on scan chains that
have multiple targets.
• reset-assert-post
Issued as part of reset processing after reset-assert has been triggered. or the target
asserted SRST on the entire scan chain.
• reset-deassert-pre
Issued as part of reset processing after reset-assert-post has been triggered.
• reset-deassert-post
Issued as part of reset processing after reset-deassert-pre has been triggered and
(if the target is using it) after SRST has been released on the scan chain.
• reset-end
Issued as the final step in reset processing.
• reset-init
Used by reset init command for board-specific initialization. This event fires after
reset-deassert-post.
This is where you would configure PLLs and clocking, set up DRAM so you can down-
load programs that don’t fit in on-chip SRAM, set up pin multiplexing, and so on.
Chapter 11: CPU Configuration 77
(You may be able to switch to a fast JTAG clock rate here, after the target clocks are
fully set up.)
• reset-start
Issued as the first step in reset processing before reset-assert-pre is called.
This is the most robust place to use jtag_rclk or adapter speed to switch to a low
JTAG clock rate, when reset disables PLLs needed to use a fast clock.
• resume-start
Before any target is resumed
• resume-end
After all targets have resumed
• resumed
Target has resumed
• step-start
Before a target is single-stepped
• step-end
After single-step has completed
• trace-config
After target hardware trace configuration was changed
Note: OpenOCD events are not supposed to be preempt by another event, but
this is not enforced in current code. Only the target event resumed is executed
with polling disabled; this avoids polling to trigger the event halted, reversing
the logical order of execution of their handlers. Future versions of OpenOCD
will prevent the event preemption and will disable the schedule of polling during
the event execution. Do not rely on polling in any event handler; this means,
don’t expect the status of a core to change during the execution of the handler.
The event handler will have to enable polling or use $target_name arp_poll
to check if the core has changed status.
78
12 Flash Commands
OpenOCD has different commands for NOR and NAND flash; the “flash” command works
with NOR flash, while 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.) However, the documentation
also uses “flash” as a generic term; for example, “Put flash configuration in board-specific
files”.
Flash Steps:
1. Configure via the command flash bank
Do this in a board-specific configuration file, passing parameters as needed by the
driver.
2. Operate on the flash via 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 boot loader, operating system,
or other data.
3. GDB Flashing
Flashing via GDB requires the flash be configured via “flash bank”, and the GDB flash
features be enabled. See [GDB Configuration], page 33.
Many CPUs have the ability to “boot” from the first flash bank. This means that mis-
programming that bank can “brick” a system, 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.
• target ... Names the target used to issue commands to the flash controller.
• driver options ... drivers may support, or require, additional parameters. See
the driver-specific documentation for more information.
Note: This command is not available after OpenOCD initialization has
completed. Use it in board specific configuration files, not interactively.
flash banks [Command]
Prints a one-line summary of each device that was declared using flash bank, num-
bered from zero. Note that this is the plural form; the singular form is a very different
command.
flash list [Command]
Retrieves a list of associative arrays for each device that was declared using flash
bank, numbered from zero. This returned list can be manipulated easily from within
scripts.
flash probe num [Command]
Identify the flash, or validate the parameters of the configured flash. Operation
depends on the flash type. The num parameter is a value shown by flash banks.
Most flash commands will implicitly autoprobe the bank; flash drivers can distinguish
between probing and autoprobing, but most don’t bother.
Some flash chips implement software protection against accidental writes, since such buggy
writes could in some cases “brick” a system. 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. See [flash protect], page 82.
flash erase_sector num first last [Command]
Erase sectors in bank num, starting at sector first up to and including last. Sector
numbering starts at 0. Providing a last sector of last specifies "to the end of the
flash bank". The num parameter is a value shown by flash banks.
flash erase_address [pad] [unlock] address length [Command]
Erase sectors starting at address for length bytes. Unless pad is specified, address
must begin a flash sector, and address + length − 1 must end a sector. Specifying
pad erases extra data at the beginning and/or end of the specified region, as needed
to erase only full sectors. The flash bank to use is inferred from the address, and the
specified length must stay within that bank. As a special case, when length is zero
and address is the start of the bank, the whole flash is erased. If unlock is specified,
then the flash is unprotected before erase starts.
flash filld address double-word length [Command]
flash fillw address word length [Command]
flash fillh address halfword length [Command]
flash fillb address byte length [Command]
Fills flash memory with the specified double-word (64 bits), word (32 bits), halfword
(16 bits), or byte (8-bit) pattern, starting at address and continuing for length units
(word/halfword/byte). No erasure is done before writing; when needed, that must be
done before issuing this command. Writes are done in blocks of up to 1024 bytes, and
each write is verified by reading back the data and comparing it to what was written.
The flash bank to use is inferred from the address of each block, and the specified
length must stay within that bank.
flash mdw addr [count] [Command]
flash mdh addr [count] [Command]
flash mdb addr [count] [Command]
Display contents of address addr, as 32-bit words (mdw), 16-bit halfwords (mdh), or
8-bit bytes (mdb). If count is specified, displays that many units. Reads from flash
using the flash driver, therefore it enables reading from a bank not mapped in target
address space. The flash bank to use is inferred from the address of each block, and
the specified length must stay within that bank.
flash write_bank num filename [offset] [Command]
Write the binary filename to flash bank num, starting at offset bytes from the be-
ginning of the bank. If offset is omitted, start at the beginning of the flash bank. The
num parameter is a value shown by flash banks.
flash read_bank num filename [offset [length]] [Command]
Read length bytes from the flash bank num starting at offset and write the contents to
the binary filename. If offset is omitted, start at the beginning of the flash bank. If
length is omitted, read the remaining bytes from the flash bank. The num parameter
is a value shown by flash banks.
Chapter 12: Flash Commands 81
The num parameter is a value shown by flash banks. This command will first query
the hardware, it does not print cached and possibly stale information.
“write protect” pin on the flash chip. The CFI driver can use a target-specific working
area to significantly speed up operation.
The CFI driver can accept the following optional parameters, in any order:
• jedec probe ... is used to detect certain non-CFI flash ROMs, like AM29LV010
and similar types.
• x16 as x8 ... when a 16-bit flash is hooked up to an 8-bit bus.
• bus swap ... when data bytes in a 16-bit flash needs to be swapped.
• data swap ... when data bytes in a 16-bit flash needs to be swapped when writing
data values (i.e. not CFI commands).
To configure two adjacent banks of 16 MBytes each, both sixteen bits (two bytes)
wide on a sixteen bit bus:
flash bank $_FLASHNAME cfi 0x00000000 0x01000000 2 2 $_TARGETNAME
flash bank $_FLASHNAME cfi 0x01000000 0x01000000 2 2 $_TARGETNAME
To configure one bank of 32 MBytes built from two sixteen bit (two byte) wide parts
wired in parallel to create a thirty-two bit (four byte) bus with doubled throughput:
flash bank $_FLASHNAME cfi 0x00000000 0x02000000 2 4 $_TARGETNAME
jtagspi set bank id name total size page size read cmd [Command]
unused pprg cmd mass erase cmd sector size sector erase cmd
Sets flash parameters: name human readable string, total size size in bytes,
page size is write page size. read cmd and pprg cmd are commands for
read and page program, respectively. mass erase cmd, sector size and
sector erase cmd are optional.
jtagspi set 0 w25q128 0x1000000 0x100 0x03 0 0x02 0xC7 0x10000 0xD8
Normal OpenOCD commands like mdw can be used to display the flash content, but
only after proper controller initialization as described above. However, due to a silicon
bug in some devices, attempting to access the very last word should be avoided.
It is possible to use two (even different) flash chips alternatingly, if individual bank
chip selects are available. For some package variants, this is not the case due to
limited pin count. To switch from one to another, adjust FSEL bit accordingly and
re-issue ’flash probe bank id’. Note that the bank base address will not change, so
the address spaces of both devices will overlap. In dual flash mode both chips must
be identical regarding size and most other properties.
Block or sector protection internal to the flash chip is not handled by this driver
at all, but can be dealt with manually by the ’cmd’ command, see below. The
sector protection via ’flash protect’ command etc. is completely internal to openocd,
intended only to prevent accidental erase or overwrite and it does not persist across
openocd invocations.
OpenOCD contains a hardcoded list of flash devices with their properties, these are
auto-detected. If a device is not included in this list, SFDP discovery is attempted. If
this fails or gives inappropriate results, manual setting is required (see ’set’ command).
flash bank $_FLASHNAME stmqspi 0x90000000 0 0 0 \
$_TARGETNAME 0xA0001000
flash bank $_FLASHNAME stmqspi 0x70000000 0 0 0 \
$_TARGETNAME 0xA0001400
There are three specific commands
stmqspi set bank id name total size page size read cmd [Command]
fread cmd pprg cmd mass erase cmd sector size sector erase cmd
Set flash parameters: name human readable string, total size size in bytes,
page size is write page size. read cmd, fread cmd and pprg cmd are commands
for reading and page programming. fread cmd is used in DPI and QPI modes,
read cmd in normal SPI (single line) mode. mass erase cmd, sector size and
sector erase cmd are optional.
This command is required if chip id is not hardcoded yet and e.g. for EEPROMs
or FRAMs which don’t support an id command.
In dual mode parameters of both chips are set identically. The parameters refer
to a single chip, so the whole bank gets twice the specified capacity etc.
interleaved from both chips starting with chip 1. In this case resp num must
be even.
Note the hardware dictated subtle difference of those two cases in dual-flash
mode.
To check basic communication settings, issue
stmqspi cmd bank_id 0 0x04; stmqspi cmd bank_id 1 0x05
stmqspi cmd bank_id 0 0x06; stmqspi cmd bank_id 1 0x05
for single flash mode or
stmqspi cmd bank_id 0 0x04; stmqspi cmd bank_id 2 0x05
stmqspi cmd bank_id 0 0x06; stmqspi cmd bank_id 2 0x05
for dual flash mode. This should return the status register contents.
In 8-line mode, cmd byte is sent twice - first time as given, second time comple-
mented. Additionally, in 8-line mode only, some commands (e.g. Read Status)
need a dummy address, e.g.
stmqspi cmd bank_id 1 0x05 0x00 0x00 0x00 0x00
should return the status register contents.
mrvlqspi [Flash Driver]
This driver supports QSPI flash controller of Marvell’s Wireless Microcontroller plat-
form.
The flash size is autodetected based on the table of known JEDEC IDs hardcoded in
the OpenOCD sources.
flash bank $_FLASHNAME mrvlqspi 0x0 0 0 0 $_TARGETNAME 0x46010000
ath79 [Flash Driver]
Members of ATH79 SoC family from Atheros include a SPI interface with 3 chip
selects. On reset a SPI flash connected to the first chip select (CS0) is made directly
read-accessible in the CPU address space (up to 16MBytes) and is usually used to
store the bootloader and operating system. Normal OpenOCD commands like mdw
can be used to display the flash content while it is in memory-mapped mode (only
the first 4MBytes are accessible without additional configuration on reset).
The setup command only requires the base parameter in order to identify the mem-
ory bank. The actual value for the base address is not otherwise used by the driver.
However the mapping is passed to gdb. Thus for the memory mapped flash (chipse-
lect CS0) the base address should be the actual memory mapped base address. For
unmapped chipselects (CS1 and CS2) care should be taken to use a base address that
does not overlap with real memory regions. Additional information, like flash size, are
detected automatically. An optional additional parameter sets the chipselect for the
bank, with the default CS0. CS1 and CS2 require additional GPIO setup before they
can be used since the alternate function must be enabled on the GPIO pin CS1/CS2
is routed to on the given SoC.
flash bank $_FLASHNAME ath79 0xbf000000 0 0 0 $_TARGETNAME
bootloader over a UART connection. Security features of the CC3220SF may erase
the internal flash during power on reset. Refer to documentation at www.ti.com/
cc3220sf for details on security features and programming the serial flash.
flash bank $_FLASHNAME cc3220sf 0 0 0 0 $_TARGETNAME
or S6E2Dx, with x treated as wildcard and otherwise case (and any trailing characters)
ignored.
flash bank ${_FLASHNAME}0 fm4 0x00000000 0 0 0 \
$_TARGETNAME S6E2CCAJ0A
flash bank ${_FLASHNAME}1 fm4 0x00100000 0 0 0 \
$_TARGETNAME S6E2CCAJ0A
The current implementation is incomplete. Protection is not supported, nor is Chip
Erase (only Sector Erase is implemented).
kinetis [Flash Driver]
Kx, KLx, KVx and KE1x members of the Kinetis microcontroller family from NXP
(former Freescale) include internal flash and use ARM Cortex-M0+ or M4 cores. The
driver automatically recognizes flash size and a number of flash banks (1-4) using the
chip identification register, and autoconfigures itself. Use kinetis ke driver for KE0x
and KEAx devices.
The kinetis driver defines option:
• -sim-base addr ... base of System Integration Module where chip identification
resides. Driver tries two known locations if option is omitted.
flash bank $_FLASHNAME kinetis 0 0 0 0 $_TARGETNAME
kinetis create_banks [Config Command]
Configuration command enables automatic creation of additional flash banks
based on real flash layout of device. Banks are created during device probe.
Use ’flash probe 0’ to force probe.
kinetis fcf_source [protection|write] [Command]
Select what source is used when writing to a Flash Configuration Field.
protection mode builds FCF content from protection bits previously set
by ’flash protect’ command. This mode is default. MCU is protected from
unwanted locking by immediate writing FCF after erase of relevant sector.
write mode enables direct write to FCF. Protection cannot be set by ’flash
protect’ command. FCF is written along with the rest of a flash image.
BEWARE: Incorrect flash configuration may permanently lock the device!
kinetis fopt [num] [Command]
Set value to write to FOPT byte of Flash Configuration Field. Used in kinetis
’fcf source protection’ mode only.
kinetis mdm check_security [Command]
Checks status of device security lock. Used internally in examine-end and
examine-fail event.
kinetis mdm halt [Command]
Issues a halt via the MDM-AP. This command can be used to break a watchdog
reset loop when connecting to an unsecured target.
kinetis mdm mass_erase [Command]
Issues a complete flash erase via the MDM-AP. This can be used to erase a chip
back to its factory state, removing security. It does not require the processor to
Chapter 12: Flash Commands 96
be halted, however the target will remain in a halted state after this command
completes.
The driver has one additional mandatory parameter: The CPU clock rate (in kHz)
at the time the flash operations will take place. Most of the time this will not be the
crystal frequency, but a higher PLL frequency. The reset-init event handler in the
board script is usually the place where you start the PLL.
The driver rejects flashless devices (currently the LPC2930).
The EEPROM in LPC2900 devices is not mapped directly into the address space. It
must be handled much more like NAND flash memory, and will therefore be handled
by a separate lpc2900_eeprom driver (not yet available).
Sector protection in terms of the LPC2900 is handled transparently. Every time a
sector needs to be erased or programmed, it is automatically unprotected. What is
shown as protection status in the flash info command, is actually the LPC2900
sector security. This is a mechanism to prevent a sector from ever being erased or
programmed again. As this is an irreversible mechanism, it is handled by a spe-
cial command (lpc2900 secure_sector), and not by the standard flash protect
command.
Example for a 125 MHz clock frequency:
flash bank $_FLASHNAME lpc2900 0 0 0 0 $_TARGETNAME 125000
Some lpc2900-specific commands are defined. In the following command list, the
bank parameter is the bank number as obtained by the flash banks command.
lpc2900 signature bank [Command]
Calculates a 128-bit hash value, the signature, from the whole flash content.
This is a hardware feature of the flash block, hence the calculation is very fast.
You may use this to verify the content of a programmed device against a known
signature. Example:
lpc2900 signature 0
signature: 0x5f40cdc8:0xc64e592e:0x10490f89:0x32a0f317
lpc2900 read_custom bank filename [Command]
Reads the 912 bytes of customer information from the flash index sector, and
saves it to a file in binary format. Example:
lpc2900 read_custom 0 /path_to/customer_info.bin
The index sector of the flash is a write-only sector. It cannot be erased! In order to
guard against unintentional write access, all following commands need to be preceded
by a successful call to the password command:
lpc2900 password bank password [Command]
You need to use this command right before each of the following commands:
lpc2900 write_custom, lpc2900 secure_sector, lpc2900 secure_jtag.
The password string is fixed to "I know what I am doing". Example:
lpc2900 password 0 I_know_what_I_am_doing
Potentially dangerous operation allowed in next command!
lpc2900 write_custom bank filename type [Command]
Writes the content of the file into the customer info space of the flash index
sector. The filetype can be specified with the type field. Possible values for type
Chapter 12: Flash Commands 99
are: bin (binary), ihex (Intel hex format), elf (ELF binary) or s19 (Motorola
S-records). The file must contain a single section, and the contained data length
must be exactly 912 bytes.
Attention: This cannot be reverted! Be careful!
Example:
lpc2900 write_custom 0 /path_to/customer_info.bin bin
• Work Flash - intended to be used as storage for user data (e.g. EEPROM emu-
lation). Total size: 32 KBytes, sector size: 32 KBytes, row size: 512 bytes.
• Supervisory Flash - special region which contains device-specific service data.
This region does not support erase operation. Only few rows can be programmed
by the user, most of the rows are read only. Programming operation will erase
row automatically.
All three flash regions are supported by the driver. Flash geometry is detected auto-
matically by parsing data in SPCIF GEOMETRY register.
PSoC6 is equipped with NOR Flash so erased Flash reads as 0x00.
flash bank main_flash_cm0 psoc6 0x10000000 0 0 0 \
${TARGET}.cm0
flash bank work_flash_cm0 psoc6 0x14000000 0 0 0 \
${TARGET}.cm0
flash bank super_flash_user_cm0 psoc6 0x16000800 0 0 0 \
${TARGET}.cm0
flash bank super_flash_nar_cm0 psoc6 0x16001A00 0 0 0 \
${TARGET}.cm0
flash bank super_flash_key_cm0 psoc6 0x16005A00 0 0 0 \
${TARGET}.cm0
flash bank super_flash_toc2_cm0 psoc6 0x16007C00 0 0 0 \
${TARGET}.cm0
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.
flash bank $_FLASHNAME stm32f1x 0 0x20000 0 0 $_TARGETNAME
If you have a target with dual flash banks then define the second bank as per the
following example.
flash bank $_FLASHNAME stm32f1x 0x08080000 0 0 0 $_TARGETNAME
Some stm32f1x-specific commands are defined:
stm32f1x lock num [Command]
Locks the entire stm32 device against reading. The num parameter is a value
shown by flash banks.
stm32f1x unlock num [Command]
Unlocks the entire stm32 device for reading. This command will cause a mass
erase of the entire stm32 device if previously locked. The num parameter is a
value shown by flash banks.
stm32f1x mass_erase num [Command]
Mass erases the entire stm32 device. The num parameter is a value shown by
flash banks.
stm32f1x options_read num [Command]
Reads and displays active stm32 option bytes loaded during POR or upon
executing the stm32f1x options_load command. The num parameter is a
value shown by flash banks.
stm32f1x options_write num (SWWDG|HWWDG) [Command]
(RSTSTNDBY|NORSTSTNDBY) (RSTSTOP|NORSTSTOP) (USEROPT
user data)
Writes the stm32 option byte with the specified values. The num parameter is
a value shown by flash banks. The user data parameter is content of higher
16 bits of the option byte register (Data0 and Data1 as one 16bit number).
stm32f1x options_load num [Command]
Generates a special kind of reset to re-load the stm32 option bytes written by
the stm32f1x options_write or flash protect commands without having to
power cycle the target. Not applicable to stm32f1x devices. The num parameter
is a value shown by flash banks.
stm32f2x [Flash Driver]
All members of the STM32F2, STM32F4 and STM32F7 microcontroller families from
STMicroelectronics include internal flash and use ARM Cortex-M3/M4/M7 cores.
The driver automatically recognizes a number of these chips using the chip identifi-
cation register, and autoconfigures itself.
flash bank $_FLASHNAME stm32f2x 0 0 0 0 $_TARGETNAME
If you use OTP (One-Time Programmable) memory define it as a second bank as per
the following example.
flash bank $_FLASHNAME stm32f2x 0x1FFF7800 0 0 0 $_TARGETNAME
Chapter 12: Flash Commands 107
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. However, specifying a wrong value might lead to a completely wrong
flash layout, so this feature must be used carefully.
flash bank $_FLASHNAME stm32l4x 0x08000000 0x40000 0 0 $_TARGETNAME
Some stm32l4x-specific commands are defined:
NOTE: At the time this text was written, the largest NAND flash fully supported by
OpenOCD is 2 GiBytes (16 GiBits). This is because the variables used to hold offsets and
lengths are only 32 bits wide. (Larger chips may work in some cases, unless an offset or
length 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.
By default, only page data is saved to the specified file. Use an oob option parameter
to save OOB data:
• no oob * parameter
Output file holds only page data; OOB is discarded.
• oob_raw
Output file interleaves page data and OOB data; the file will be longer than
"length" by the size of the spare areas associated with each data page. Note that
this kind of "raw" access is different from what’s implied by nand raw_access,
which just controls whether a hardware-aware access method is used.
• oob_only
Output file has only raw OOB data, and will be smaller than "length" since it
will contain only the spare areas associated with each data page.
nand erase num [offset length] [Command]
Erases blocks on the specified NAND device, starting at the specified offset and con-
tinuing for length bytes. Both of those values must be exact multiples of the device’s
block size, and the region they specify must fit entirely in the chip. If those param-
eters are not specified, the whole NAND chip will be erased. The num parameter is
the value shown by nand list.
NOTE: This command will try to erase bad blocks, when told to do so, which will
probably invalidate the manufacturer’s bad block marker. For the remainder of the
current server session, nand info will still report that the block “is” bad.
nand write num filename offset [option...] [Command]
Writes binary data from the file into the specified NAND device, starting at the
specified offset. Those pages should already have been erased; you can’t change zero
bits to one bits. The num parameter is the value shown by nand list.
Use a complete path name for filename, so you don’t depend on the directory used to
start the OpenOCD server.
The 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, if that’s being written.)
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.
Provide at most one option parameter. With some NAND drivers, the meanings of
these parameters may change if nand raw_access was used to disable hardware ECC.
• no oob * parameter
File has only page data, which is written. If raw access is in use, the OOB area
will not be written. Otherwise, if the underlying NAND controller driver has a
write_page routine, that routine may write the OOB with hardware-computed
ECC data.
• oob_only
File has only raw OOB data, which is written to the OOB area. Each page’s data
area stays untouched. This can be a dangerous option, since it can invalidate the
ECC data. You may need to force raw access to use this mode.
Chapter 12: Flash Commands 117
• oob_raw
File interleaves data and OOB data, both of which are written If raw access is
enabled, the data is written first, then the un-altered OOB. Otherwise, if the
underlying NAND controller driver has a write_page routine, that routine may
modify the OOB before it’s written, to include hardware-computed ECC data.
• oob_softecc
File has only page data, which is written. The OOB area is filled with 0xff,
except for a standard 1-bit software ECC code stored in conventional locations.
You might need to force raw access to use this mode, to prevent the underlying
driver from applying hardware ECC.
• oob_softecc_kw
File has only page data, which is written. The OOB area is filled with 0xff, except
for a 4-bit software ECC specific to the boot ROM in Marvell Kirkwood SoCs.
You might need to force raw access to use this mode, to prevent the underlying
driver from applying hardware ECC.
nand verify num filename offset [option...] [Command]
Verify the binary data in the file has been programmed to the specified NAND device,
starting at the specified offset. The num parameter is the value shown by nand list.
Use a complete path name for filename, so you don’t depend on the directory used to
start the OpenOCD server.
The offset must be an exact multiple of the device’s page size. All data in the file
will be read and compared to the contents of the flash, assuming it doesn’t run past
the end of the device. As with nand write, only full pages are verified, so any extra
space in the last page will be filled with 0xff bytes.
The same options accepted by nand write, and the file will be processed similarly to
produce the buffers that can be compared against the contents produced from nand
dump.
NOTE: This will not work when the underlying NAND controller driver’s write_
page routine must update the OOB with a hardware-computed ECC before the data
is written. This limitation may be removed in a future release.
For the next two commands, it is assumed that the pins have already been properly
configured for input or output.
At this writing, this driver includes write_page and read_page methods. Using nand
raw_access to disable those methods will prevent use of hardware ECC in the MLC
controller mode, but won’t change SLC behavior.
13 Flash Programming
OpenOCD implements numerous ways to program the target flash, whether internal or ex-
ternal. Programming can be achieved by either using [Programming using GDB], page 165,
or using the commands given in [Flash Programming Commands], page 79.
To simplify using the flash commands directly a jimtcl script is available that handles
the programming and verify stage. OpenOCD will program/verify/reset the target and
optionally shutdown.
The script is executed as follows and by default the following actions will be performed.
1. ’init’ is executed.
2. ’reset init’ is called to reset and halt the target, any ’reset init’ scripts are executed.
3. flash write_image is called to erase and write any flash using the filename given.
4. If the preverify parameter is given, the target is "verified" first and only flashed if
this fails.
5. verify_image is called if verify parameter is given.
6. reset run is called if reset parameter is given.
7. OpenOCD is shutdown if exit parameter is given.
An example of usage is given below. See [program], page 82.
# program and verify using elf/hex/s19. verify and reset
# are optional parameters
openocd -f board/stm32f3discovery.cfg \
-c "program filename.elf verify reset exit"
14 PLD/FPGA Commands
Programmable Logic Devices (PLDs) and the more flexible Field Programmable Gate Ar-
rays (FPGAs) are both types of programmable hardware. OpenOCD can support program-
ming them. Although PLDs are generally restrictive (cells are less functional, and there are
no special purpose cells for memory or computational tasks), they share the same OpenOCD
infrastructure. Accordingly, both are called PLDs here.
pld device driver name tap name [driver options] [Config Command]
Defines a new PLD device, supported by driver driver name, using the TAP named
tap name. The driver may make use of any driver options to configure its behavior.
15 General Commands
The commands documented in this chapter here are common commands that you, as a
human, may want to type and see the output of. Configuration type commands are docu-
mented elsewhere.
Intent:
• Source Of Commands
OpenOCD commands can occur in a configuration script (discussed elsewhere) or typed
manually by a human or supplied programmatically, or via one of several TCP/IP Ports.
• From the human
A human should interact with the telnet interface (default port: 4444) or via GDB
(default port 3333).
To issue commands from within a GDB session, use the monitor command, e.g. use
monitor poll to issue the poll command. All output is relayed through the GDB
session.
• Machine Interface The Tcl interface’s intent is to be a machine interface. The default
Tcl port is 5555.
proc shutdown {} {
puts "This is my implementation of shutdown"
# my own stuff before exit OpenOCD
original_shutdown
}
If user types CTRL-C or kills OpenOCD, either the command shutdown or its re-
placement will be automatically executed before OpenOCD exits.
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 (including
by single stepping) or otherwise activating the relevant module will flush such values.
Cores may have surprisingly many registers in their Debug and trace infrastructure:
> reg
===== ARM registers
(0) r0 (/32): 0x0000D3C2 (dirty)
(1) r1 (/32): 0xFD61F31C
(2) r2 (/32)
...
(164) ETM_contextid_comparator_mask (/32)
>
reset [Command]
reset run [Command]
reset halt [Command]
Chapter 15: General Commands 126
fast_load [Command]
Loads an image stored in memory by fast_load_image to the current target. Must
be preceded by fast load image.
The following example shows how to setup RTT using the SEGGER RTT implementation
on the target device.
resume
version [Command]
Displays a string identifying the version of this OpenOCD server.
Several of the parameters must reflect the trace port capabilities, which are a func-
tion of silicon capabilities (exposed later using etm info) and of what hardware is
connected to that port (such as an external pod, or ETB). The width must be either
4, 8, or 16, except with ETMv3.0 and newer modules which may also support 1, 2,
24, 32, 48, and 64 bit widths. (With those versions, etm info also shows whether the
selected port width and mode are supported.)
The mode must be normal, multiplexed, or demultiplexed. The clocking must be
half or full.
Warning: With ETMv3.0 and newer, the bits set with the mode and
clocking parameters both control the mode. This modified mode does not
map to the values supported by previous ETM modules, so this syntax
is subject to change.
Note: You can see the ETM registers using the reg command. Not all
possible registers are present in every ETM. Most of the registers are
write-only, and are used to configure what CPU activities are traced.
etm tracemode [type context id bits cycle accurate branch output] [Command]
Displays what data that ETM will collect. If arguments are provided, first configures
that data. When the configuration changes, tracing is stopped and any buffered trace
data is invalidated.
• type ... describing how data accesses are traced, when they pass any ViewData
filtering that was set up. The value is one of none (save nothing), data (save
data), address (save addresses), all (save data and addresses)
• context id bits ... 0, 8, 16, or 32
• cycle accurate ... enable or disable cycle-accurate instruction tracing. Before
ETMv3, enabling this causes much extra data to be recorded.
• branch output ... enable or disable. Disable this unless you need to try recon-
structing the instruction trace stream without an image of the code.
At this writing, September 2009, there are no Tcl utility procedures to help set up any
common tracing scenarios.
cti create cti name -dap dap name -ap-num apn -baseaddr [Command]
base address
Creates a CTI instance cti name on the DAP instance dap name on MEM-AP apn.
The base address must match the base address of the CTI on the respective MEM-
AP. All arguments are mandatory. This creates a new command $cti_name which is
used for various purposes including additional configuration.
marked valid, which makes the CPU fetch all exception handlers from the mini-IC, ignoring
the code in RAM.
To address this situation, OpenOCD provides the xscale vector_table command, which
allows the user to explicitly write individual entries to either the high or low vector table
stored in the mini-IC.
It is recommended to place a pc-relative indirect branch in the vector table, and put the
branch destination somewhere in memory. Doing so makes sure the code in the vector table
stays constant regardless of code layout in memory:
_vectors:
ldr pc,[pc,#0x100-8]
ldr pc,[pc,#0x100-8]
ldr pc,[pc,#0x100-8]
ldr pc,[pc,#0x100-8]
ldr pc,[pc,#0x100-8]
ldr pc,[pc,#0x100-8]
ldr pc,[pc,#0x100-8]
ldr pc,[pc,#0x100-8]
.org 0x100
.long real_reset_vector
.long real_ui_handler
.long real_swi_handler
.long real_pf_abort
.long real_data_abort
.long 0 /* unused */
.long real_irq_handler
.long real_fiq_handler
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 is executing, but for each vector table entry not previously defined using
the 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 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 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
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 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 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 functionality apply: (1) the value and mask argu-
ments to the wp command are not supported, (2) the watchpoint length must be a power
Chapter 16: Architecture and Core Commands 140
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 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.
These commands are available to XScale based CPUs, which are implementations of the
ARMv5TE architecture.
• -event event name event body – assigns an event handler, a TCL string which
is evaluated when the event is triggered. The events pre-enable, post-enable,
pre-disable and post-disable are defined for TPIU/SWO. A typical use case
for the event pre-enable is to enable the trace clock of the TPIU.
• -output (external|:port|filename|-) – specifies the destination of the trace
data:
− external – configure TPIU/SWO to let user capture trace output externally,
either with an additional UART or with a logic analyzer (default);
− - – configure TPIU/SWO and debug adapter to gather trace data and for-
ward it to tcl_trace command;
− :port – configure TPIU/SWO and debug adapter to gather trace data, open
a TCP server at port port and send the trace data to each connected client;
− filename – configure TPIU/SWO and debug adapter to gather trace data
and append it to filename, which can be either a regular file or a named
pipe.
• -traceclk TRACECLKIN freq – mandatory parameter. Specifies the frequency
in Hz of the trace clock. For the TPIU embedded in Cortex-M3 or M4, this
is usually the same frequency as HCLK. For protocol sync this is twice the
frequency of the pin data rate.
• -pin-freq trace freq – specifies the expected data rate in Hz of the SWO pin.
Parameter used only on protocols uart and manchester. Can be omitted to let
the adapter driver select the maximum supported rate automatically.
• -port-width port width – sets to port width the width of the synchronous par-
allel port used for trace output. Parameter used only on protocol sync. If not
specified, default value is 1.
• -formatter (0|1) – specifies if the formatter should be enabled. Parameter used
only on protocol sync. If not specified, default value is 0.
Example usage:
1. STM32L152 board is programmed with an application that configures PLL to provide
core clock with 24MHz frequency; to use ITM output it’s enough to:
#include <libopencm3/cm3/itm.h>
...
ITM_STIM8(0) = c;
...
Chapter 16: Architecture and Core Commands 145
(the most obvious way is to use the first stimulus port for printf, for that this
ITM STIM8 assignment can be used inside write(); to make it blocking to avoid data
loss, add while (!(ITM_STIM8(0) & ITM_STIM_FIFOREADY)););
2. An FT2232H UART is connected to the SWO pin of the board;
3. Commands to configure UART for 12MHz baud rate:
$ setserial /dev/ttyUSB1 spd_cust divisor 5
$ stty -F /dev/ttyUSB1 38400
(FT2232H’s base frequency is 60MHz, spd cust allows to alias 38400 baud with our
custom divisor to get 12MHz)
4. itmdump -f /dev/ttyUSB1 -d1
5. OpenOCD invocation line:
openocd -f interface/stlink.cfg \
-c "transport select hla_swd" \
-f target/stm32l1.cfg \
-c "stm32l1.tpiu configure -protocol uart" \
-c "stm32l1.tpiu configure -traceclk 24000000 -pin-freq 12000000" \
-c "stm32l1.tpiu enable"
esirisc trace trigger stop (condition) [stop data stop mask] [Command]
Configure trigger stop condition using the provided stop data and mask. A brief
description of each condition is provided below; for more detail on how these values
are used, see the eSi-RISC Architecture Manual.
Chapter 16: Architecture and Core Commands 149
Supported conditions:
• none manual tracing (see esirisc trace stop).
• pc stop tracing if the PC matches stop data and mask.
• load stop tracing if the effective address of a load instruction matches stop data
and mask.
• store stop tracing if the effective address of a store instruction matches stop
data and mask.
• exception stop tracing if the EID of an exception matches stop data and mask.
• eret stop tracing when an ERET instruction is executed.
• wait stop tracing when a WAIT instruction is executed.
• stop stop tracing when a STOP instruction is executed.
esirisc trace trigger delay (trigger) [cycles] [Command]
Configure trigger start/stop delay in clock cycles.
Supported triggers:
• none no delay to start or stop collection.
• start delay cycles after trigger to start collection.
• stop delay cycles after trigger to stop collection.
• both delay cycles after both triggers to start or stop collection.
manually, because there would be a risk that two register will have same number.
When register GDB number is not set with this option, then register will get a
previous register number + 1. This option is required only for those registers that
must be at particular address expected by GDB.
• -core
This option specifies that register is a core registers. If not - this is an AUX
register. AUX registers and core registers reside in different address spaces.
• -bcr
This options specifies that register is a BCR register. BCR means Build Config-
uration Registers - this is a special type of AUX registers that are read only and
non-volatile, that is - they never change their value. Therefore OpenOCD never
invalidates values of those registers in internal caches. Because BCR is a type of
AUX registers, this option cannot be used with -core.
• -type type name
Name of type of this register. This can be either one of the basic GDB types, or
a custom types described with arc add-reg-type-[flags|struct].
• -g
If specified then this is a "general" register. General registers are always read
by OpenOCD on context save (when core has just been halted) and is always
transferred to GDB client in a response to g-packet. Contrary to this, non-
general registers are read and sent to GDB client on-demand. In general it is not
recommended to apply this option to custom registers.
arc add-reg-type-flags -name name flags... [Config Command]
Adds new register type of “flags” class. “Flags” types can contain only one-bit fields.
Each flag definition looks like -flag name bit-position.
arc add-reg-type-struct -name name structs... [Config Command]
Adds new register type of “struct” class. “Struct” types can contain either bit-fields or
fields of other types, however at the moment only bit fields are supported. Structure
bit field definition looks like -bitfield name startbit endbit.
arc get-reg-field reg-name field-name [Command]
Returns value of bit-field in a register. Register must be “struct” register type, See
[add-reg-type-struct], page 154. command definition.
arc set-reg-exists reg-names... [Command]
Specify that some register exists. Any amount of names can be passed as an argument
for a single command invocation.
Linux-ARM kernels have a “Kernel low-level debugging via EmbeddedICE DCC channel”
option (CONFIG DEBUG ICEDCC, depends on CONFIG DEBUG LL) which uses this
mechanism to deliver messages before a serial console can be activated. This is not the
same format used by libdcc. Other software, such as the U-Boot boot loader, sometimes
does the same thing.
Chapter 16: Architecture and Core Commands 156
17 JTAG Commands
Most general purpose JTAG commands have been presented earlier. (See [JTAG Speed],
page 54, Chapter 9 [Reset Configuration], page 55, and Chapter 10 [TAP Declaration],
page 60.) 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.
To use these commands you will need to understand some of the basics of JTAG, including:
• A JTAG scan chain consists of a sequence of individual TAP devices such as a CPUs.
• Control operations involve moving each TAP through the same standard state machine
(in parallel) using their shared TMS and clock signals.
• Data transfer involves shifting data through the chain of instruction or data registers
of each TAP, writing new register values while the reading previous ones.
• Data register sizes are a function of the instruction active in a given TAP, while in-
struction register sizes are fixed for each TAP. All TAPs support a BYPASS instruction
with a single bit data register.
• The way OpenOCD differentiates between TAP devices is by shifting different instruc-
tions into (and out of) their instruction registers.
flush_count [Command]
Returns the number of times the JTAG queue has been flushed. This may be used
for performance tuning.
For example, flushing a queue over USB involves a minimum latency, often several
milliseconds, which does not change with the amount of data which is written. You
may be able to identify performance problems by finding tasks which waste bandwidth
by flushing small transfers too often, instead of batching them into larger operations.
irscan [tap instruction]+ [-endstate tap state] [Command]
For each tap listed, loads the instruction register with its associated numeric
instruction. (The number of bits in that instruction may be displayed using the
scan_chain command.) For other TAPs, a BYPASS instruction is loaded.
When tap state is specified, the JTAG state machine is left in that state. For example
irpause might be specified, so the data register can be loaded before re-entering the
run/idle state. If the end state is not specified, the run/idle state is entered.
Note: OpenOCD currently supports only a single field for instruction reg-
ister values, unlike data register values. For TAPs where the instruction
register length is more than 32 bits, portable scripts currently must issue
only BYPASS instructions.
pathmove start state [next state ...] [Command]
Start by moving to start state, which must be one of the stable states. Unless it is the
only state given, this will often be the current state, so that no TCK transitions are
needed. Then, in a series of single state transitions (conforming to the JTAG state
machine) shift to each next state in sequence, one per TCK cycle. The final state
must also be stable.
runtest num_cycles [Command]
Move to the run/idle state, and execute at least num cycles of the JTAG clock
(TCK). Instructions often need some time to execute before they take effect.
verify_ircapture (enable|disable) [Command]
Verify values captured during ircapture and returned during IR scans. Default
is enabled, but this can be overridden by verify_jtag. This flag is ignored when
validating JTAG chain configuration.
verify_jtag (enable|disable) [Command]
Enables verification of DR and IR scans, to help detect programming errors. For IR
scans, verify_ircapture must also be enabled. Default is enabled.
• DRCAPTURE
• DRSHIFT ... stable; TDI/TDO shifting through the data register
• DREXIT1
• DRPAUSE ... stable; data register ready for update or more shifting
• DREXIT2
• DRUPDATE
• IRSELECT
• IRCAPTURE
• IRSHIFT ... stable; TDI/TDO shifting through the instruction register
• IREXIT1
• IRPAUSE ... stable; instruction register ready for update or more shifting
• IREXIT2
• IRUPDATE
Note that only six of those states are fully “stable” in the face of TMS fixed (low except
for reset) and a free-running JTAG clock. For all the others, the next TCK transition
changes to a new state.
• From drshift and irshift, clock transitions will produce side effects by changing
register contents. The values to be latched in upcoming drupdate or irupdate states
may not be as expected.
• run/idle, drpause, and irpause are reasonable choices after drscan or irscan com-
mands, since they are free of JTAG side effects.
• run/idle may have side effects that appear at non-JTAG levels, such as advancing
the ARM9E-S instruction pipeline. Consult the documentation for the TAP(s) you are
working with.
160
The input format accepts a handful of non-standard extensions. These include three op-
codes corresponding to SVF extensions from Lattice Semiconductor (LCOUNT, LDELAY,
LDSR), and two opcodes supporting a more accurate translation of SVF (XTRST, XWAIT-
STATE). If xsvfdump shows a file is using those opcodes, it probably will not be usable with
other XSVF tools.
Examples:
ipdbg -start -tap xc6s.tap -hub 0x02 -port 4242 -tool 4
Starts a server listening on tcp-port 4242 which connects to tool 4. The connection is
through the TAP of a Xilinx Spartan 6 on USER1 instruction (tested with a papillion pro
board).
ipdbg -start -tap 10m50.tap -hub 0x00C -vir -port 60000 -tool 1
Starts a server listening on tcp-port 60000 which connects to tool 1 (data up 1/data down 1).
The connection is through the TAP of a Intel MAX10 virtual jtag component
(sld instance index is 0; sld ir width is smaller than 5).
162
19 Utility Commands
ThreadX symbols
tx thread current ptr, tx thread created ptr, tx thread created count.
FreeRTOS symbols
pxCurrentTCB, pxReadyTasksLists, xDelayedTaskList1, xDelayedTaskList2,
pxDelayedTaskList, pxOverflowDelayedTaskList, xPendingReadyList, uxCur-
rentNumberOfTasks, uxTopUsedPriority.
linux symbols
init task.
ChibiOS symbols
rlist, ch debug, chSysInit.
embKernel symbols
Rtos::sCurrentTask, Rtos::sListReady, Rtos::sListSleep, Rtos::sListSuspended,
Rtos::sMaxPriorities, Rtos::sCurrentTaskCount.
mqx symbols
mqx kernel data, MQX init struct.
uC/OS-III symbols
OSRunning, OSTCBCurPtr, OSTaskDbgListPtr, OSTaskQty.
nuttx symbols
g readytorun, g tasklisttable.
RIOT symbols
sched threads, sched num threads, sched active pid, max threads,
tcb name offset.
Zephyr symbols
kernel, kernel openocd offsets, kernel openocd size t size
For most RTOS supported the above symbols will be exported by default. However for
some, eg. FreeRTOS, uC/OS-III and Zephyr, extra steps must be taken.
Zephyr must be compiled with the DEBUG THREAD INFO option. This will generate
some symbols with information needed in order to build the list of threads.
FreeRTOS and uC/OS-III RTOSes may require additional OpenOCD-specific file to be
linked along with the project:
FreeRTOS contrib/rtos-helpers/FreeRTOS-openocd.c
uC/OS-III
contrib/rtos-helpers/uCOS-III-openocd.c
OpenOCD commands can consist of two words, e.g. "flash banks". The startup.tcl
"unknown" proc will translate this into a Tcl proc called "flash banks".
Chapter 21: Tcl Scripting API 170
22 FAQ
1. RTCK, also known as: Adaptive Clocking - What is it?
>
3. Missing: cygwin1.dll OpenOCD complains about a missing cygwin1.dll.
Make sure you have Cygwin installed, or at least a version of OpenOCD that claims
to come with all the necessary DLLs. When using Cygwin, try launching OpenOCD
from the Cygwin shell.
4. Breakpoint Issue I’m trying to set a breakpoint using GDB (or a front-end like
Insight or Eclipse), but OpenOCD complains that "Info: arm7 9 common.c:213
arm7 9 add breakpoint(): sw breakpoint requested, but software breakpoints not
enabled".
GDB issues software breakpoints when a normal breakpoint is requested, or to imple-
ment source-line single-stepping. On ARMv4T systems, like ARM7TDMI, ARM720T
Chapter 22: FAQ 173
or ARM920T, software breakpoints consume one of the two available hardware break-
points.
5. LPC2000 Flash When erasing or writing LPC2000 on-chip flash, the operation fails at
random.
Make sure the core frequency specified in the flash lpc2000 line matches the clock
at the time you’re programming the flash. If you’ve specified the crystal’s frequency,
make sure the PLL is disabled. If you’ve specified the full core speed (e.g. 60MHz),
make sure the PLL is enabled.
6. Amontec Chameleon When debugging using an Amontec Chameleon in its JTAG Accel-
erator configuration, I keep getting "Error: amt jtagaccel.c:184 amt wait scan busy():
amt jtagaccel timed out while waiting for end of scan, rtck was disabled".
Make sure your PC’s parallel port operates in EPP mode. You might have to try
several settings in your PC BIOS (ECP, EPP, and different versions of those).
7. Data Aborts When debugging with OpenOCD and GDB (plain GDB, Insight, or
Eclipse), I get lots of "Error: arm7 9 common.c:1771 arm7 9 read memory(): memory
read caused data abort".
The errors are non-fatal, and are the result of GDB trying to trace stack frames beyond
the last valid frame. It might be possible to prevent this by setting up a proper "initial"
stack frame, if you happen to know what exactly has to be done, feel free to add this
here.
Simple: In your startup code - push 8 registers of zeros onto the stack before calling
main(). What GDB is doing is “climbing” the run time stack by reading various values
on the stack using the standard call frame for the target. GDB keeps going - until one of
2 things happen #1 an invalid frame is found, or #2 some huge number of stackframes
have been processed. By pushing zeros on the stack, GDB gracefully stops.
Debugging Interrupt Service Routines - In your ISR before you call your C code, do
the same - artificially push some zeros onto the stack, remember to pop them off when
the ISR is done.
Also note: If you have a multi-threaded operating system, they often do not in the
interest of saving memory waste these few bytes. Painful...
8. JTAG Reset Config I get the following message in the OpenOCD console (or log file):
"Warning: arm7 9 common.c:679 arm7 9 assert reset(): srst resets test logic, too".
This warning doesn’t indicate any serious problem, as long as you don’t want to debug
your core right out of reset. Your .cfg file specified reset_config trst_and_srst
srst_pulls_trst to tell OpenOCD that either your board, your debugger or your
target uC (e.g. LPC2000) can’t assert the two reset signals independently. With this
setup, it’s not possible to halt the core right out of reset, everything else should work
fine.
9. USB Power When using OpenOCD in conjunction with Amontec JTAGkey and the
Yagarto toolchain (Eclipse, arm-elf-gcc, arm-elf-gdb), the debugging seems to be un-
stable. When single-stepping over large blocks of code, GDB and OpenOCD quit with
an error message. Is there a stability issue with OpenOCD?
No, this is not a stability issue concerning OpenOCD. Most users have solved this issue
by simply using a self-powered USB hub, which they connect their Amontec JTAGkey
Chapter 22: FAQ 174
to. Apparently, some computers do not provide a USB power supply stable enough for
the Amontec JTAGkey to be operated.
Laptops running on battery have this problem too...
10. GDB Disconnects When using the Amontec JTAGkey, sometimes OpenOCD crashes
with the following error message: "Error: gdb server.c:101 gdb get char(): read:
10054". What does that mean and what might be the reason for this?
Error code 10054 corresponds to WSAECONNRESET, which means that the debugger
(GDB) has closed the connection to OpenOCD. This might be a GDB issue.
11. 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. 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 clock frequency?
No. The clock frequency specified here must be given as an integral number. However,
this clock frequency is used by the In-Application-Programming (IAP) routines of the
LPC2000 family only, which seems to be very tolerant concerning the given clock
frequency, so a slight difference between the specified clock frequency and the actual
clock frequency will not cause any trouble.
12. Command Order Do I have to keep a specific order for the commands in the configu-
ration file?
Well, yes and no. Commands can be given in arbitrary order, yet the devices listed
for the JTAG scan chain must be given in the right order (jtag newdevice), with the
device closest to the TDO-Pin being listed first. In general, whenever objects of the
same type exist which require an index number, then these objects must be given in
the right order (jtag newtap, targets and flash banks - a target 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 init has been processed. Such com-
mands include nand probe and everything else that needs to write to controller regis-
ters, perhaps for setting up DRAM and loading it with code.
13. JTAG TAP Order Do I have to declare the TAPS in some particular order?
Yes; whenever you have more than one, you must declare them in the same order used
by the hardware.
Many newer devices have multiple JTAG TAPs. For example: STMicroelectronics
STM32 chips have two TAPs, a “boundary scan TAP” and “Cortex-M3” TAP. Ex-
ample: 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.
Thus, the proper order for the STM32 chip is: (1) The Cortex-M3, then (2) The
boundary scan TAP. If your board includes an additional JTAG chip in the scan chain
(for example a Xilinx CPLD or FPGA) you could place it before or after the STM32
chip in the chain. For example:
Chapter 22: FAQ 175
As in the famous joke, the consequences of Rule #1 are profound. Once you understand
Rule #1, you will understand Tcl.
The two key items here are how “quoted things” work in Tcl. Tcl has three primary quoting
constructs, the [square-brackets] the {curly-braces} and “double-quotes”
Chapter 23: Tcl Crash Course 177
By now you should know $VARIABLES always start with a $DOLLAR sign. BTW: To set
a variable, you actually use the command “set”, as in “set VARNAME VALUE” much like
the ancient BASIC language “let x = 1” statement, but without the equal sign.
• [square-brackets]
[square-brackets] are command substitutions. It operates much like Unix Shell ‘back-
ticks‘. The result of a [square-bracket] operation is exactly 1 string. Remember Rule
#1 - Everything is a string. These two statements are roughly identical:
# bash example
X=‘date‘
echo "The Date is: $X"
# Tcl example
set X [date]
puts "The Date is: $X"
• “double-quoted-things”
“double-quoted-things” are just simply quoted text. $VARIABLES and [square-
brackets] are expanded in place - the result however is exactly 1 string. Remember
Rule #1 - Everything is a string
set x "Dinner"
puts "It is now \"[date]\", $x is in 1 hour"
• {Curly-Braces}
{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 nested 3 times}}} NOTE: [date] is a bad example; at this writing,
Jim/OpenOCD does not have a date command.
The second helper evaluates an ascii string as a numerical expression and returns a value.
Here is an example of how the FOR command could be implemented. The pseudo code
below does not show error handling.
int
MyForCommand( void *interp,
int argc,
char **argv )
{
if( argc != 5 ){
SetResult( interp, "WRONG number of parameters");
return ERROR;
}
// Return no error
SetResult( interp, "" );
return SUCCESS;
}
Every other command IF, WHILE, FORMAT, PUTS, EXPR, everything works in the same
basic way.
new target is created. Remember the parsing rules. When the ascii text is parsed, the
$ TARGETNAME becomes a simple string, the name of the target which happens to
be a TARGET (object) command.
2. The 2nd parameter to the -event parameter is a TCBODY
There are 4 examples:
1. The TCLBODY is a simple string that happens to be a proc name
2. The TCLBODY is several simple commands separated by semicolons
3. The TCLBODY is a multi-line {curly-brace} quoted string
4. The TCLBODY is a string with variables that get expanded.
In the end, when the target event FOO occurs the TCLBODY is evaluated. Method
#1 and #2 are functionally identical. For Method #3 and #4 it is more interesting.
What is the TCLBODY?
Remember the parsing rules. In case #3, {curly-braces} mean the $VARS and [square-
brackets] are expanded later, when the EVENT occurs, and the text is evaluated. In
case #4, they are replaced before the “Target Object Command” is executed. This
occurs at the same time $ TARGETNAME is replaced. In case #4 the date will never
change. {BTW: [date] is a bad example; at this writing, Jim/OpenOCD does not have
a date command}
under this License. If a section does not fit the above definition of Secondary then it is
not allowed to be designated as Invariant. The Document may contain zero Invariant
Sections. If the Document does not identify any Invariant Sections then there are none.
The “Cover Texts” are certain short passages of text that are listed, as Front-Cover
Texts or Back-Cover Texts, in the notice that says that the Document is released under
this License. A Front-Cover Text may be at most 5 words, and a Back-Cover Text may
be at most 25 words.
A “Transparent” copy of the Document means a machine-readable copy, represented
in a format whose specification is available to the general public, that is suitable for
revising the document straightforwardly with generic text editors or (for images com-
posed of pixels) generic paint programs or (for drawings) some widely available drawing
editor, and that is suitable for input to text formatters or for automatic translation to
a variety of formats suitable for input to text formatters. A copy made in an otherwise
Transparent file format whose markup, or absence of markup, has been arranged to
thwart or discourage subsequent modification by readers is not Transparent. An image
format is not Transparent if used for any substantial amount of text. A copy that is
not “Transparent” is called “Opaque”.
Examples of suitable formats for Transparent copies include plain ascii without
markup, Texinfo input format, LaTEX input format, SGML or XML using a publicly
available DTD, and standard-conforming simple HTML, PostScript or PDF designed
for human modification. Examples of transparent image formats include PNG, XCF
and JPG. Opaque formats include proprietary formats that can be read and edited
only by proprietary word processors, SGML or XML for which the DTD and/or
processing tools are not generally available, and the machine-generated HTML,
PostScript or PDF produced by some word processors for output purposes only.
The “Title Page” means, for a printed book, the title page itself, plus such following
pages as are needed to hold, legibly, the material this License requires to appear in the
title page. For works in formats which do not have any title page as such, “Title Page”
means the text near the most prominent appearance of the work’s title, preceding the
beginning of the body of the text.
A section “Entitled XYZ” means a named subunit of the Document whose title either
is precisely XYZ or contains XYZ in parentheses following text that translates XYZ in
another language. (Here XYZ stands for a specific section name mentioned below, such
as “Acknowledgements”, “Dedications”, “Endorsements”, or “History”.) To “Preserve
the Title” of such a section when you modify the Document means that it remains a
section “Entitled XYZ” according to this definition.
The Document may include Warranty Disclaimers next to the notice which states that
this License applies to the Document. These Warranty Disclaimers are considered to
be included by reference in this License, but only as regards disclaiming warranties:
any other implication that these Warranty Disclaimers may have is void and has no
effect on the meaning of this License.
2. VERBATIM COPYING
You may copy and distribute the Document in any medium, either commercially or
noncommercially, provided that this License, the copyright notices, and the license
notice saying this License applies to the Document are reproduced in all copies, and
Appendix A: The GNU Free Documentation License. 185
that you add no other conditions whatsoever to those of this License. You may not use
technical measures to obstruct or control the reading or further copying of the copies
you make or distribute. However, you may accept compensation in exchange for copies.
If you distribute a large enough number of copies you must also follow the conditions
in section 3.
You may also lend copies, under the same conditions stated above, and you may publicly
display copies.
3. COPYING IN QUANTITY
If you publish printed copies (or copies in media that commonly have printed covers) of
the Document, numbering more than 100, and the Document’s license notice requires
Cover Texts, you must enclose the copies in covers that carry, clearly and legibly, all
these Cover Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
the back cover. Both covers must also clearly and legibly identify you as the publisher
of these copies. The front cover must present the full title with all words of the title
equally prominent and visible. You may add other material on the covers in addition.
Copying with changes limited to the covers, as long as they preserve the title of the
Document and satisfy these conditions, can be treated as verbatim copying in other
respects.
If the required texts for either cover are too voluminous to fit legibly, you should put
the first ones listed (as many as fit reasonably) on the actual cover, and continue the
rest onto adjacent pages.
If you publish or distribute Opaque copies of the Document numbering more than 100,
you must either include a machine-readable Transparent copy along with each Opaque
copy, or state in or with each Opaque copy a computer-network location from which
the general network-using public has access to download using public-standard network
protocols a complete Transparent copy of the Document, free of added material. If
you use the latter option, you must take reasonably prudent steps, when you begin
distribution of Opaque copies in quantity, to ensure that this Transparent copy will
remain thus accessible at the stated location until at least one year after the last time
you distribute an Opaque copy (directly or through your agents or retailers) of that
edition to the public.
It is requested, but not required, that you contact the authors of the Document well
before redistributing any large number of copies, to give them a chance to provide you
with an updated version of the Document.
4. MODIFICATIONS
You may copy and distribute a Modified Version of the Document under the conditions
of sections 2 and 3 above, provided that you release the Modified Version under precisely
this License, with the Modified Version filling the role of the Document, thus licensing
distribution and modification of the Modified Version to whoever possesses a copy of
it. In addition, you must do these things in the Modified Version:
A. Use in the Title Page (and on the covers, if any) a title distinct from that of the
Document, and from those of previous versions (which should, if there were any,
be listed in the History section of the Document). You may use the same title as
a previous version if the original publisher of that version gives permission.
Appendix A: The GNU Free Documentation License. 186
B. List on the Title Page, as authors, one or more persons or entities responsible for
authorship of the modifications in the Modified Version, together with at least five
of the principal authors of the Document (all of its principal authors, if it has fewer
than five), unless they release you from this requirement.
C. State on the Title page the name of the publisher of the Modified Version, as the
publisher.
D. Preserve all the copyright notices of the Document.
E. Add an appropriate copyright notice for your modifications adjacent to the other
copyright notices.
F. Include, immediately after the copyright notices, a license notice giving the public
permission to use the Modified Version under the terms of this License, in the form
shown in the Addendum below.
G. Preserve in that license notice the full lists of Invariant Sections and required Cover
Texts given in the Document’s license notice.
H. Include an unaltered copy of this License.
I. Preserve the section Entitled “History”, Preserve its Title, and add to it an item
stating at least the title, year, new authors, and publisher of the Modified Version
as given on the Title Page. If there is no section Entitled “History” in the Docu-
ment, create one stating the title, year, authors, and publisher of the Document
as given on its Title Page, then add an item describing the Modified Version as
stated in the previous sentence.
J. Preserve the network location, if any, given in the Document for public access to
a Transparent copy of the Document, and likewise the network locations given in
the Document for previous versions it was based on. These may be placed in the
“History” section. You may omit a network location for a work that was published
at least four years before the Document itself, or if the original publisher of the
version it refers to gives permission.
K. For any section Entitled “Acknowledgements” or “Dedications”, Preserve the Title
of the section, and preserve in the section all the substance and tone of each of the
contributor acknowledgements and/or dedications given therein.
L. Preserve all the Invariant Sections of the Document, unaltered in their text and
in their titles. Section numbers or the equivalent are not considered part of the
section titles.
M. Delete any section Entitled “Endorsements”. Such a section may not be included
in the Modified Version.
N. Do not retitle any existing section to be Entitled “Endorsements” or to conflict in
title with any Invariant Section.
O. Preserve any Warranty Disclaimers.
If the Modified Version includes new front-matter sections or appendices that qualify
as Secondary Sections and contain no material copied from the Document, you may at
your option designate some or all of these sections as invariant. To do this, add their
titles to the list of Invariant Sections in the Modified Version’s license notice. These
titles must be distinct from any other section titles.
Appendix A: The GNU Free Documentation License. 187
You may add a section Entitled “Endorsements”, provided it contains nothing but
endorsements of your Modified Version by various parties—for example, statements of
peer review or that the text has been approved by an organization as the authoritative
definition of a standard.
You may add a passage of up to five words as a Front-Cover Text, and a passage of up
to 25 words as a Back-Cover Text, to the end of the list of Cover Texts in the Modified
Version. Only one passage of Front-Cover Text and one of Back-Cover Text may be
added by (or through arrangements made by) any one entity. If the Document already
includes a cover text for the same cover, previously added by you or by arrangement
made by the same entity you are acting on behalf of, you may not add another; but
you may replace the old one, on explicit permission from the previous publisher that
added the old one.
The author(s) and publisher(s) of the Document do not by this License give permission
to use their names for publicity for or to assert or imply endorsement of any Modified
Version.
5. COMBINING DOCUMENTS
You may combine the Document with other documents released under this License,
under the terms defined in section 4 above for modified versions, provided that you
include in the combination all of the Invariant Sections of all of the original documents,
unmodified, and list them all as Invariant Sections of your combined work in its license
notice, and that you preserve all their Warranty Disclaimers.
The combined work need only contain one copy of this License, and multiple identical
Invariant Sections may be replaced with a single copy. If there are multiple Invariant
Sections with the same name but different contents, make the title of each such section
unique by adding at the end of it, in parentheses, the name of the original author or
publisher of that section if known, or else a unique number. Make the same adjustment
to the section titles in the list of Invariant Sections in the license notice of the combined
work.
In the combination, you must combine any sections Entitled “History” in the vari-
ous original documents, forming one section Entitled “History”; likewise combine any
sections Entitled “Acknowledgements”, and any sections Entitled “Dedications”. You
must delete all sections Entitled “Endorsements.”
6. COLLECTIONS OF DOCUMENTS
You may make a collection consisting of the Document and other documents released
under this License, and replace the individual copies of this License in the various
documents with a single copy that is included in the collection, provided that you
follow the rules of this License for verbatim copying of each of the documents in all
other respects.
You may extract a single document from such a collection, and distribute it individu-
ally under this License, provided you insert a copy of this License into the extracted
document, and follow this License in all other respects regarding verbatim copying of
that document.
7. AGGREGATION WITH INDEPENDENT WORKS
A compilation of the Document or its derivatives with other separate and independent
documents or works, in or on a volume of a storage or distribution medium, is called
Appendix A: The GNU Free Documentation License. 188
an “aggregate” if the copyright resulting from the compilation is not used to limit the
legal rights of the compilation’s users beyond what the individual works permit. When
the Document is included in an aggregate, this License does not apply to the other
works in the aggregate which are not themselves derivative works of the Document.
If the Cover Text requirement of section 3 is applicable to these copies of the Document,
then if the Document is less than one half of the entire aggregate, the Document’s Cover
Texts may be placed on covers that bracket the Document within the aggregate, or the
electronic equivalent of covers if the Document is in electronic form. Otherwise they
must appear on printed covers that bracket the whole aggregate.
8. TRANSLATION
Translation is considered a kind of modification, so you may distribute translations
of the Document under the terms of section 4. Replacing Invariant Sections with
translations requires special permission from their copyright holders, but you may
include translations of some or all Invariant Sections in addition to the original versions
of these Invariant Sections. You may include a translation of this License, and all the
license notices in the Document, and any Warranty Disclaimers, provided that you
also include the original English version of this License and the original versions of
those notices and disclaimers. In case of a disagreement between the translation and
the original version of this License or a notice or disclaimer, the original version will
prevail.
If a section in the Document is Entitled “Acknowledgements”, “Dedications”, or “His-
tory”, the requirement (section 4) to Preserve its Title (section 1) will typically require
changing the actual title.
9. TERMINATION
You may not copy, modify, sublicense, or distribute the Document except as expressly
provided for under this License. Any other attempt to copy, modify, sublicense or
distribute the Document is void, and will automatically terminate your rights under
this License. However, parties who have received copies, or rights, from you under this
License will not have their licenses terminated so long as such parties remain in full
compliance.
10. FUTURE REVISIONS OF THIS LICENSE
The Free Software Foundation may publish new, revised versions of the GNU Free
Documentation License from time to time. Such new versions will be similar in spirit
to the present version, but may differ in detail to address new problems or concerns.
See https://www.gnu.org/licenses/.
Each version of the License is given a distinguishing version number. If the Document
specifies that a particular numbered version of this License “or any later version”
applies to it, you have the option of following the terms and conditions either of that
specified version or of any later version that has been published (not as a draft) by
the Free Software Foundation. If the Document does not specify a version number of
this License, you may choose any version ever published (not as a draft) by the Free
Software Foundation.
Appendix A: The GNU Free Documentation License. 189
A Cortex-M . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
aarch64 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 Cortex-R . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
about . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 CPU type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
adaptive clocking . . . . . . . . . . . . . . . . . . . . . . . . . . 54, 171 CTI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
ambiqmicro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
apollo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
Architecture Specific Commands . . . . . . . . . . . . . . 131 D
ARC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 DAP declaration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
ARM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 DCC. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137, 155
ARM semihosting . . . . . . . . . . . . . . . . . . . . . . . . . 18, 136 developers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
ARM11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 directory search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
ARM7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 disassemble . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135, 146
ARM9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 dongles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
ARM920T . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 dotted name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
ARM926ej-s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
ARM966E . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
ARMv4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
ARMv5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
E
ARMv6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 ETB. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
ARMv7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 ETM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131, 145
ARMv8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 event, reset-init . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
ARMv8-A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58, 63, 75
at91sam3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
at91sam4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
at91sam4l. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
at91samd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
F
ath79 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 faq . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
Atheros ath79 SPI driver . . . . . . . . . . . . . . . . . . . . . . . 87 fespi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
atsame5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 Firmware recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
atsamv . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 flash configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
autoprobe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 flash erasing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
flash programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
flash protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
B flash reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
board config file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 flash writing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
breakpoint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 FPGA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
bscan spi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 Freedom E SPI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
FTDI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
C
CFI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 G
command line options . . . . . . . . . . . . . . . . . . . . . . . . . . 12 GDB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34, 163
commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 GDB configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Common Flash Interface . . . . . . . . . . . . . . . . . . . . . . . 82 GDB server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
config command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 GDB target . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
config file, board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Generic JTAG2SPI driver . . . . . . . . . . . . . . . . . . . . . . 83
config file, interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
config file, overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
config file, target . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 H
config file, user . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
configuration stage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 halt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
Connecting to GDB . . . . . . . . . . . . . . . . . . . . . . . . . . . 163 hwthread . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
Core Specific Commands . . . . . . . . . . . . . . . . . . . . . . 131
Cortex-A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
OpenOCD Concept Index 191
I P
image dumping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 PLD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
image loading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 port . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
init board procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 printer port . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
init target events procedure . . . . . . . . . . . . . . . . . . . . 29 profiling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
init targets procedure . . . . . . . . . . . . . . . . . . . . . . . . . . 29 Programming using GDB . . . . . . . . . . . . . . . . . . . . . 165
initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
interface config file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
IPDBG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
IPDBG JTAG-Host server . . . . . . . . . . . . . . . . . . . . 161 Q
ITM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 QuadSPI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
J
Jim-Tcl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
R
jrc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 RAM testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
JTAG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1, 53 reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
JTAG autoprobe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 Reset Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
JTAG Commands. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 reset-init handler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
JTAG Route Controller . . . . . . . . . . . . . . . . . . . . . . . . 64 RPC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
jtagspi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 RPC Notifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
RPC trace output . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
RTCK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5, 54, 171
K RTOS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
kinetis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 RTOS Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
kinetis ke . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
L S
libdcc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 scan chain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Linux-ARM DCC support . . . . . . . . . . . . . . . . . . . . 155 security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
logfile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Serial Peripheral Interface . . . . . . . . . . . . . . . . . . . . . . 53
lpcspifi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 Serial Vector Format . . . . . . . . . . . . . . . . . . . . . . . . . . 160
Serial Wire Debug . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
M Single Wire Interface Module. . . . . . . . . . . . . . . . . . . 53
SMI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
memory access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126 SMP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27, 167
message level . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
SPI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53, 83
SPIFI. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
STMicroelectronics
N QuadSPI/OctoSPI Interface . . . . . . . . . . . . . . . . . 85
NAND . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 STMicroelectronics Serial Memory Interface . . . . 85
NAND configuration . . . . . . . . . . . . . . . . . . . . . . . . . . 114 stmqspi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
NAND erasing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 stmsmi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
NAND other commands . . . . . . . . . . . . . . . . . . . . . . 117 str9xpec . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
NAND programming . . . . . . . . . . . . . . . . . . . . . 116, 117 SVF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
NAND reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 SWD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
NAND verification . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 SWD multi-drop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
NAND writing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 SWIM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
NXP SPI Flash Interface . . . . . . . . . . . . . . . . . . . . . . . 85 swm050. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
SWO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142, 145
SWV . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142, 145
O
object command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
OctoSPI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
OpenOCD Concept Index 192
T U
USB Adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
TAP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
user config file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
TAP configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 Using GDB as a non-intrusive
TAP declaration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 memory inspector . . . . . . . . . . . . . . . . . . . . . . . . . . 165
TAP events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 Utility Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
TAP naming convention . . . . . . . . . . . . . . . . . . . . . . . 61
TAP state names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
target config file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
V
target events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 variable names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
vector catch . . . . . . . . . . . . . . . . 17, 137, 140, 141, 146
target initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
vector table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
target type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
target, current . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
target, list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 W
Tcl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 watchpoint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
tcl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 wiggler. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Tcl Scripting API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
Tcl scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169 X
TCP port . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
xcf. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
TPIU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
Xilinx Platform flash driver . . . . . . . . . . . . . . . . . . . . 84
tracing . . . . . . . . . . . . . . . . . . . . . . . . . 131, 142, 145, 155 Xilinx Serial Vector Format . . . . . . . . . . . . . . . . . . . 160
translation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 XScale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
Transport . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 XSVF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
193
$ adapter name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
$cti_name ack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 adapter serial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
$cti_name channel . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 adapter speed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
$cti_name dump . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 adapter srst delay. . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
$cti_name enable . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134 adapter srst pulse_width . . . . . . . . . . . . . . . . . . . . . 56
$cti_name read . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 adapter transports . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
$cti_name testmode . . . . . . . . . . . . . . . . . . . . . . . . . . 135 adapter usb location . . . . . . . . . . . . . . . . . . . . . . . . . 36
$cti_name write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 add_help_text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
$dap_name apcsw. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 add_script_search_dir . . . . . . . . . . . . . . . . . . . . . . 124
$dap_name apid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 add_usage_text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
$dap_name apreg. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 addreg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
$dap_name apsel. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 aduc702x . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
$dap_name baseaddr . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 ambiqmicro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
$dap_name dpreg. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 ambiqmicro mass_erase . . . . . . . . . . . . . . . . . . . . . . . . 88
$dap_name info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 ambiqmicro page_erase . . . . . . . . . . . . . . . . . . . . . . . . 88
$dap_name memaccess . . . . . . . . . . . . . . . . . . . . . . . . . . 67 ambiqmicro program_otp. . . . . . . . . . . . . . . . . . . . . . . 88
$dap_name ti_be_32_quirks . . . . . . . . . . . . . . . . . . . 67 amt_jtagaccel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
arc add-reg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
$target_name arp_examine . . . . . . . . . . . . . . . . . . . . 73
arc add-reg-type-flags . . . . . . . . . . . . . . . . . . . . . 154
$target_name arp_halt . . . . . . . . . . . . . . . . . . . . . . . . 73
arc add-reg-type-struct . . . . . . . . . . . . . . . . . . . . 154
$target_name arp_poll . . . . . . . . . . . . . . . . . . . . . . . . 73
arc get-reg-field . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
$target_name arp_reset. . . . . . . . . . . . . . . . . . . . . . . 73
arc jtag get-aux-reg . . . . . . . . . . . . . . . . . . . . . . . . 155
$target_name arp_waitstate . . . . . . . . . . . . . . . . . . 73
arc jtag get-core-reg . . . . . . . . . . . . . . . . . . . . . . . 155
$target_name array2mem. . . . . . . . . . . . . . . . . . . . . . . 73
arc jtag set-aux-reg . . . . . . . . . . . . . . . . . . . . . . . . 154
$target_name catch_exc . . . . . . . . . . . . . . . . . . . . . 147
arc jtag set-core-reg . . . . . . . . . . . . . . . . . . . . . . . 154
$target_name cget . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
arc set-reg-exists . . . . . . . . . . . . . . . . . . . . . . . . . . 154
$target_name configure. . . . . . . . . . . . . . . . . . . . . . . 71
arm core_state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
$target_name curstate . . . . . . . . . . . . . . . . . . . . . . . . 74
arm disassemble . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
$target_name eventlist. . . . . . . . . . . . . . . . . . . . . . . 74
arm mcr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
$target_name invoke-event . . . . . . . . . . . . . . . . . . . 74
arm mrc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
$target_name mdb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
arm reg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
$target_name mdd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
arm semihosting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
$target_name mdh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
arm semihosting_cmdline . . . . . . . . . . . . . . . . . . . . 136
$target_name mdw . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
arm semihosting_fileio . . . . . . . . . . . . . . . . . . . . . 136
$target_name mem2array. . . . . . . . . . . . . . . . . . . . . . . 73
arm semihosting_resexit . . . . . . . . . . . . . . . . . . . . 136
$target_name mwb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
arm-jtag-ew . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
$target_name mwd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
arm11 memwrite burst . . . . . . . . . . . . . . . . . . . . . . . . 141
$target_name mwh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
arm11 memwrite error_fatal . . . . . . . . . . . . . . . . . 141
$target_name mww . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
arm11 step_irq_enable. . . . . . . . . . . . . . . . . . . . . . . 141
$tpiu_name cget . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
arm11 vcr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
$tpiu_name configure . . . . . . . . . . . . . . . . . . . . . . . . 143
arm7_9 dbgrq . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
$tpiu_name disable . . . . . . . . . . . . . . . . . . . . . . . . . . 144
arm7_9 dcc_downloads . . . . . . . . . . . . . . . . . . . . . . . . 137
$tpiu_name enable . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
arm7_9 fast_memory_access . . . . . . . . . . . . . . . . . . 137
arm9 vector_catch . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
arm920t cache_info . . . . . . . . . . . . . . . . . . . . . . . . . . 138
A arm920t cp15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
aarch64 cache_info . . . . . . . . . . . . . . . . . . . . . . . . . . 146 arm920t read_cache . . . . . . . . . . . . . . . . . . . . . . . . . . 138
aarch64 dbginit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 arm920t read_mmu . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
aarch64 disassemble . . . . . . . . . . . . . . . . . . . . . . . . . 146 arm926ejs cache_info . . . . . . . . . . . . . . . . . . . . . . . . 138
aarch64 maskisr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 arm966e cp15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
aarch64 smp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 armjtagew_info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
adapter assert . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126 at91rm9200 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
adapter deassert . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126 at91sam3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
adapter driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 at91sam3 gpnvm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
adapter list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 at91sam3 gpnvm clear . . . . . . . . . . . . . . . . . . . . . . . . . 90
Command and Driver Index 194
J L
jlink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 linuxgpiod . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
jlink config . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 load_image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
jlink config ip . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 log_output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
jlink config mac . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 lpc2000 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
jlink config reset. . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 lpc2000 part_id. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
jlink config targetpower . . . . . . . . . . . . . . . . . . . . . 43 lpc288x . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
jlink config usb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 lpc2900 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
jlink config write. . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 lpc2900 password . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
jlink emucom read . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 lpc2900 read_custom . . . . . . . . . . . . . . . . . . . . . . . . . . 98
jlink emucom write. . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 lpc2900 secure_jtag . . . . . . . . . . . . . . . . . . . . . . . . . . 99
jlink freemem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 lpc2900 secure_sector . . . . . . . . . . . . . . . . . . . . . . . . 99
jlink hwstatus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 lpc2900 signature . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
jlink jtag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 lpc2900 write_custom . . . . . . . . . . . . . . . . . . . . . . . . . 98
jlink usb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 lpc3180 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
jtag arp_init . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 lpc3180 select . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
jtag arp_init-reset . . . . . . . . . . . . . . . . . . . . . . . . . . 59 lpcspifi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
jtag cget . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
jtag configure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
jtag names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 M
jtag newtap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 mdb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
jtag tapdisable. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 mdd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
jtag tapenable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 mdh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
jtag tapisenabled . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 mdr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
jtag_dpi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 mdw . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
jtag_dpi set_address . . . . . . . . . . . . . . . . . . . . . . . . . 51 memTestAddressBus . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
jtag_dpi set_port . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 memTestDataBus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
jtag_init . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 memTestDevice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
jtag_ntrst_assert_width . . . . . . . . . . . . . . . . . . . . . 57 mrvlqspi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
jtag_ntrst_delay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 msp432 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
jtag_rclk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 msp432 bsl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
jtagspi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 msp432 mass_erase . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
jtagspi always_4byte . . . . . . . . . . . . . . . . . . . . . . . . . 84 mwb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
jtagspi cmd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 mwd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
jtagspi set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 mwh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
mww . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
mx3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
K mxc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
mxc biswap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
kinetis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
kinetis create_banks . . . . . . . . . . . . . . . . . . . . . . . . . 95
kinetis disable_wdog . . . . . . . . . . . . . . . . . . . . . . . . . 96 N
kinetis fcf_source . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
nand check_bad_blocks. . . . . . . . . . . . . . . . . . . . . . . 117
kinetis fopt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
nand device . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
kinetis mdm check_security . . . . . . . . . . . . . . . . . . 95
nand dump . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
kinetis mdm halt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
nand erase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
kinetis mdm mass_erase . . . . . . . . . . . . . . . . . . . . . . . 95
nand info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
kinetis mdm reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
nand list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
kinetis nvm_partition . . . . . . . . . . . . . . . . . . . . . . . . 96
nand probe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
kinetis_ke . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
nand raw_access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
kinetis_ke disable_wdog . . . . . . . . . . . . . . . . . . . . . 97
nand verify . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
kinetis_ke mdm check_security . . . . . . . . . . . . . . . 96
nand write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
kinetis_ke mdm mass_erase . . . . . . . . . . . . . . . . . . . 96
niietcm4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
kitprog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 niietcm4 bflash_info_remap . . . . . . . . . . . . . . . . . 101
kitprog acquire_psoc . . . . . . . . . . . . . . . . . . . . . . . . . 45 niietcm4 driver_info . . . . . . . . . . . . . . . . . . . . . . . . 101
kitprog info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 niietcm4 extmem_cfg . . . . . . . . . . . . . . . . . . . . . . . . . 101
kitprog_init_acquire_psoc . . . . . . . . . . . . . . . . . . . 45 niietcm4 service_mode_erase . . . . . . . . . . . . . . . . 101
niietcm4 uflash_erase. . . . . . . . . . . . . . . . . . . . . . . 101
Command and Driver Index 197
V xcf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
verify_image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 xcf ccb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
verify_image_checksum . . . . . . . . . . . . . . . . . . . . . . 128 xcf configure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
verify_ircapture . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158 xds110. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
verify_jtag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158 xds110 info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 xds110 supply . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
virt2phys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 xlnx_pcie_xvc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
virtex2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122 xlnx_pcie_xvc config . . . . . . . . . . . . . . . . . . . . . . . . . 49
virtex2 read_stat . . . . . . . . . . . . . . . . . . . . . . . . . . . 122 xmc1xxx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
virtual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 xmc4xxx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
vsllink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 xmc4xxx flash_password . . . . . . . . . . . . . . . . . . . . . 113
xmc4xxx flash_unprotect . . . . . . . . . . . . . . . . . . . . 113
xscale analyze_trace . . . . . . . . . . . . . . . . . . . . . . . . 140
W xscale cache_clean_address . . . . . . . . . . . . . . . . . 140
w600 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 xscale cache_info . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
wait_halt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 xscale cp15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
wp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 xscale dcache . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
xscale debug_handler . . . . . . . . . . . . . . . . . . . . . . . . 140
xscale dump_trace . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
X xscale icache . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
x86_32 idb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150 xscale mmu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
x86_32 idh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150 xscale trace_buffer . . . . . . . . . . . . . . . . . . . . . . . . . 140
x86_32 idw . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150 xscale trace_image . . . . . . . . . . . . . . . . . . . . . . . . . . 140
x86_32 iwb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150 xscale vector_catch . . . . . . . . . . . . . . . . . . . . . . . . . 140
x86_32 iwh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150 xscale vector_table . . . . . . . . . . . . . . . . . . . . . . . . . 141
x86_32 iww . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150 xsvf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160