You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

1912 lines
66 KiB

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