Nicolas Pitre listed some more devices.
[fw/openocd] / doc / openocd.texi
1 \input texinfo  @c -*-texinfo-*-\r
2 @c %**start of header\r
3 @setfilename openocd.info\r
4 @settitle Open On-Chip Debugger (openocd)\r
5 @c %**end of header\r
6 \r
7 @include version.texi\r
8 \r
9 @titlepage\r
10 @title Open On-Chip Debugger (openocd)\r
11 @subtitle Edition @value{EDITION} for openocd version @value{VERSION}\r
12 @subtitle @value{UPDATED}\r
13 @page\r
14 @vskip 0pt plus 1filll\r
15 @end titlepage\r
16 \r
17 @contents\r
18 \r
19 @node Top, About, , (dir)\r
20 @top OpenOCD\r
21 \r
22 This is edition @value{EDITION} of the openocd manual for version\r
23 @value{VERSION}, @value{UPDATED}\r
24 \r
25 @menu\r
26 * About::             About Openocd.\r
27 * Developers::        \r
28 * Building::          Building Openocd\r
29 * Running::           Running Openocd\r
30 * Configuration::     Openocd Configuration.\r
31 * Commands::          Openocd Commands\r
32 * Sample Scripts::    Sample Target Scripts\r
33 * GDB and Openocd::   Using GDB and Openocd\r
34 * FAQ::               Frequently Asked Questions\r
35 * License::           GNU Free Documentation License\r
36 * Index::             Main index.\r
37 @end menu\r
38 \r
39 @node About\r
40 @unnumbered About\r
41 @cindex about\r
42 \r
43 The Open On-Chip Debugger (openocd) aims to provide debugging, in-system programming\r
44 and boundary-scan testing for embedded target devices. The targets are interfaced\r
45 using JTAG (IEEE 1149.1) compliant hardware, but this may be extended to other\r
46 connection types in the future.\r
47 \r
48 Openocd currently supports Wiggler (clones), FTDI FT2232 based JTAG interfaces, the\r
49 Amontec JTAG Accelerator, and the Gateworks GW1602. It allows ARM7 (ARM7TDMI and ARM720t),\r
50 ARM9 (ARM920t, ARM922t, ARM926ej--s, ARM966e--s), XScale (PXA25x, IXP42x) and\r
51 Cortex-M3 (Luminary Stellaris LM3 and ST STM32) based cores to be debugged.\r
52 \r
53 Flash writing is supported for external CFI compatible flashes (Intel and AMD/Spansion\r
54 command set) and several internal flashes (LPC2000, AT91SAM7, STR7x, STR9x, LM3\r
55 and STM32x). Preliminary support for using the LPC3180's NAND flash controller is included.\r
56 \r
57 @node Developers\r
58 @chapter Developers\r
59 @cindex developers\r
60 \r
61 Openocd has been created by Dominic Rath as part of a diploma thesis written at the\r
62 University of Applied Sciences Augsburg (@uref{http://www.fh-augsburg.de}).\r
63 Others interested in improving the state of free and open debug and testing technology\r
64 are welcome to participate.\r
65 \r
66 Other developers have contributed support for additional targets and flashes as well\r
67 as numerous bugfixes and enhancements. See the AUTHORS file for regular contributors. \r
68 \r
69 @node Building\r
70 @chapter Building\r
71 @cindex building openocd\r
72 \r
73 You can download the current SVN version with SVN client of your choice from the\r
74 following repositories:\r
75 \r
76  (@uref{svn://svn.berlios.de/openocd/trunk})\r
77 \r
78 or\r
79 \r
80  (@uref{http://svn.berlios.de/svnroot/repos/openocd/trunk})\r
81 \r
82 Using the SVN command line client, you could use the following command to fetch the\r
83 latest version (make sure there is no (non-svn) directory called "openocd" in the\r
84 current directory):\r
85 \r
86 @smallexample\r
87  svn checkout svn://svn.berlios.de/openocd/trunk\r
88 @end smallexample\r
89 \r
90 Building the OpenOCD requires a recent version of the GNU autotools.\r
91 On my build system, I'm using autoconf 2.13 and automake 1.9. For building on Windows,\r
92 you have to use Cygwin. Make sure that your @env{PATH} environment variable contains no\r
93 other locations with Unix utils (like UnxUtils) - these can't handle the Cygwin\r
94 paths, resulting in obscure dependency errors (This is an observation I've gathered\r
95 from the logs of one user - correct me if I'm wrong).\r
96 \r
97 You further need the appropriate driver files, if you want to build support for\r
98 a FTDI FT2232 based interface:\r
99 @itemize @bullet\r
100 @item @b{ftdi2232} libftdi (@uref{http://www.intra2net.com/opensource/ftdi/})\r
101 @item @b{ftd2xx} libftd2xx (@uref{http://www.ftdichip.com/Drivers/D2XX.htm})\r
102 @item When using the Amontec JTAGkey, you have to get the drivers from the Amontec\r
103 homepage (@uref{www.amontec.com}), as the JTAGkey uses a non-standard VID/PID. \r
104 @end itemize\r
105 \r
106 Please note that the ftdi2232 variant (using libftdi) isn't supported under Cygwin.\r
107 You have to use the ftd2xx variant (using FTDI's D2XX) on Cygwin.\r
108 \r
109 In general, the D2XX driver provides superior performance (several times as fast),\r
110 but has the draw-back of being binary-only - though that isn't as worse, as it isn't\r
111 a kernel module, only a user space library.\r
112 \r
113 To build OpenOCD (on both Linux and Cygwin), use the following commands:\r
114 @smallexample\r
115  ./bootstrap \r
116 @end smallexample\r
117 Bootstrap generates the configure script, and prepares building on your system.\r
118 @smallexample\r
119  ./configure \r
120 @end smallexample\r
121 Configure generates the Makefiles used to build OpenOCD\r
122 @smallexample\r
123  make \r
124 @end smallexample\r
125 Make builds the OpenOCD, and places the final executable in ./src/\r
126 \r
127 The configure script takes several options, specifying which JTAG interfaces\r
128 should be included:\r
129 \r
130 @itemize @bullet\r
131 @item\r
132 --enable-parport\r
133 @item\r
134 --enable-parport_ppdev\r
135 @item\r
136 --enable-amtjtagaccel\r
137 @item\r
138 --enable-ft2232_ftd2xx\r
139 @footnote{Using the latest D2XX drivers from FTDI and following their installation\r
140 instructions, I had to use @option{--enable-ft2232_libftd2xx} for the OpenOCD to\r
141 build properly}\r
142 @item\r
143 --enable-ft2232_libftdi\r
144 @item\r
145 --with-ftd2xx=/path/to/d2xx/\r
146 @end itemize\r
147 \r
148 If you want to access the parallel port using the PPDEV interface you have to specify\r
149 both the @option{--enable-parport} AND the @option{--enable-parport_ppdev} option since\r
150 the @option{--enable-parport_ppdev} option actually is an option to the parport driver\r
151 (see @uref{http://forum.sparkfun.com/viewtopic.php?t=3795} for more info).\r
152 \r
153 Cygwin users have to specify the location of the FTDI D2XX package. This should be an\r
154 absolute path containing no spaces.\r
155 \r
156 Linux users should copy the various parts of the D2XX package to the appropriate\r
157 locations, i.e. /usr/include, /usr/lib. \r
158 \r
159 @node Running\r
160 @chapter Running\r
161 @cindex running openocd\r
162 @cindex --configfile\r
163 @cindex --debug_level\r
164 @cindex --logfile\r
165 @cindex --search\r
166 The OpenOCD runs as a daemon, waiting for connections from clients (Telnet or GDB).\r
167 Run with @option{--help} or @option{-h} to view the available command line arguments.\r
168 \r
169 It reads its configuration by default from the file openocd.cfg located in the current\r
170 working directory. This may be overwritten with the @option{-f <configfile>} command line\r
171 switch.\r
172 \r
173 To enable debug output (when reporting problems or working on OpenOCD itself), use\r
174 the @option{-d} command line switch. This sets the debug_level to "3", outputting\r
175 the most information, including debug messages. The default setting is "2", outputting\r
176 only informational messages, warnings and errors. You can also change this setting\r
177 from within a telnet or gdb session (@option{debug_level <n>}).\r
178 \r
179 You can redirect all output from the daemon to a file using the @option{-l <logfile>} switch.\r
180 \r
181 Search paths for config/script files can be added to openocd by using\r
182 the @option{-s <search>} switch.\r
183 \r
184 @node Configuration\r
185 @chapter Configuration\r
186 @cindex configuration\r
187 The Open On-Chip Debugger (OpenOCD) runs as a daemon, and reads it current configuration\r
188 by default from the file openocd.cfg in the current directory. A different configuration\r
189 file can be specified with the  @option{-f <conf.file>} given at the openocd command line.\r
190 \r
191 The configuration file is used to specify on which ports the daemon listens for new\r
192 connections, the JTAG interface used to connect to the target, the layout of the JTAG\r
193 chain, the targets that should be debugged, and connected flashes.\r
194 \r
195 @section Daemon configuration\r
196 \r
197 @itemize @bullet\r
198 @item @b{telnet_port} <@var{number}>\r
199 @cindex telnet_port\r
200 Port on which to listen for incoming telnet connections \r
201 @item @b{gdb_port} <@var{number}>\r
202 @cindex gdb_port\r
203 First port on which to listen for incoming GDB connections. The GDB port for the\r
204 first target will be gdb_port, the second target will listen on gdb_port + 1, and so on. \r
205 @item @b{gdb_detach} <@var{resume|reset|halt|nothing}>\r
206 @cindex gdb_detach\r
207 Configures what openocd will do when gdb detaches from the daeman.\r
208 Default behaviour is <@var{resume}>\r
209 @item @b{gdb_memory_map} <@var{enable|disable}>\r
210 @cindex gdb_memory_map\r
211 Set to <@var{enable}> so that openocd will send the memory configuration to gdb when\r
212 requested. gdb will then know when to set hardware breakpoints, and program flash\r
213 using the gdb load command. @option{gdb_flash_program enable} will also need enabling\r
214 for flash programming to work.\r
215 Default behaviour is <@var{disable}>\r
216 @item @b{gdb_flash_program} <@var{enable|disable}>\r
217 @cindex gdb_flash_program\r
218 Set to <@var{enable}> so that openocd will program the flash memory when a\r
219 vFlash packet is received.\r
220 Default behaviour is <@var{disable}>\r
221 @item @b{daemon_startup} <@var{mode}> either @samp{attach} or @samp{reset}\r
222 @cindex daemon_startup\r
223 Tells the OpenOCD whether it should reset the target when the daemon is launched, or\r
224 if it should just attach to the target. \r
225 @end itemize\r
226 \r
227 @section JTAG interface configuration\r
228 \r
229 @itemize @bullet\r
230 @item @b{interface} <@var{name}>\r
231 @cindex interface\r
232 Use the interface driver <@var{name}> to connect to the target. Currently supported\r
233 interfaces are\r
234 @itemize @minus\r
235 @item parport\r
236 PC parallel port bit-banging (Wigglers, PLD download cable, ...)\r
237 @end itemize\r
238 @itemize @minus\r
239 @item amt_jtagaccel\r
240 Amontec Chameleon in its JTAG Accelerator configuration connected to a PC's EPP\r
241 mode parallel port\r
242 @end itemize\r
243 @itemize @minus\r
244 @item ft2232\r
245 FTDI FT2232 based devices using either the open-source libftdi or the binary only\r
246 FTD2XX driver. The FTD2XX is superior in performance, but not available on every\r
247 platform. The libftdi uses libusb, and should be portable to all systems that provide\r
248 libusb.\r
249 @end itemize\r
250 @itemize @minus\r
251 @item ep93xx\r
252 Cirrus Logic EP93xx based single-board computer bit-banging (in development)\r
253 @end itemize\r
254 @end itemize\r
255 \r
256 @itemize @bullet\r
257 @item @b{jtag_speed} <@var{number}>\r
258 @cindex jtag_speed\r
259 Limit the maximum speed of the JTAG interface. Usually, a value of zero means maximum\r
260 speed. The actual effect of this option depends on the JTAG interface used.\r
261 \r
262 @itemize @minus\r
263 @item wiggler: maximum speed / @var{number}\r
264 @item ft2232: 6MHz / (@var{number}+1)\r
265 @item amt jtagaccel: 8 / 2**@var{number}\r
266 @end itemize\r
267 \r
268 Note: Make sure the jtag clock is no more than @math{1/6th Ã— CPU-Clock}. This is\r
269 especially true for synthesized cores (-S).\r
270 \r
271 @item @b{reset_config} <@var{signals}> [@var{combination}] [@var{trst_type}] [@var{srst_type}]\r
272 @cindex reset_config\r
273 The configuration of the reset signals available on the JTAG interface AND the target.\r
274 If the JTAG interface provides SRST, but the target doesn't connect that signal properly,\r
275 then OpenOCD can't use it. <@var{signals}> can be @samp{none}, @samp{trst_only},\r
276 @samp{srst_only} or @samp{trst_and_srst}.\r
277 [@var{combination}] is an optional value specifying broken reset signal implementations.\r
278 @samp{srst_pulls_trst} states that the testlogic is reset together with the reset of\r
279 the system (e.g. Philips LPC2000, "broken" board layout), @samp{trst_pulls_srst} says\r
280 that the system is reset together with the test logic (only hypothetical, I haven't\r
281 seen hardware with such a bug, and can be worked around).\r
282 \r
283 The [@var{trst_type}] and [@var{srst_type}] parameters allow the driver type of the\r
284 reset lines to be specified. Possible values are @samp{trst_push_pull} (default)\r
285 and @samp{trst_open_drain} for the test reset signal, and @samp{srst_open_drain}\r
286 (default) and @samp{srst_push_pull} for the system reset. These values only affect\r
287 JTAG interfaces with support for different drivers, like the Amontec JTAGkey and JTAGAccelerator. \r
288 \r
289 @item @b{jtag_device} <@var{IR length}> <@var{IR capture}> <@var{IR mask}> <@var{IDCODE instruction}>\r
290 @cindex jtag_device\r
291 Describes the devices that form the JTAG daisy chain, with the first device being\r
292 the one closest to TDO. The parameters are the length of the instruction register\r
293 (4 for all ARM7/9s), the value captured during Capture-IR (0x1 for ARM7/9), and a mask\r
294 of bits that should be validated when doing IR scans (all four bits (0xf) for ARM7/9).\r
295 The IDCODE instruction will in future be used to query devices for their JTAG\r
296 identification code. This line is the same for all ARM7 and ARM9 devices.\r
297 Other devices, like CPLDs, require different parameters. An example configuration\r
298 line for a Xilinx XC9500 CPLD would look like this:\r
299 @smallexample\r
300 jtag_device 8 0x01 0x0e3 0xfe\r
301 @end smallexample\r
302 The instruction register (IR) is 8 bits long, during Capture-IR 0x01 is loaded into\r
303 the IR, but only bits 0-1 and 5-7 should be checked, the others (2-4) might vary.\r
304 The IDCODE instruction is 0xfe.\r
305 \r
306 @item @b{jtag_nsrst_delay} <@var{ms}>\r
307 @cindex jtag_nsrst_delay\r
308 How long (in miliseconds) the OpenOCD should wait after deasserting nSRST before\r
309 starting new JTAG operations. \r
310 @item @b{jtag_ntrst_delay} <@var{ms}>\r
311 @cindex jtag_ntrst_delay\r
312 How long (in miliseconds) the OpenOCD should wait after deasserting nTRST before\r
313 starting new JTAG operations. \r
314 \r
315 The jtag_n[st]rst_delay options are useful if reset circuitry (like a reset supervisor,\r
316 or on-chip features) keep a reset line asserted for some time after the external reset\r
317 got deasserted.\r
318 @end itemize\r
319 \r
320 @section parport options\r
321 \r
322 @itemize @bullet\r
323 @item @b{parport_port} <@var{number}>\r
324 @cindex parport_port\r
325 Either the address of the I/O port (default: 0x378 for LPT1) or the number of\r
326 the @file{/dev/parport} device\r
327 \r
328 When using PPDEV to access the parallel port, use the number of the parallel port:\r
329 @option{parport_port 0} (the default). If @option{parport_port 0x378} is specified\r
330 you may encounter a problem.\r
331 @item @b{parport_cable} <@var{name}>\r
332 @cindex parport_cable\r
333 The layout of the parallel port cable used to connect to the target.\r
334 Currently supported cables are \r
335 @itemize @minus\r
336 @item wiggler\r
337 @cindex wiggler\r
338 Original Wiggler layout, also supported by several clones, such\r
339 as the Olimex ARM-JTAG\r
340 @item old_amt_wiggler\r
341 @cindex old_amt_wiggler\r
342 The Wiggler configuration that comes with Amontec's Chameleon Programmer. The new\r
343 version available from the website uses the original Wiggler layout ('@var{wiggler}')\r
344 @item chameleon\r
345 @cindex chameleon\r
346 Describes the connection of the Amontec Chameleon's CPLD when operated in\r
347 configuration mode. This is only used to program the Chameleon itself, not\r
348 a connected target.\r
349 @item dlc5\r
350 @cindex dlc5\r
351 Xilinx Parallel cable III.\r
352 @item triton\r
353 @cindex triton\r
354 The parallel port adapter found on the 'Karo Triton 1 Development Board'.\r
355 This is also the layout used by the HollyGates design\r
356 (see @uref{http://www.lartmaker.nl/projects/jtag/}).\r
357 @item flashlink\r
358 @cindex flashlink\r
359 ST Parallel cable. \r
360 @end itemize\r
361 @item @b{parport_write_on_exit} <@var{on|off}>\r
362 @cindex parport_write_on_exit\r
363 This will configure the parallel driver to write a known value to the parallel\r
364 interface on exiting openocd\r
365 @end itemize\r
366 \r
367 @section amt_jtagaccel options\r
368 @itemize @bullet\r
369 @item @b{parport_port} <@var{number}>\r
370 @cindex parport_port\r
371 Either the address of the I/O port (default: 0x378 for LPT1) or the number of the\r
372 @file{/dev/parport} device \r
373 @end itemize\r
374 @section ft2232 options\r
375 \r
376 @itemize @bullet\r
377 @item @b{ft2232_device_desc} <@var{description}>\r
378 @cindex ft2232_device_desc\r
379 The USB device description of the FTDI FT2232 device. If not specified, the FTDI\r
380 default value is used. This setting is only valid if compiled with FTD2XX support.\r
381 @item @b{ft2232_layout} <@var{name}>\r
382 @cindex ft2232_layout\r
383 The layout of the FT2232 GPIO signals used to control output-enables and reset\r
384 signals. Valid layouts are\r
385 @itemize @minus\r
386 @item usbjtag\r
387 The "USBJTAG-1" layout described in the original OpenOCD diploma thesis\r
388 @item jtagkey\r
389 Amontec JTAGkey and JTAGkey-tiny\r
390 @item signalyzer\r
391 Signalyzer\r
392 @item olimex-jtag\r
393 Olimex ARM-USB-OCD\r
394 @item m5960\r
395 American Microsystems M5960\r
396 @item evb_lm3s811\r
397 Luminary Micro EVB_LM3S811 as a JTAG interface (not onboard processor), no TRST or\r
398 SRST signals on external connector\r
399 @item comstick\r
400 Hitex STR9 comstick \r
401 @item stm32stick\r
402 Hitex STM32 Performance Stick\r
403 @item flyswatter\r
404 Tin Can Tools Flyswatter\r
405 @item turtelizer2\r
406 egnite Software turtelizer2\r
407 @item oocdlink\r
408 OOCDLink\r
409 @end itemize\r
410 \r
411 @item @b{ft2232_vid_pid} <@var{vid}> <@var{pid}>\r
412 The vendor ID and product ID of the FTDI FT2232 device. If not specified, the FTDI\r
413 default values are used. This command is not available on Windows. \r
414 @item @b{ft2232_latency} <@var{ms}>\r
415 On some systems using ft2232 based JTAG interfaces the FT_Read function call in\r
416 ft2232_read() fails to return the expected number of bytes. This can be caused by\r
417 USB communication delays and has proved hard to reproduce and debug. Setting the\r
418 FT2232 latency timer to a larger value increases delays for short USB packages but it\r
419 also reduces the risk of timeouts before receiving the expected number of bytes.\r
420 The OpenOCD default value is 2 and for some systems a value of 10 has proved useful. \r
421 @end itemize\r
422 \r
423 @section ep93xx options\r
424 @cindex ep93xx options\r
425 Currently, there are no options available for the ep93xx interface.\r
426 \r
427 @page\r
428 @section Target configuration\r
429 \r
430 @itemize @bullet\r
431 @item @b{target} <@var{type}> <@var{endianess}> <@var{reset_mode}> <@var{JTAG pos}>\r
432 <@var{variant}>\r
433 @cindex target\r
434 Defines a target that should be debugged. Currently supported types are:\r
435 @itemize @minus\r
436 @item arm7tdmi\r
437 @item arm720t\r
438 @item arm9tdmi\r
439 @item arm920t\r
440 @item arm922t\r
441 @item arm926ejs\r
442 @item arm966e\r
443 @item cortex_m3\r
444 @item feroceon \r
445 @item xscale \r
446 @end itemize\r
447 \r
448 If you want to use a target board that is not on this list, see Adding a new\r
449 target board\r
450 \r
451 Endianess may be @option{little} or @option{big}.\r
452 \r
453 The reset_mode specifies what should happen to the target when a reset occurs:\r
454 @itemize @minus\r
455 @item reset_halt\r
456 @cindex reset_halt\r
457 Immediately request a target halt after reset. This allows targets to be debugged\r
458 from the very first instruction. This is only possible with targets and JTAG\r
459 interfaces that correctly implement the reset signals.\r
460 @item reset_init\r
461 @cindex reset_init\r
462 Similar to @option{reset_halt}, but executes the script file defined to handle the\r
463 'reset' event for the target. Like @option{reset_halt} this only works with\r
464 correct reset implementations.\r
465 @item reset_run\r
466 @cindex reset_run\r
467 Simply let the target run after a reset.\r
468 @item run_and_halt\r
469 @cindex run_and_halt\r
470 Let the target run for some time (default: 1s), and then request halt.\r
471 @item run_and_init\r
472 @cindex run_and_init\r
473 A combination of @option{reset_init} and @option{run_and_halt}. The target is allowed\r
474 to run for some time, then halted, and the @option{reset} event script is executed. \r
475 @end itemize\r
476 \r
477 On JTAG interfaces / targets where system reset and test-logic reset can't be driven\r
478 completely independent (like the LPC2000 series), or where the JTAG interface is\r
479 unavailable for some time during startup (like the STR7 series), you can't use\r
480 @option{reset_halt} or @option{reset_init}.\r
481 \r
482 @item @b{target_script} <@var{target#}> <@var{event}> <@var{script_file}>\r
483 @cindex target_script\r
484 Event is either @option{reset}, @option{post_halt}, @option{pre_resume} or @option{gdb_program_config}\r
485 \r
486 TODO: describe exact semantic of events\r
487 @item @b{run_and_halt_time} <@var{target#}> <@var{time_in_ms}>\r
488 @cindex run_and_halt_time\r
489 The amount of time the debugger should wait after releasing reset before it asserts\r
490 a debug request. This is used by the @option{run_and_halt} and @option{run_and_init}\r
491 reset modes. \r
492 @item @b{working_area} <@var{target#}> <@var{address}> <@var{size}>\r
493 <@var{backup}|@var{nobackup}>\r
494 @cindex working_area\r
495 Specifies a working area for the debugger to use. This may be used to speed-up\r
496 downloads to target memory and flash operations, or to perform otherwise unavailable\r
497 operations (some coprocessor operations on ARM7/9 systems, for example). The last\r
498 parameter decides whether the memory should be preserved <@var{backup}>. If possible, use\r
499 a working_area that doesn't need to be backed up, as that slows down operation. \r
500 @end itemize\r
501 \r
502 @subsection arm7tdmi options\r
503 @cindex arm7tdmi options\r
504 target arm7tdmi <@var{endianess}> <@var{reset_mode}> <@var{jtag#}>\r
505 The arm7tdmi target definition requires at least one additional argument, specifying\r
506 the position of the target in the JTAG daisy-chain. The first JTAG device is number 0.\r
507 The optional [@var{variant}] parameter has been removed in recent versions.\r
508 The correct feature set is determined at runtime. \r
509 \r
510 @subsection arm720t options\r
511 @cindex arm720t options\r
512 ARM720t options are similar to ARM7TDMI options.\r
513 \r
514 @subsection arm9tdmi options\r
515 @cindex arm9tdmi options\r
516 ARM9TDMI options are similar to ARM7TDMI options. Supported variants are\r
517 @option{arm920t}, @option{arm922t} and @option{arm940t}.\r
518 This enables the hardware single-stepping support found on these cores.\r
519 \r
520 @subsection arm920t options\r
521 @cindex arm920t options\r
522 ARM920t options are similar to ARM9TDMI options.\r
523 \r
524 @subsection arm966e options\r
525 @cindex arm966e options\r
526 ARM966e options are similar to ARM9TDMI options.\r
527 \r
528 @subsection xscale options\r
529 @cindex xscale options\r
530 Supported variants are @option{ixp42x}, @option{ixp45x}, @option{ixp46x},\r
531 @option{pxa250}, @option{pxa255}, @option{pxa26x}.\r
532 \r
533 @section Flash configuration\r
534 @cindex Flash configuration\r
535 \r
536 @itemize @bullet\r
537 @item @b{flash bank} <@var{driver}> <@var{base}> <@var{size}> <@var{chip_width}>\r
538 <@var{bus_width}> <@var{target#}> [@var{driver_options ...}]\r
539 @cindex flash bank\r
540 Configures a flash bank at <@var{base}> of <@var{size}> bytes and <@var{chip_width}>\r
541 and <@var{bus_width}> bytes using the selected flash <driver>.\r
542 \r
543 @item @b{flash auto_erase} <@option{on}|@option{off}>\r
544 @cindex flash auto_erase\r
545 auto erase flash banks prior to writing. Currently only works when using\r
546 @option{flash write_image} command. Default is @option{off}.\r
547 @end itemize\r
548 \r
549 @subsection lpc2000 options\r
550 @cindex lpc2000 options\r
551 \r
552 @b{flash bank lpc2000} <@var{base}> <@var{size}> 0 0 <@var{target#}> <@var{variant}>\r
553 <@var{clock}> [@var{calc_checksum}]\r
554 LPC flashes don't require the chip and bus width to be specified. Additional\r
555 parameters are the <@var{variant}>, which may be @var{lpc2000_v1} (older LPC21xx and LPC22xx)\r
556 or @var{lpc2000_v2} (LPC213x, LPC214x, LPC210[123], LPC23xx and LPC24xx), the number\r
557 of the target this flash belongs to (first is 0), the frequency at which the core\r
558 is currently running (in kHz - must be an integral number), and the optional keyword\r
559 @var{calc_checksum}, telling the driver to calculate a valid checksum for the exception\r
560 vector table. \r
561 \r
562 @subsection cfi options\r
563 @cindex cfi options\r
564 \r
565 @b{flash bank cfi} <@var{base}> <@var{size}> <@var{chip_width}> <@var{bus_width}>\r
566 <@var{target#}>\r
567 CFI flashes require the number of the target they're connected to as an additional\r
568 argument. The CFI driver makes use of a working area (specified for the target)\r
569 to significantly speed up operation. \r
570 \r
571 @var{chip_width} and @var{bus_width} are specified in bytes.\r
572 \r
573 @subsection at91sam7 options\r
574 @cindex at91sam7 options\r
575 \r
576 @b{flash bank at91sam7} 0 0 0 0 <@var{target#}>\r
577 AT91SAM7 flashes only require the @var{target#}, all other values are looked up after\r
578 reading the chip-id and type. \r
579 \r
580 @subsection str7 options\r
581 @cindex str7 options\r
582 \r
583 @b{flash bank str7x} <@var{base}> <@var{size}> 0 0 <@var{target#}> <@var{variant}>\r
584 variant can be either STR71x, STR73x or STR75x. \r
585 \r
586 @subsection str9 options\r
587 @cindex str9 options\r
588 \r
589 @b{flash bank str9x} <@var{base}> <@var{size}> 0 0 <@var{target#}>\r
590 The str9 needs the flash controller to be configured prior to Flash programming, eg.\r
591 @smallexample\r
592 str9x flash_config 0 4 2 0 0x80000\r
593 @end smallexample\r
594 This will setup the BBSR, NBBSR, BBADR and NBBADR registers respectively. \r
595 \r
596 @subsection str9 options (str9xpec driver)\r
597 \r
598 @b{flash bank str9xpec} <@var{base}> <@var{size}> 0 0 <@var{target#}>\r
599 Before using the flash commands the turbo mode will need enabling using str9xpec\r
600 @option{enable_turbo} <@var{num>.}\r
601 \r
602 Only use this driver for locking/unlocking the device or configuring the option bytes.\r
603 Use the standard str9 driver for programming.\r
604 \r
605 @subsection stellaris (LM3Sxxx) options\r
606 @cindex stellaris (LM3Sxxx) options\r
607 \r
608 @b{flash bank stellaris} <@var{base}> <@var{size}> 0 0 <@var{target#}>\r
609 stellaris flash plugin only require the @var{target#}. \r
610 \r
611 @subsection stm32x options\r
612 @cindex stm32x options\r
613 \r
614 @b{flash bank stm32x} <@var{base}> <@var{size}> 0 0 <@var{target#}>\r
615 stm32x flash plugin only require the @var{target#}. \r
616 \r
617 @node Commands\r
618 @chapter Commands\r
619 @cindex commands\r
620 \r
621 The Open On-Chip Debugger (OpenOCD) allows user interaction through a telnet interface\r
622 (default: port 4444) and a GDB server (default: port 3333). The command line interpreter\r
623 is available from both the telnet interface and a GDB session. To issue commands to the\r
624 interpreter from within a GDB session, use the @option{monitor} command, e.g. use\r
625 @option{monitor poll} to issue the @option{poll} command. All output is relayed through the\r
626 GDB session.\r
627 \r
628 @section Daemon\r
629 \r
630 @itemize @bullet\r
631 @item @b{sleep} <@var{msec}>\r
632 @cindex sleep\r
633 Wait for n milliseconds before resuming. Useful in connection with script files\r
634 (@var{script} command and @var{target_script} configuration). \r
635 \r
636 @item @b{shutdown}\r
637 @cindex shutdown\r
638 Close the OpenOCD daemon, disconnecting all clients (GDB, Telnet). \r
639 \r
640 @item @b{debug_level} [@var{n}]\r
641 @cindex debug_level\r
642 Display or adjust debug level to n<0-3> \r
643 \r
644 @item @b{log_output} <@var{file}>\r
645 @cindex log_output\r
646 Redirect logging to <file> (default: stderr) \r
647 \r
648 @item @b{script} <@var{file}>\r
649 @cindex script\r
650 Execute commands from <file> \r
651 \r
652 @end itemize\r
653 \r
654 @subsection Target state handling\r
655 @itemize @bullet\r
656 @item @b{poll} [@option{on}|@option{off}]\r
657 @cindex poll\r
658 Poll the target for its current state. If the target is in debug mode, architecture\r
659 specific information about the current state are printed. An optional parameter\r
660 allows continuous polling to be enabled and disabled.\r
661 \r
662 @item @b{halt} [@option{ms}]\r
663 @cindex halt\r
664 Send a halt request to the target and waits for it to halt for [@option{ms}].\r
665 Default [@option{ms}] is 5 seconds if no arg given.\r
666 Optional arg @option{ms} is a timeout in milliseconds. Using 0 as the [@option{ms}]\r
667 will stop openocd from waiting.\r
668 \r
669 @item @b{wait_halt} [@option{ms}]\r
670 @cindex wait_halt\r
671 Wait for the target to enter debug mode. Optional [@option{ms}] is\r
672 a timeout in milliseconds. Default [@option{ms}] is 5 seconds if no\r
673 arg given.\r
674 \r
675 @item @b{resume} [@var{address}]\r
676 @cindex resume\r
677 Resume the target at its current code position, or at an optional address.\r
678 Openocd will wait 5 seconds for the target to resume.\r
679 \r
680 @item @b{step} [@var{address}]\r
681 @cindex step\r
682 Single-step the target at its current code position, or at an optional address. \r
683 \r
684 @item @b{reset} [@option{run}|@option{halt}|@option{init}|@option{run_and_halt}\r
685 |@option{run_and_init}]\r
686 @cindex reset\r
687 Do a hard-reset. The optional parameter specifies what should happen after the reset.\r
688 This optional parameter overwrites the setting specified in the configuration file,\r
689 making the new behaviour the default for the @option{reset} command.\r
690 @itemize @minus\r
691 @item run\r
692 @cindex reset run\r
693 Let the target run.\r
694 @item halt\r
695 @cindex reset halt\r
696 Immediately halt the target (works only with certain configurations).\r
697 @item init\r
698 @cindex reset init\r
699 Immediately halt the target, and execute the reset script (works only with certain\r
700 configurations)\r
701 @item run_and_halt\r
702 @cindex reset run_and_halt\r
703 Let the target run for a certain amount of time, then request a halt.\r
704 @item run_and_init\r
705 @cindex reset run_and_init\r
706 Let the target run for a certain amount of time, then request a halt. Execute the\r
707 reset script once the target entered debug mode.\r
708 @end itemize\r
709 @end itemize\r
710 \r
711 @subsection Memory access commands\r
712 These commands allow accesses of a specific size to the memory system:\r
713 @itemize @bullet\r
714 @item @b{mdw} <@var{addr}> [@var{count}]\r
715 @cindex mdw\r
716 display memory words \r
717 @item @b{mdh} <@var{addr}> [@var{count}]\r
718 @cindex mdh\r
719 display memory half-words \r
720 @item @b{mdb} <@var{addr}> [@var{count}]\r
721 @cindex mdb\r
722 display memory bytes \r
723 @item @b{mww} <@var{addr}> <@var{value}>\r
724 @cindex mww\r
725 write memory word \r
726 @item @b{mwh} <@var{addr}> <@var{value}>\r
727 @cindex mwh\r
728 write memory half-word \r
729 @item @b{mwb} <@var{addr}> <@var{value}>\r
730 @cindex mwb\r
731 write memory byte \r
732 \r
733 @item @b{load_image} <@var{file}> <@var{address}> [@option{bin}|@option{ihex}|@option{elf}]\r
734 @cindex load_image\r
735 Load image <@var{file}> to target memory at <@var{address}> \r
736 @item @b{dump_image} <@var{file}> <@var{address}> <@var{size}>\r
737 @cindex dump_image\r
738 Dump <@var{size}> bytes of target memory starting at <@var{address}> to a\r
739 (binary) <@var{file}>.\r
740 @item @b{verify_image} <@var{file}> <@var{address}> [@option{bin}|@option{ihex}|@option{elf}]\r
741 @cindex verify_image\r
742 Verify <@var{file}> to target memory starting at <@var{address}>.\r
743 This will first attempt using a crc checksum, if this fails it will try a binary compare.\r
744 @item @b{load_binary} <@var{file}> <@var{address}> [DEPRECATED]\r
745 @cindex load_binary\r
746 Load binary <@var{file}> to target memory at <@var{address}> \r
747 @item @b{dump_binary} <@var{file}> <@var{address}> <@var{size}> [DEPRECATED]\r
748 @cindex dump_binary\r
749 Dump <@var{size}> bytes of target memory starting at <@var{address}> to a\r
750 (binary) <@var{file}>.\r
751 @end itemize\r
752 \r
753 @subsection Flash commands\r
754 @cindex Flash commands\r
755 @itemize @bullet\r
756 @item @b{flash banks}\r
757 @cindex flash banks\r
758 List configured flash banks \r
759 @item @b{flash info} <@var{num}>\r
760 @cindex flash info\r
761 Print info about flash bank <@option{num}> \r
762 @item @b{flash probe} <@var{num}>\r
763 @cindex flash probe\r
764 Identify the flash, or validate the parameters of the configured flash. Operation\r
765 depends on the flash type. \r
766 @item @b{flash erase_check} <@var{num}>\r
767 @cindex flash erase_check\r
768 Check erase state of sectors in flash bank <@var{num}>. This is the only operation that\r
769 updates the erase state information displayed by @option{flash info}. That means you have\r
770 to issue an @option{erase_check} command after erasing or programming the device to get\r
771 updated information. \r
772 @item @b{flash protect_check} <@var{num}>\r
773 @cindex flash protect_check\r
774 Check protection state of sectors in flash bank <num>. \r
775 \r
776 @item @b{flash erase} <@var{num}> <@var{first}> <@var{last}> [DEPRECATED]\r
777 @cindex flash erase\r
778 Erase sectors at bank <@var{num}>, starting at sector <@var{first}> up to and including\r
779 <@var{last}>. Sector numbering starts at 0. Depending on the flash type, erasing might\r
780 require the protection to be disabled first (e.g. Intel Advanced Bootblock flash using\r
781 the CFI driver). This command was replaced by the new command\r
782 @option{flash erase_sector} using the same syntax. \r
783 @item @b{flash erase_sector} <@var{num}> <@var{first}> <@var{last}>\r
784 @cindex flash erase_sector\r
785 Erase sectors at bank <@var{num}>, starting at sector <@var{first}> up to and including\r
786 <@var{last}>. Sector numbering starts at 0. Depending on the flash type, erasing might\r
787 require the protection to be disabled first (e.g. Intel Advanced Bootblock flash using\r
788 the CFI driver).\r
789 @item @b{flash erase_address} <@var{address}> <@var{length}>\r
790 @cindex flash erase_address\r
791 Erase sectors starting at <@var{address}> for <@var{length}> number of bytes\r
792 @item @b{flash write} <@var{num}> <@var{file}> <@var{offset}> [DEPRECATED]\r
793 @cindex flash write\r
794 Write the binary <@var{file}> to flash bank <@var{num}>, starting at <@var{offset}>\r
795 bytes from the beginning of the bank. This command was replaced by the new command\r
796 @option{flash write_binary} using the same syntax. \r
797 @item @b{flash write_binary} <@var{num}> <@var{file}> <@var{offset}>\r
798 @cindex flash write_binary\r
799 Write the binary <@var{file}> to flash bank <@var{num}>, starting at\r
800 <@option{offset}> bytes from the beginning of the bank. \r
801 @item @b{flash write_image} <@var{file}> [@var{offset}] [@var{type}]\r
802 @cindex flash write_image\r
803 Write the image <@var{file}> to the current target's flash bank(s). A relocation\r
804 [@var{offset}] can be specified and the file [@var{type}] can be specified\r
805 explicitly as @option{bin} (binary), @option{ihex} (Intel hex), @option{elf}\r
806 (ELF file) or @option{s19} (Motorola s19). \r
807 @item @b{flash protect} <@var{num}> <@var{first}> <@var{last}> <@option{on}|@option{off}>\r
808 @cindex flash protect\r
809 Enable (@var{on}) or disable (@var{off}) protection of flash sectors <@var{first}> to\r
810 <@var{last}> of @option{flash bank} <@var{num}>. \r
811 @item @b{flash auto_erase} <@var{on}|@var{off}>\r
812 @cindex flash auto_erase\r
813 Enable (@option{on}) to erase flash banks prior to writing using the flash @option{write_image} command\r
814 only. Default is (@option{off}), flash banks have to be erased using @option{flash erase} command. \r
815 @end itemize\r
816 \r
817 @page\r
818 @section Target Specific Commands\r
819 @cindex Target Specific Commands\r
820 \r
821 @subsection AT91SAM7 specific commands\r
822 @cindex AT91SAM7 specific commands\r
823 The flash configuration is deduced from the chip identification register. The flash\r
824 controller handles erases automatically on a page (128/265 byte) basis so erase is\r
825 not necessary for flash programming. AT91SAM7 processors with less than 512K flash\r
826 only have a single flash bank embedded on chip. AT91SAM7xx512 have two flash planes\r
827 that can be erased separatly.Only an EraseAll command is supported by the controller\r
828 for each flash plane and this is called with\r
829 @itemize @bullet\r
830 @item @b{flash erase} <@var{num}> @var{first_plane} @var{last_plane}\r
831 bulk erase flash planes first_plane to last_plane. \r
832 @item @b{at91sam7 gpnvm} <@var{num}> <@var{bit}> <@option{set}|@option{clear}>\r
833 @cindex at91sam7 gpnvm\r
834 set or clear a gpnvm bit for the processor \r
835 @end itemize\r
836 \r
837 @subsection STR9 specific commands\r
838 @cindex STR9 specific commands\r
839 These are flash specific commands when using the str9xpec driver.\r
840 @itemize @bullet\r
841 @item @b{str9xpec enable_turbo} <@var{num}>\r
842 @cindex str9xpec enable_turbo\r
843 enable turbo mode, simply this will remove the str9 from the chain and talk\r
844 directly to the embedded flash controller. \r
845 @item @b{str9xpec disable_turbo} <@var{num}>\r
846 @cindex str9xpec disable_turbo\r
847 restore the str9 into jtag chain. \r
848 @item @b{str9xpec lock} <@var{num}>\r
849 @cindex str9xpec lock\r
850 lock str9 device. The str9 will only respond to an unlock command that will\r
851 erase the device. \r
852 @item @b{str9xpec unlock} <@var{num}>\r
853 @cindex str9xpec unlock\r
854 unlock str9 device. \r
855 @item @b{str9xpec options_read} <@var{num}>\r
856 @cindex str9xpec options_read\r
857 read str9 option bytes. \r
858 @item @b{str9xpec options_write} <@var{num}>\r
859 @cindex str9xpec options_write\r
860 write str9 option bytes. \r
861 @end itemize\r
862 \r
863 @subsection STR9 configuration\r
864 @cindex STR9 configuration\r
865 @itemize @bullet\r
866 @item @b{str9x flash_config} <@var{bank}> <@var{BBSR}> <@var{NBBSR}>\r
867 <@var{BBADR}> <@var{NBBADR}>\r
868 @cindex str9x flash_config\r
869 Configure str9 flash controller.\r
870 @smallexample\r
871 eg. str9x flash_config 0 4 2 0 0x80000\r
872 This will setup\r
873 BBSR - Boot Bank Size register\r
874 NBBSR - Non Boot Bank Size register\r
875 BBADR - Boot Bank Start Address register\r
876 NBBADR - Boot Bank Start Address register\r
877 @end smallexample\r
878 @end itemize\r
879 \r
880 @subsection STR9 option byte configuration\r
881 @cindex STR9 option byte configuration\r
882 @itemize @bullet\r
883 @item @b{str9xpec options_cmap} <@var{num}> <@option{bank0}|@option{bank1}>\r
884 @cindex str9xpec options_cmap\r
885 configure str9 boot bank. \r
886 @item @b{str9xpec options_lvdthd} <@var{num}> <@option{2.4v}|@option{2.7v}>\r
887 @cindex str9xpec options_lvdthd\r
888 configure str9 lvd threshold. \r
889 @item @b{str9xpec options_lvdsel} <@var{num}> <@option{vdd}|@option{vdd_vddq}>\r
890 @cindex str9xpec options_lvdsel\r
891 configure str9 lvd source. \r
892 @item @b{str9xpec options_lvdwarn} <@var{bank}> <@option{vdd}|@option{vdd_vddq}>\r
893 @cindex str9xpec options_lvdwarn\r
894 configure str9 lvd reset warning source. \r
895 @end itemize\r
896 \r
897 @subsection STM32x specific commands\r
898 @cindex STM32x specific commands\r
899  \r
900 These are flash specific commands when using the stm32x driver.\r
901 @itemize @bullet\r
902 @item @b{stm32x lock} <@var{num}>\r
903 @cindex stm32x lock\r
904 lock stm32 device. \r
905 @item @b{stm32x unlock} <@var{num}>\r
906 @cindex stm32x unlock\r
907 unlock stm32 device. \r
908 @item @b{stm32x options_read} <@var{num}>\r
909 @cindex stm32x options_read\r
910 read stm32 option bytes. \r
911 @item @b{stm32x options_write} <@var{num}> <@option{SWWDG}|@option{HWWDG}>\r
912 <@option{RSTSTNDBY}|@option{NORSTSTNDBY}> <@option{RSTSTOP}|@option{NORSTSTOP}>\r
913 @cindex stm32x options_write\r
914 write stm32 option bytes. \r
915 @item @b{stm32x mass_erase} <@var{num}>\r
916 @cindex stm32x mass_erase\r
917 mass erase flash memory. \r
918 @end itemize\r
919 \r
920 @page\r
921 @section Architecture Specific Commands\r
922 @cindex Architecture Specific Commands\r
923 \r
924 @subsection ARMV4/5 specific commands\r
925 @cindex ARMV4/5 specific commands\r
926 \r
927 These commands are specific to ARM architecture v4 and v5, like all ARM7/9 systems\r
928 or Intel XScale (XScale isn't supported yet).\r
929 @itemize @bullet\r
930 @item @b{armv4_5 reg}\r
931 @cindex armv4_5 reg\r
932 Display a list of all banked core registers, fetching the current value from every\r
933 core mode if necessary. OpenOCD versions before rev. 60 didn't fetch the current\r
934 register value. \r
935 @item @b{armv4_5 core_mode} [@option{arm}|@option{thumb}]\r
936 @cindex armv4_5 core_mode\r
937 Displays the core_mode, optionally changing it to either ARM or Thumb mode.\r
938 The target is resumed in the currently set @option{core_mode}. \r
939 @end itemize\r
940 \r
941 @subsection ARM7/9 specific commands\r
942 @cindex ARM7/9 specific commands\r
943 \r
944 These commands are specific to ARM7 and ARM9 targets, like ARM7TDMI, ARM720t,\r
945 ARM920t or ARM926EJ-S.\r
946 @itemize @bullet\r
947 @item @b{arm7_9 sw_bkpts} <@option{enable}|@option{disable}>\r
948 @cindex arm7_9 sw_bkpts\r
949 Enable/disable use of software breakpoints. On ARMv4 systems, this reserves\r
950 one of the watchpoint registers to implement software breakpoints. Disabling\r
951 SW Bkpts frees that register again. \r
952 @item @b{arm7_9 force_hw_bkpts} <@option{enable}|@option{disable}>\r
953 @cindex arm7_9 force_hw_bkpts\r
954 When @option{force_hw_bkpts} is enabled, the @option{sw_bkpts} support is disabled, and all\r
955 breakpoints are turned into hardware breakpoints.\r
956 @item @b{arm7_9 dbgrq} <@option{enable}|@option{disable}>\r
957 @cindex arm7_9 dbgrq\r
958 Enable use of the DBGRQ bit to force entry into debug mode. This should be\r
959 safe for all but ARM7TDMI--S cores (like Philips LPC). \r
960 @item @b{arm7_9 fast_writes} <@option{enable}|@option{disable}>\r
961 @cindex arm7_9 fast_writes [DEPRECATED]\r
962 See @option{arm7_9 fast_memory_access} instead. \r
963 @item @b{arm7_9 fast_memory_access} <@option{enable}|@option{disable}>\r
964 @cindex arm7_9 fast_memory_access\r
965 Allow the OpenOCD to read and write memory without checking completion of\r
966 the operation. This provides a huge speed increase, especially with USB JTAG\r
967 cables (FT2232), but might be unsafe if used with targets running at a very low\r
968 speed, like the 32kHz startup clock of an AT91RM9200. \r
969 @item @b{arm7_9 dcc_downloads} <@option{enable}|@option{disable}>\r
970 @cindex arm7_9 dcc_downloads\r
971 Enable the use of the debug communications channel (DCC) to write larger (>128 byte)\r
972 amounts of memory. DCC downloads offer a huge speed increase, but might be potentially\r
973 unsafe, especially with targets running at a very low speed. This command was introduced\r
974 with OpenOCD rev. 60. \r
975 @end itemize\r
976 \r
977 @subsection ARM920T specific commands\r
978 @cindex ARM920T specific commands\r
979 \r
980 @itemize @bullet\r
981 @item @b{arm920t cache_info}\r
982 @cindex arm920t cache_info\r
983 Print information about the caches found. This allows you to see if your target\r
984 is a ARM920T (2x16kByte cache) or ARM922T (2x8kByte cache). \r
985 @item @b{arm920t md<bhw>_phys} <@var{addr}> [@var{count}]\r
986 @cindex arm920t md<bhw>_phys\r
987 Display memory at physical address addr. \r
988 @item @b{arm920t mw<bhw>_phys} <@var{addr}> <@var{value}>\r
989 @cindex arm920t mw<bhw>_phys\r
990 Write memory at physical address addr. \r
991 @item @b{arm920t read_cache} <@var{filename}>\r
992 @cindex arm920t read_cache\r
993 Dump the content of ICache and DCache to a file. \r
994 @item @b{arm920t read_mmu} <@var{filename}>\r
995 @cindex arm920t read_mmu\r
996 Dump the content of the ITLB and DTLB to a file. \r
997 @item @b{arm920t virt2phys} <@var{VA}>\r
998 @cindex arm920t virt2phys\r
999 Translate a virtual address to a physical address. \r
1000 @end itemize\r
1001 \r
1002 @page\r
1003 @section Debug commands\r
1004 @cindex Debug commands\r
1005 The following commands give direct access to the core, and are most likely\r
1006 only useful while debugging the OpenOCD.\r
1007 @itemize @bullet\r
1008 @item @b{arm7_9 write_xpsr} <@var{32-bit value}> <@option{0=cpsr}, @option{1=spsr}>\r
1009 @cindex arm7_9 write_xpsr\r
1010 Immediately write either the current program status register (CPSR) or the saved\r
1011 program status register (SPSR), without changing the register cache (as displayed\r
1012 by the @option{reg} and @option{armv4_5 reg} commands). \r
1013 @item @b{arm7_9 write_xpsr_im8} <@var{8-bit value}> <@var{rotate 4-bit}>\r
1014 <@var{0=cpsr},@var{1=spsr}>\r
1015 @cindex arm7_9 write_xpsr_im8\r
1016 Write the 8-bit value rotated right by 2*rotate bits, using an immediate write\r
1017 operation (similar to @option{write_xpsr}). \r
1018 @item @b{arm7_9 write_core_reg} <@var{num}> <@var{mode}> <@var{value}>\r
1019 @cindex arm7_9 write_core_reg\r
1020 Write a core register, without changing the register cache (as displayed by the\r
1021 @option{reg} and @option{armv4_5 reg} commands). The <@var{mode}> argument takes the\r
1022 encoding of the [M4:M0] bits of the PSR. \r
1023 @end itemize\r
1024 \r
1025 @page\r
1026 @section JTAG commands\r
1027 @cindex JTAG commands\r
1028 @itemize @bullet\r
1029 @item @b{scan_chain}\r
1030 @cindex scan_chain\r
1031 Print current scan chain configuration. \r
1032 @item @b{jtag_reset}\r
1033 @cindex jtag_reset\r
1034 Toggle reset lines <@var{trst}> <@var{srst}>. \r
1035 @item @b{endstate} <@var{tap_state}>\r
1036 @cindex endstate\r
1037 Finish JTAG operations in <@var{tap_state}>. \r
1038 @item @b{runtest} <@var{num_cycles}>\r
1039 @cindex runtest\r
1040 Move to Run-Test/Idle, and execute <@var{num_cycles}> \r
1041 @item @b{statemove} [@var{tap_state}]\r
1042 @cindex statemove\r
1043 Move to current endstate or [@var{tap_state}] \r
1044 @item @b{irscan}\r
1045 @cindex irscan\r
1046 Execute IR scan <@var{device}> <@var{instr}> [@var{dev2}] [@var{instr2}] ... \r
1047 @item @b{drscan}\r
1048 @cindex drscan\r
1049 Execute DR scan <@var{device}> [@var{dev2}] [@var{var2}] ... \r
1050 @item @b{verify_ircapture}\r
1051 @cindex verify_ircapture\r
1052 Verify value captured during Capture-IR <@option{enable}|@option{disable}> \r
1053 @item @b{var}\r
1054 @cindex var\r
1055 Allocate, display or delete variable <@var{name}> [@var{num_fields}|@var{del}] [@var{size1}] ... \r
1056 @item @b{field}\r
1057 @cindex field\r
1058 Display/modify variable field <@var{var}> <@var{field}> [@var{value}|@var{flip}] \r
1059 @end itemize\r
1060 \r
1061 @node Sample Scripts\r
1062 @chapter Sample Scripts\r
1063 @cindex scripts\r
1064 \r
1065 This page will collect some script examples for different CPUs.\r
1066 \r
1067 The configuration script can be divided in the following section:\r
1068 @itemize @bullet\r
1069 @item daemon configuration\r
1070 @item interface\r
1071 @item jtag scan chain\r
1072 @item target configuration\r
1073 @item flash configuration \r
1074 @end itemize\r
1075 \r
1076 Detailed information about each section can be found at OpenOCD configuration \r
1077 \r
1078 @section OMAP5912 Flash Debug\r
1079 @cindex OMAP5912 Flash Debug\r
1080 The following two scripts were used with a wiggler PP and and a TI OMAP5912\r
1081 dual core processor - (@uref{http://www.ti.com}), on a OMAP5912 OSK board\r
1082 - (@uref{http://www.spectrumdigital.com}).\r
1083 @subsection Openocd config\r
1084 @smallexample\r
1085 #daemon configuration\r
1086 telnet_port 4444\r
1087 gdb_port 3333\r
1088 \r
1089 #interface\r
1090 interface parport\r
1091 parport_port 0x378\r
1092 parport_cable wiggler\r
1093 jtag_speed 0\r
1094 \r
1095 #use combined on interfaces or targets that can't set TRST/SRST separately\r
1096 reset_config trst_and_srst\r
1097 \r
1098 #jtag scan chain\r
1099 #format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)\r
1100 jtag_device 38 0x0 0x0 0x0\r
1101 jtag_device 4  0x1 0x0 0xe\r
1102 jtag_device 8  0x0 0x0 0x0\r
1103 \r
1104 #target configuration\r
1105 daemon_startup reset\r
1106 \r
1107 #target <type> <endianness> <reset mode> <chainpos> <variant>\r
1108 target arm926ejs little run_and_init 1 arm926ejs\r
1109 target_script 0 reset omap5912_osk.init\r
1110 run_and_halt_time 0 30\r
1111 \r
1112 # omap5912 lcd frame buffer as working area\r
1113 working_area 0 0x20000000 0x3e800 nobackup\r
1114 \r
1115 #flash bank <driver> <base> <size> <chip_width> <bus_width>\r
1116 flash bank cfi 0x00000000 0x1000000 2 2 0\r
1117 @end smallexample\r
1118 \r
1119 @subsection Openocd init\r
1120 @smallexample\r
1121 #\r
1122 # halt target\r
1123 #\r
1124 poll\r
1125 sleep 1\r
1126 halt\r
1127 wait_halt\r
1128 #\r
1129 # disable wdt\r
1130 #\r
1131 mww 0xfffec808 0x000000f5\r
1132 mww 0xfffec808 0x000000a0\r
1133 \r
1134 mww 0xfffeb048 0x0000aaaa\r
1135 sleep 500\r
1136 mww 0xfffeb048 0x00005555\r
1137 sleep 500\r
1138 #\r
1139 # detect flash\r
1140 #\r
1141 flash probe 0\r
1142 \r
1143 @end smallexample\r
1144 \r
1145 @section STR71x Script\r
1146 @cindex STR71x Script\r
1147 The following script was used with an Amontec JTAGkey and a STR710 / STR711 cpu:\r
1148 @smallexample\r
1149 #daemon configuration\r
1150 telnet_port 4444\r
1151 gdb_port 3333\r
1152  \r
1153 #interface\r
1154 interface ft2232\r
1155 ft2232_device_desc "Amontec JTAGkey A"\r
1156 ft2232_layout jtagkey\r
1157 ft2232_vid_pid 0x0403 0xcff8\r
1158 jtag_speed 0\r
1159  \r
1160 #use combined on interfaces or targets that can't set TRST/SRST separately\r
1161 reset_config trst_and_srst srst_pulls_trst\r
1162  \r
1163 #jtag scan chain\r
1164 #format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)\r
1165 jtag_device 4 0x1 0xf 0xe\r
1166  \r
1167 #target configuration\r
1168 daemon_startup reset\r
1169  \r
1170 #target <type> <startup mode>\r
1171 #target arm7tdmi <endianness> <reset mode> <chainpos> <variant>\r
1172 target arm7tdmi little run_and_halt 0 arm7tdmi\r
1173 run_and_halt_time 0 30\r
1174 \r
1175 working_area 0 0x2000C000 0x4000 nobackup\r
1176  \r
1177 #flash bank <driver> <base> <size> <chip_width> <bus_width>\r
1178 flash bank str7x 0x40000000 0x00040000 0 0 0 STR71x\r
1179 @end smallexample\r
1180 \r
1181 @section STR750 Script\r
1182 @cindex STR750 Script\r
1183 The following script was used with an Amontec JTAGkey and a STR750 cpu:\r
1184 @smallexample\r
1185 #daemon configuration\r
1186 telnet_port 4444\r
1187 gdb_port 3333\r
1188  \r
1189 #interface\r
1190 interface ft2232\r
1191 ft2232_device_desc "Amontec JTAGkey A"\r
1192 ft2232_layout jtagkey\r
1193 ft2232_vid_pid 0x0403 0xcff8\r
1194 jtag_speed 19\r
1195  \r
1196 #use combined on interfaces or targets that can't set TRST/SRST separately\r
1197 #reset_config trst_and_srst srst_pulls_trst\r
1198 reset_config trst_and_srst srst_pulls_trst\r
1199 \r
1200 #jtag scan chain\r
1201 #format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)\r
1202 jtag_device 4 0x1 0xf 0xe\r
1203 \r
1204 #jtag nTRST and nSRST delay\r
1205 jtag_nsrst_delay 500\r
1206 jtag_ntrst_delay 500\r
1207  \r
1208 #target configuration\r
1209 daemon_startup reset\r
1210  \r
1211 #target <type> <startup mode>\r
1212 #target arm7tdmi <reset mode> <chainpos> <endianness> <variant>\r
1213 target arm7tdmi little run_and_halt 0 arm7tdmi\r
1214 run_and_halt_time 0 30\r
1215  \r
1216 working_area 0 0x40000000 0x4000 nobackup\r
1217  \r
1218 #flash bank <driver> <base> <size> <chip_width> <bus_width>\r
1219 flash bank str7x 0x20000000 0x000040000 0 0 0 STR75x\r
1220 @end smallexample\r
1221 \r
1222 @section STR912 Script\r
1223 @cindex STR912 Script\r
1224 The following script was used with an Amontec JTAGkey and a STR912 cpu:\r
1225 @smallexample\r
1226 #daemon configuration\r
1227 telnet_port 4444\r
1228 gdb_port 3333\r
1229  \r
1230 #interface\r
1231 interface ft2232\r
1232 ft2232_device_desc "Amontec JTAGkey A"\r
1233 ft2232_layout jtagkey\r
1234 jtag_speed 1\r
1235  \r
1236 #use combined on interfaces or targets that can't set TRST/SRST separately\r
1237 reset_config trst_and_srst\r
1238  \r
1239 #jtag scan chain\r
1240 #format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)\r
1241 jtag_device 8 0x1 0x1 0xfe\r
1242 jtag_device 4 0x1 0xf 0xe\r
1243 jtag_device 5 0x1 0x1 0x1e\r
1244  \r
1245 #target configuration\r
1246 daemon_startup reset\r
1247  \r
1248 #target <type> <startup mode>\r
1249 #target arm966e <endianness> <reset mode> <chainpos> <variant>\r
1250 target arm966e little reset_halt 1 arm966e\r
1251 run_and_halt_time 0 30\r
1252  \r
1253 working_area 0 0x50000000 16384 nobackup\r
1254  \r
1255 #flash bank <driver> <base> <size> <chip_width> <bus_width>\r
1256 flash bank str9x 0x00000000 0x00080000 0 0 0\r
1257 @end smallexample\r
1258 \r
1259 @section STR912 comstick\r
1260 @cindex STR912 comstick Script\r
1261 The following script was used with a Hitex STR9 Comstick:\r
1262 @smallexample\r
1263 #daemon configuration\r
1264 telnet_port 4444\r
1265 gdb_port 3333\r
1266  \r
1267 #interface\r
1268 interface ft2232\r
1269 ft2232_device_desc "STR9-comStick A"\r
1270 ft2232_layout comstick\r
1271 jtag_speed 1\r
1272 \r
1273 jtag_nsrst_delay 100\r
1274 jtag_ntrst_delay 100\r
1275 \r
1276 #use combined on interfaces or targets that can't set TRST/SRST separately\r
1277 reset_config trst_and_srst\r
1278  \r
1279 #jtag scan chain\r
1280 #format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)\r
1281 jtag_device 8 0x1 0x1 0xfe\r
1282 jtag_device 4 0x1 0xf 0xe\r
1283 jtag_device 5 0x1 0x1 0x1e\r
1284  \r
1285 #target configuration\r
1286 daemon_startup reset\r
1287  \r
1288 #target <type> <startup mode>\r
1289 #target arm966e <endianness> <reset mode> <chainpos> <variant>\r
1290 target arm966e little reset_halt 1 arm966e\r
1291 run_and_halt_time 0 30\r
1292  \r
1293 working_area 0 0x50000000 16384 nobackup\r
1294  \r
1295 #flash bank <driver> <base> <size> <chip_width> <bus_width>\r
1296 flash bank str9x 0x00000000 0x00080000 0 0 0\r
1297 @end smallexample\r
1298 \r
1299 @section STM32x Script\r
1300 @cindex STM32x Script\r
1301 The following script was used with an Amontec JTAGkey and a STM32x cpu:\r
1302 @smallexample\r
1303 #daemon configuration\r
1304 telnet_port 4444\r
1305 gdb_port 3333\r
1306  \r
1307 #interface\r
1308 interface ft2232\r
1309 ft2232_device_desc "Amontec JTAGkey A"\r
1310 ft2232_layout jtagkey\r
1311 jtag_speed 10\r
1312 \r
1313 jtag_nsrst_delay 100\r
1314 jtag_ntrst_delay 100\r
1315 \r
1316 #use combined on interfaces or targets that can't set TRST/SRST separately\r
1317 reset_config trst_and_srst\r
1318  \r
1319 #jtag scan chain\r
1320 #format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)\r
1321 jtag_device 4 0x1 0xf 0xe\r
1322 jtag_device 5 0x1 0x1 0x1e\r
1323  \r
1324 #target configuration\r
1325 daemon_startup reset\r
1326  \r
1327 #target <type> <startup mode>\r
1328 #target cortex_m3 <endianness> <reset mode> <chainpos> <variant>\r
1329 target cortex_m3 little run_and_halt 0\r
1330 run_and_halt_time 0 30\r
1331  \r
1332 working_area 0 0x20000000 16384 nobackup\r
1333  \r
1334 #flash bank <driver> <base> <size> <chip_width> <bus_width>\r
1335 flash bank stm32x 0x08000000 0x00020000 0 0 0\r
1336 @end smallexample\r
1337 \r
1338 @section STM32x Performance Stick\r
1339 @cindex STM32x Performance Stick Script\r
1340 The following script was used with the Hitex STM32 Performance Stick\r
1341 @smallexample\r
1342 #daemon configuration\r
1343 telnet_port 4444\r
1344 gdb_port 3333\r
1345  \r
1346 #interface\r
1347 interface ft2232\r
1348 ft2232_device_desc "STM32-PerformanceStick A"\r
1349 ft2232_layout stm32stick\r
1350 jtag_speed 10\r
1351 \r
1352 jtag_nsrst_delay 100\r
1353 jtag_ntrst_delay 100\r
1354 \r
1355 #use combined on interfaces or targets that can't set TRST/SRST separately\r
1356 reset_config trst_and_srst\r
1357  \r
1358 #jtag scan chain\r
1359 #format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)\r
1360 jtag_device 4 0x1 0xf 0xe\r
1361 jtag_device 5 0x1 0x1 0x1e\r
1362 jtag_device 4 0x1 0xf 0xe\r
1363  \r
1364 #target configuration\r
1365 daemon_startup reset\r
1366  \r
1367 #target <type> <startup mode>\r
1368 #target cortex_m3 <endianness> <reset mode> <chainpos> <variant>\r
1369 target cortex_m3 little run_and_halt 0\r
1370 run_and_halt_time 0 30\r
1371  \r
1372 working_area 0 0x20000000 16384 nobackup\r
1373  \r
1374 #flash bank <driver> <base> <size> <chip_width> <bus_width>\r
1375 flash bank stm32x 0x08000000 0x00020000 0 0 0\r
1376 @end smallexample\r
1377 \r
1378 @section LPC2129 Script\r
1379 @cindex LPC2129 Script\r
1380 The following script was used with an wiggler PP and a LPC-2129 cpu:\r
1381 @smallexample\r
1382 #daemon configuration\r
1383 telnet_port 4444\r
1384 gdb_port 3333\r
1385  \r
1386 #interface\r
1387 interface parport\r
1388 parport_port 0x378\r
1389 parport_cable wiggler\r
1390 jtag_speed 0\r
1391  \r
1392 #use combined on interfaces or targets that can't set TRST/SRST separately\r
1393 reset_config trst_and_srst srst_pulls_trst\r
1394  \r
1395 #jtag scan chain\r
1396 #format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)\r
1397 jtag_device 4 0x1 0xf 0xe\r
1398  \r
1399 #target configuration\r
1400 daemon_startup reset\r
1401  \r
1402 #target <type> <startup mode>\r
1403 #target arm7tdmi <endianness> <reset mode> <chainpos> <variant>\r
1404 target arm7tdmi little run_and_halt 0 arm7tdmi-s_r4\r
1405 run_and_halt_time 0 30\r
1406  \r
1407 working_area 0 0x40000000 0x4000 nobackup\r
1408  \r
1409 #flash bank <driver> <base> <size> <chip_width> <bus_width>\r
1410 flash bank lpc2000 0x0 0x40000 0 0 0 lpc2000_v1 14765 calc_checksum\r
1411 @end smallexample\r
1412 \r
1413 @section  LPC2148 Script\r
1414 @cindex  LPC2148 Script\r
1415 The following script was used with an Amontec JTAGkey and a LPC2148 cpu:\r
1416 @smallexample\r
1417 #daemon configuration\r
1418 telnet_port 4444\r
1419 gdb_port 3333\r
1420  \r
1421 #interface\r
1422 interface ft2232\r
1423 ft2232_device_desc "Amontec JTAGkey A"\r
1424 ft2232_layout jtagkey\r
1425 ft2232_vid_pid 0x0403 0xcff8\r
1426 jtag_speed 3\r
1427  \r
1428 #use combined on interfaces or targets that can't set TRST/SRST separately\r
1429 reset_config trst_and_srst srst_pulls_trst\r
1430  \r
1431 #jtag scan chain\r
1432 #format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)\r
1433 jtag_device 4 0x1 0xf 0xe\r
1434  \r
1435 #target configuration\r
1436 daemon_startup reset\r
1437  \r
1438 #target <type> <startup mode>\r
1439 #target arm7tdmi <endianness> <reset mode> <chainpos> <variant>\r
1440 target arm7tdmi little run_and_halt 0 arm7tdmi-s_r4\r
1441 run_and_halt_time 0 30\r
1442  \r
1443 working_area 0 0x40000000 0x8000 nobackup\r
1444  \r
1445 #flash configuration\r
1446 flash bank lpc2000 0x0 0x7d000 0 0 0 lpc2000_v1 14765 calc_checksum\r
1447 @end smallexample\r
1448 \r
1449 @section  LPC2294 Script\r
1450 @cindex  LPC2294 Script\r
1451 The following script was used with an Amontec JTAGkey and a LPC2294 cpu:\r
1452 @smallexample\r
1453 #daemon configuration\r
1454 telnet_port 4444\r
1455 gdb_port 3333\r
1456  \r
1457 #interface\r
1458 interface ft2232\r
1459 ft2232_device_desc "Amontec JTAGkey A"\r
1460 ft2232_layout jtagkey\r
1461 ft2232_vid_pid 0x0403 0xcff8\r
1462 jtag_speed 3\r
1463  \r
1464 #use combined on interfaces or targets that can't set TRST/SRST separately\r
1465 reset_config trst_and_srst srst_pulls_trst\r
1466  \r
1467 #jtag scan chain\r
1468 #format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)\r
1469 jtag_device 4 0x1 0xf 0xe\r
1470  \r
1471 #target configuration\r
1472 daemon_startup reset\r
1473  \r
1474 #target <type> <startup mode>\r
1475 #target arm7tdmi <endianness> <reset mode> <chainpos> <variant>\r
1476 target arm7tdmi little run_and_halt 0 arm7tdmi-s_r4\r
1477 run_and_halt_time 0 30\r
1478  \r
1479 working_area 0 0x40000000 0x4000 nobackup\r
1480  \r
1481 #flash configuration\r
1482 flash bank lpc2000 0x0 0x40000 0 0 0 lpc2000_v1 14765 calc_checksum\r
1483 @end smallexample\r
1484 \r
1485 @section AT91R40008 Script\r
1486 @cindex AT91R40008 Script\r
1487 The following script was used with an Amontec JTAGkey and a AT91R40008 cpu:\r
1488 @smallexample\r
1489 #daemon configuration\r
1490 telnet_port 4444\r
1491 gdb_port 3333\r
1492  \r
1493 #interface\r
1494 interface ft2232\r
1495 ft2232_device_desc "Amontec JTAGkey A"\r
1496 ft2232_layout jtagkey\r
1497 ft2232_vid_pid 0x0403 0xcff8\r
1498 jtag_speed 0\r
1499 jtag_nsrst_delay 200\r
1500 jtag_ntrst_delay 200\r
1501  \r
1502 #use combined on interfaces or targets that can't set TRST/SRST separately\r
1503 reset_config srst_only srst_pulls_trst\r
1504  \r
1505 #jtag scan chain\r
1506 #format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)\r
1507 jtag_device 4 0x1 0xf 0xe\r
1508  \r
1509 #target configuration\r
1510 daemon_startup reset\r
1511  \r
1512 #target <type> <startup mode>\r
1513 #target arm7tdmi <endianness> <reset mode> <chainpos> <variant>\r
1514 target arm7tdmi little run_and_halt 0 arm7tdmi\r
1515 run_and_halt_time 0 30\r
1516 @end smallexample\r
1517 \r
1518 @section AT91SAM7s Script\r
1519 @cindex AT91SAM7s Script\r
1520 The following script was used with an Olimex ARM-JTAG-OCD and a AT91SAM7S64 cpu:\r
1521 @smallexample\r
1522 #daemon configuration\r
1523 telnet_port 4444\r
1524 gdb_port 3333\r
1525  \r
1526 #interface\r
1527 interface ft2232\r
1528 ft2232_device_desc "Olimex OpenOCD JTAG A"\r
1529 ft2232_layout olimex-jtag\r
1530 ft2232_vid_pid 0x15BA 0x0003\r
1531 jtag_speed 0\r
1532 jtag_nsrst_delay 200\r
1533 jtag_ntrst_delay 200\r
1534  \r
1535 #use combined on interfaces or targets that can't set TRST/SRST separately\r
1536 reset_config srst_only srst_pulls_trst\r
1537  \r
1538 #jtag scan chain\r
1539 #format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)\r
1540 jtag_device 4 0x1 0xf 0xe\r
1541  \r
1542 #target configuration\r
1543 daemon_startup reset\r
1544  \r
1545 #target <type> <startup mode>\r
1546 #target arm7tdmi <endianness> <reset mode> <chainpos> <variant>\r
1547 target arm7tdmi little run_and_halt 0 arm7tdmi\r
1548 run_and_halt_time 0 30\r
1549  \r
1550 # flash-options AT91\r
1551 working_area 0 0x00200000 0x4000 nobackup\r
1552 flash bank at91sam7 0 0 0 0 0\r
1553  \r
1554 # Information: \r
1555 # erase command (telnet-interface) for complete flash:\r
1556 # flash erase <num> 0 numlockbits-1 (can be seen from output of flash info 0)\r
1557 # SAM7S64 with 16 lockbits and bank 0: flash erase 0 0 15\r
1558 # set/clear NVM-Bits:\r
1559 # at91sam7 gpnvm <num> <bit> <set|clear>\r
1560 # disable locking from SAM-BA:\r
1561 # flash protect 0 0 1 off\r
1562 @end smallexample\r
1563 \r
1564 @section XSCALE IXP42x Script\r
1565 @cindex XSCALE IXP42x Script\r
1566 The following script was used with an Amontec JTAGkey-Tiny and a xscale ixp42x cpu:\r
1567 @smallexample\r
1568 #daemon configuration\r
1569 telnet_port 4444\r
1570 gdb_port 3333\r
1571 \r
1572 #interface\r
1573 interface ft2232\r
1574 ft2232_device_desc "Amontec JTAGkey A"\r
1575 ft2232_layout jtagkey\r
1576 ft2232_vid_pid 0x0403 0xcff8\r
1577 jtag_speed 0\r
1578 jtag_nsrst_delay 200\r
1579 jtag_ntrst_delay 200\r
1580  \r
1581 #use combined on interfaces or targets that can't set TRST/SRST separately\r
1582 reset_config srst_only srst_pulls_trst\r
1583  \r
1584 #jtag scan chain\r
1585 #format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)\r
1586 jtag_device 7 0x1 0x7f 0x7e\r
1587  \r
1588 #target configuration\r
1589 daemon_startup reset\r
1590  \r
1591 #target <type> <startup mode>\r
1592 #target arm7tdmi <reset mode> <chainpos> <endianness> <variant>\r
1593 target xscale big run_and_halt 0 IXP42x\r
1594 run_and_halt_time 0 30\r
1595 @end smallexample\r
1596 \r
1597 @section Cirrus Logic EP9301 Script\r
1598 @cindex Cirrus Logic EP9301 Script\r
1599 The following script was used with FT2232 based JTAG interfaces and a\r
1600 Cirrus Logic EP9301 processor on an Olimex CS-E9301 board.\r
1601 @smallexample\r
1602 #daemon configuration\r
1603 telnet_port 4444\r
1604 gdb_port 3333\r
1605  \r
1606 #interface\r
1607 interface ft2232\r
1608 \r
1609 #Olimex ARM-USB-OCD\r
1610 #ft2232_device_desc "Olimex OpenOCD JTAG"\r
1611 #ft2232_layout olimex-jtag\r
1612 #ft2232_vid_pid 0x15ba 0x0003\r
1613  \r
1614 #Amontec JTAGkey (and JTAGkey-Tiny)\r
1615 #Serial is only necessary if more than one JTAGkey is connected\r
1616 ft2232_device_desc "Amontec JTAGkey A"\r
1617 #ft2232_serial AMTJKV31\r
1618 #ft2232_serial T1P3S2W8\r
1619 ft2232_layout jtagkey\r
1620 ft2232_vid_pid 0x0403 0xcff8\r
1621  \r
1622 #wiggler/parallel port interface\r
1623 #interface parport\r
1624 #parport_port 0x378\r
1625 #parport_cable wiggler\r
1626 #jtag_speed 0\r
1627 jtag_speed 1\r
1628 reset_config trst_and_srst\r
1629  \r
1630 #jtag scan chain\r
1631 #format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)\r
1632 jtag_device 4 0x1 0xf 0xe\r
1633  \r
1634 jtag_nsrst_delay 100\r
1635 jtag_ntrst_delay 100\r
1636  \r
1637 #target configuration\r
1638 daemon_startup attach\r
1639  \r
1640 #target <type> <endianess> <reset mode>\r
1641 target arm920t little reset_halt 0\r
1642 working_area 0 0x80014000 0x1000 backup\r
1643  \r
1644 #flash configuration\r
1645 #flash bank <driver> <base> <size> <chip_width> <bus_width> [driver_options ...]\r
1646 flash bank cfi 0x60000000 0x1000000 2 2 0\r
1647 @end smallexample\r
1648 \r
1649 @section Hilscher netX 100 / 500 Script\r
1650 @cindex Hilscher netX 100 / 500 Script\r
1651 The following script was used with an Amontec JTAGkey and a Hilscher\r
1652 netX 500 cpu:\r
1653 @smallexample\r
1654 #daemon configuration\r
1655 telnet_port 4444\r
1656 gdb_port 3333\r
1657 \r
1658 #interface\r
1659 interface ft2232\r
1660 ft2232_device_desc "Amontec JTAGkey A"\r
1661 ft2232_layout jtagkey\r
1662 ft2232_vid_pid 0x0403 0xcff8\r
1663 jtag_speed 5\r
1664 \r
1665 #use combined on interfaces or targets that can't set TRST/SRST separately\r
1666 reset_config trst_and_srst\r
1667 \r
1668 #jtag scan chain\r
1669 #format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)\r
1670 jtag_device 4 0x1 0xf 0xe\r
1671 \r
1672 jtag_nsrst_delay 100\r
1673 jtag_ntrst_delay 100\r
1674 \r
1675 #target configuration\r
1676 daemon_startup reset\r
1677 \r
1678 #target <type> <endianness> <startup mode> <chainpos> <variant>\r
1679 target arm926ejs little run_and_halt 0 arm926ejs\r
1680 run_and_halt_time 0 500\r
1681 @end smallexample\r
1682 \r
1683 @section Marvell/Intel PXA270 Script\r
1684 @cindex Marvell/Intel PXA270 Script\r
1685 @smallexample\r
1686 # config for Intel PXA270\r
1687 # not, as of 2007-06-22, openocd only works with the\r
1688 # libftd2xx library from ftdi.  libftdi does not work.\r
1689 \r
1690 telnet_port     3333\r
1691 gdb_port        4444\r
1692 \r
1693 interface ft2232\r
1694 ft2232_layout olimex-jtag\r
1695 ft2232_vid_pid 0x15BA 0x0003\r
1696 ft2232_device_desc "Olimex OpenOCD JTAG"\r
1697 jtag_speed 0\r
1698 # set jtag_nsrst_delay to the delay introduced by your reset circuit\r
1699 # the rest of the needed delays are built into the openocd program\r
1700 jtag_nsrst_delay 260\r
1701 # set the jtag_ntrst_delay to the delay introduced by a reset circuit\r
1702 # the rest of the needed delays are built into the openocd program\r
1703 jtag_ntrst_delay 0\r
1704 \r
1705 #use combined on interfaces or targets that can't set TRST/SRST separately\r
1706 reset_config trst_and_srst separate\r
1707 \r
1708 #jtag scan chain\r
1709 #format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)\r
1710 jtag_device 7 0x1 0x7f 0x7e\r
1711 \r
1712 #target configuration\r
1713 daemon_startup reset\r
1714 \r
1715 target xscale little reset_halt 0 pxa27x\r
1716 \r
1717 # maps to PXA internal RAM.  If you are using a PXA255\r
1718 # you must initialize SDRAM or leave this option off\r
1719 working_area 0 0x5c000000 0x10000 nobackup\r
1720 \r
1721 run_and_halt_time 0 30\r
1722 \r
1723 #flash bank <driver> <base> <size> <chip_width> <bus_width>\r
1724 # works for P30 flash\r
1725 flash bank cfi 0x00000000 0x1000000 2 4 0\r
1726 @end smallexample\r
1727 \r
1728 @node GDB and Openocd\r
1729 @chapter GDB and Openocd\r
1730 @cindex GDB and Openocd\r
1731 Openocd complies with the remote gdbserver protocol, and as such can be used\r
1732 to debug remote targets.\r
1733 \r
1734 @section Connecting to gdb\r
1735 @cindex Connecting to gdb\r
1736 A connection is typically started as follows:\r
1737 @smallexample\r
1738 target remote localhost:3333\r
1739 @end smallexample\r
1740 This would cause gdb to connect to the gdbserver on the local pc using port 3333.\r
1741 \r
1742 To see a list of available openocd commands type @option{monitor help} on the\r
1743 gdb commandline.\r
1744 \r
1745 Openocd supports the gdb @option{qSupported} packet, this enables information\r
1746 to be sent by the gdb server (openocd) to gdb. Typical information includes\r
1747 packet size and device memory map.\r
1748 \r
1749 Previous versions of openocd required the following gdb options to increase\r
1750 the packet size and speed up gdb communication.\r
1751 @smallexample\r
1752 set remote memory-write-packet-size 1024\r
1753 set remote memory-write-packet-size fixed\r
1754 set remote memory-read-packet-size 1024\r
1755 set remote memory-read-packet-size fixed\r
1756 @end smallexample\r
1757 This is now handled in the @option{qSupported} PacketSize.\r
1758 \r
1759 @section Programming using gdb\r
1760 @cindex Programming using gdb\r
1761 \r
1762 By default the target memory map is not sent to gdb, this can be enabled by\r
1763 the following openocd config option:\r
1764 @smallexample\r
1765 gdb_memory_map enable\r
1766 @end smallexample\r
1767 For this to function correctly a valid flash config must also be configured\r
1768 in openocd. For speed also configure a valid working area.\r
1769 \r
1770 Informing gdb of the memory map of the target will enable gdb to protect any\r
1771 flash area of the target and use hardware breakpoints by default. This means\r
1772 that the openocd option @option{arm7_9 force_hw_bkpts} is not required when\r
1773 using a memory map.\r
1774 \r
1775 To view the configured memory map in gdb, use the gdb command @option{info mem}\r
1776 All other unasigned addresses within gdb are treated as ram.\r
1777 \r
1778 If @option{gdb_flash_program enable} is also used, gdb will be able to\r
1779 program any flash memory using the vFlash interface.\r
1780 \r
1781 gdb will look at the target memory map when a load command is given, if any\r
1782 areas to be programmed lie within the target flash area the vFlash packets\r
1783 will be used.\r
1784 \r
1785 Incase the target needs configuring before gdb programming, a script can be executed.\r
1786 @smallexample\r
1787 target_script 0 gdb_program_config config.script\r
1788 @end smallexample\r
1789 \r
1790 To verify any flash programming the gdb command @option{compare-sections}\r
1791 can be used.\r
1792 \r
1793 @node FAQ\r
1794 @chapter FAQ\r
1795 @cindex faq\r
1796 @enumerate\r
1797 @item OpenOCD complains about a missing cygwin1.dll\r
1798 \r
1799 Make sure you have Cygwin installed, or at least a version of OpenOCD that\r
1800 claims to come with all the necessary dlls. When using Cygwin, try launching\r
1801 the OpenOCD from the Cygwin shell.\r
1802 \r
1803 @item I'm trying to set a breakpoint using GDB (or a frontend like Insight or\r
1804 Eclipse), but OpenOCD complains that "Info: arm7_9_common.c:213\r
1805 arm7_9_add_breakpoint(): sw breakpoint requested, but software breakpoints not enabled".\r
1806 \r
1807 GDB issues software breakpoints when a normal breakpoint is requested, or to implement\r
1808 source-line single-stepping. On ARMv4T systems, like ARM7TDMI, ARM720t or ARM920t,\r
1809 software breakpoints consume one of the two available hardware breakpoints,\r
1810 and are therefor disabled by default. If your code is running from RAM, you\r
1811 can enable software breakpoints with the @option{arm7_9 sw_bkpts enable} command. If\r
1812 your code resides in Flash, you can't use software breakpoints, but you can force\r
1813 OpenOCD to use hardware breakpoints instead: @option{arm7_9 force_hw_bkpts enable}.\r
1814 \r
1815 @item When erasing or writing LPC2000 on-chip flash, the operation fails sometimes\r
1816 and works sometimes fine.\r
1817 \r
1818 Make sure the core frequency specified in the @option{flash lpc2000} line matches the\r
1819 clock at the time you're programming the flash. If you've specified the crystal's\r
1820 frequency, make sure the PLL is disabled, if you've specified the full core speed\r
1821 (e.g. 60MHz), make sure the PLL is enabled.\r
1822 \r
1823 @item When debugging using an Amontec Chameleon in its JTAG Accelerator configuration,\r
1824 I keep getting "Error: amt_jtagaccel.c:184 amt_wait_scan_busy(): amt_jtagaccel timed\r
1825 out while waiting for end of scan, rtck was disabled".\r
1826 \r
1827 Make sure your PC's parallel port operates in EPP mode. You might have to try several\r
1828 settings in your PC Bios (ECP, EPP, and different versions of those).\r
1829 \r
1830 @item When debugging with the OpenOCD and GDB (plain GDB, Insight, or Eclipse),\r
1831 I get lots of "Error: arm7_9_common.c:1771 arm7_9_read_memory():\r
1832 memory read caused data abort". \r
1833 \r
1834 The errors are non-fatal, and are the result of GDB trying to trace stack frames\r
1835 beyond the last valid frame. It might be possible to prevent this by setting up\r
1836 a proper "initial" stack frame, if you happen to know what exactly has to\r
1837 be done, feel free to add this here.\r
1838 \r
1839 @item I get the following message in the OpenOCD console (or log file):\r
1840 "Warning: arm7_9_common.c:679 arm7_9_assert_reset(): srst resets test logic, too".\r
1841 \r
1842 This warning doesn't indicate any serious problem, as long as you don't want to\r
1843 debug your core right out of reset. Your .cfg file specified @option{jtag_reset\r
1844 trst_and_srst srst_pulls_trst} to tell the OpenOCD that either your board,\r
1845 your debugger or your target uC (e.g. LPC2000) can't assert the two reset signals\r
1846 independently. With this setup, it's not possible to halt the core right out of\r
1847 reset, everything else should work fine.\r
1848 \r
1849 @item When using OpenOCD in conjunction with Amontec JTAGkey and the Yagarto\r
1850 Toolchain (Eclipse, arm-elf-gcc, arm-elf-gdb), the debugging seems to be\r
1851 unstable. When single-stepping over large blocks of code, GDB and OpenOCD\r
1852 quit with an error message. Is there a stability issue with OpenOCD?\r
1853 \r
1854 No, this is not a stability issue concering OpenOCD. Most users have solved\r
1855 this issue by simply using a self-powered USB Hub, which they connect their\r
1856 Amontec JTAGkey to. Apparently, some computers do not provide a USB power\r
1857 supply stable enough for the Amontec JTAGkey to be operated.\r
1858 \r
1859 @item When using the Amontec JTAGkey, sometimes OpenOCD crashes with the\r
1860 following error messages: "Error: ft2232.c:201 ft2232_read(): FT_Read returned:\r
1861 4" and "Error: ft2232.c:365 ft2232_send_and_recv(): couldn't read from FT2232".\r
1862 What does that mean and what might be the reason for this?\r
1863 \r
1864 First of all, the reason might be the USB power supply. Try using a self-powered\r
1865 hub instead of a direct connection to your computer. Secondly, the error code 4\r
1866 corresponds to an FT_IO_ERROR, which means that the driver for the FTDI USB\r
1867 Chip ran into some sort of error - this points us to a USB problem.\r
1868 \r
1869 @item When using the Amontec JTAGkey, sometimes OpenOCD crashes with the following\r
1870 error message: "Error: gdb_server.c:101 gdb_get_char(): read: 10054".\r
1871 What does that mean and what might be the reason for this?\r
1872 \r
1873 Error code 10054 corresponds to WSAECONNRESET, which means that the debugger (GDB)\r
1874 has closed the connection to OpenOCD. This might be a GDB issue.\r
1875 \r
1876 @item In the configuration file in the section where flash device configurations\r
1877 are described, there is a parameter for specifying the clock frequency for\r
1878 LPC2000 internal flash devices (e.g.\r
1879 @option{flash bank lpc2000 0x0 0x40000 0 0 lpc2000_v1 0 14746 calc_checksum}),\r
1880 which must be sepcified in kilohertz. However, I do have a quartz crystal of a\r
1881 frequency that contains fractions of kilohertz (e.g. 14,745,600 Hz, i.e. 14,745.600 kHz).\r
1882 Is it possible to specify real numbers for the clock frequency?\r
1883 \r
1884 No. The clock frequency specified here must be given as an integral number.\r
1885 However, this clock frequency is used by the In-Application-Programming (IAP)\r
1886 routines of the LPC2000 family only, which seems to be very tolerant concerning\r
1887 the given clock frequency, so a slight difference between the specified clock\r
1888 frequency and the actual clock frequency will not cause any trouble.\r
1889 \r
1890 @item Do I have to keep a specific order for the commands in the configuration file?\r
1891 \r
1892 Well, yes and no. Commands can be given in arbitrary order, yet the devices\r
1893 listed for the JTAG scan chain must be given in the right order (jtag_device),\r
1894 with the device closest to the TDO-Pin being listed first. In general,\r
1895 whenever objects of the same type exist which require an index number, then\r
1896 these objects must be given in the right order (jtag_devices, targets and flash\r
1897 banks - a target references a jtag_device and a flash bank references a target).\r
1898 \r
1899 @item Sometimes my debugging session terminates with an error. When I look into the\r
1900 log file, I can see these error messages: Error: arm7_9_common.c:561\r
1901 arm7_9_execute_sys_speed(): timeout waiting for SYSCOMP\r
1902                                                         \r
1903 @end enumerate\r
1904 \r
1905 @include fdl.texi\r
1906 \r
1907 @node Index\r
1908 @unnumbered Index\r
1909 \r
1910 @printindex cp\r
1911 \r
1912 @bye\r