Laurentiu Cocanu - blinking led app for PIC32.
[openocd.git] / doc / openocd.texi
index 6855a0ceda65019b2cd1db44efd458a4f0c77437..7e537b3289484196804cc1bf06d8071f1fd8b3e9 100644 (file)
@@ -51,6 +51,7 @@ This manual documents edition @value{EDITION} of the Open On-Chip Debugger
 * Target library::    Target library
 * Commands::          OpenOCD Commands
 * Sample Scripts::    Sample Target Scripts
+* TFTP::              TFTP
 * GDB and OpenOCD::   Using GDB and OpenOCD
 * TCL and OpenOCD::   Using TCL and OpenOCD
 * TCL scripting API:: Tcl scripting API
@@ -275,6 +276,7 @@ and get the output from the TCL engine.
 first target will be gdb_port, the second target will listen on gdb_port + 1, and so on. 
 @item @b{gdb_breakpoint_override} <@var{hard|soft|disabled}>
 @cindex gdb_breakpoint_override
+@anchor{gdb_breakpoint_override}
 @*Force breakpoint type for gdb 'break' commands.
 The raison d'etre for this option is to support GDB GUI's without 
 a hard/soft breakpoint concept where the default OpenOCD and
@@ -291,9 +293,10 @@ Default behaviour is <@var{resume}>
 @cindex gdb_memory_map
 @*Set to <@var{enable}> to cause OpenOCD to send the memory configuration to gdb when
 requested. gdb will then know when to set hardware breakpoints, and program flash
-using the gdb load command. @option{gdb_flash_program enable} (@xref{gdb_flash_program})
-will also need enabling for flash programming to work.
+using the gdb load command. @option{gdb_flash_program enable} will also need enabling
+for flash programming to work.
 Default behaviour is <@var{enable}>
+@xref{gdb_flash_program}.
 @item @b{gdb_flash_program} <@var{enable|disable}>
 @cindex gdb_flash_program
 @anchor{gdb_flash_program}
@@ -477,7 +480,7 @@ TRST is also inverted.
 @cindex altium
 Altium Universal JTAG cable.
 @end itemize
-@item @b{parport_write_on_exit} <@var{on|off}>
+@item @b{parport_write_on_exit} <@var{on}|@var{off}>
 @cindex parport_write_on_exit
 @*This will configure the parallel driver to write a known value to the parallel
 interface on exiting OpenOCD
@@ -497,6 +500,10 @@ interface on exiting OpenOCD
 @cindex ft2232_device_desc
 @*The USB device description of the FTDI FT2232 device. If not specified, the FTDI
 default value is used. This setting is only valid if compiled with FTD2XX support.
+@item @b{ft2232_serial} <@var{serial-number}>
+@cindex ft2232_serial
+@*The serial number of the FTDI FT2232 device. If not specified, the FTDI default 
+values are used.
 @item @b{ft2232_layout} <@var{name}>
 @cindex ft2232_layout
 @*The layout of the FT2232 GPIO signals used to control output-enables and reset
@@ -565,11 +572,13 @@ Currently, there are no options available for the ep93xx interface.
 @item @b{cortex_m3}
 @item @b{feroceon}
 @item @b{xscale}
+@item @b{arm11}
 @item @b{mips_m4k}
 @end itemize
 
 If you want to use a target board that is not on this list, see Adding a new
-target board
+target board.
+The @option{target types} command can be used to get the list of targets supported from within openocd.
 
 Endianess may be @option{little} or @option{big}.
 
@@ -580,8 +589,7 @@ Endianess may be @option{little} or @option{big}.
 @option{pre_resume} or @option{gdb_program_config}.
 @option{post_reset} and @option{reset} will produce the same results.
 
-@item @b{working_area} <@var{target#}> <@var{address}> <@var{size}>
-<@var{backup}|@var{nobackup}>
+@item @b{working_area} <@var{target#}> <@var{address}> <@var{size}> <@var{backup}|@var{nobackup}> [@option{virtual address}]
 @cindex working_area
 @*Specifies a working area for the debugger to use. This may be used to speed-up
 downloads to target memory and flash operations, or to perform otherwise unavailable
@@ -628,6 +636,16 @@ be detected and the normal reset behaviour used.
 Supported variants are @option{ixp42x}, @option{ixp45x}, @option{ixp46x},
 @option{pxa250}, @option{pxa255}, @option{pxa26x}.
 
+@subsection arm11 options
+@cindex arm11 options
+
+@subsection mips_m4k options
+@cindex mips_m4k options
+Use variant @option{ejtag_srst} when debugging targets that
+do not provide a functional SRST line on the EJTAG connector.
+This causes openocd to instead use an EJTAG software reset command to reset the processor.
+You still need to enable @option{srst} on the reset configuration command to enable openocd hardware reset functionality.
+
 @section Flash configuration
 @cindex Flash configuration
 
@@ -717,6 +735,26 @@ Use the standard str9 driver for programming.
 @b{flash bank aduc702x} <@var{base}> <@var{size}> 0 0 <@var{target#}>
 @*aduc702x flash plugin require the flash @var{base}, @var{size} and @var{target#}.
 
+@section mFlash configuration
+@cindex mFlash configuration
+
+@itemize @bullet
+@item @b{mflash bank} <@var{soc}> <@var{base}> <@var{chip_width}> <@var{bus_width}>
+<@var{RST pin}> <@var{WP pin}> <@var{DPD pin}> <@var{target #}>
+@cindex mflash bank
+@*Configures a mflash for <@var{soc}> host bank at <@var{base}>. <@var{chip_width}> and
+<@var{bus_width}> are bytes order. Pin number format is dependent on host GPIO calling convention.
+If WP or DPD pin was not used, write -1. Currently, mflash bank support s3c2440 and pxa270.
+@end itemize
+(ex. of s3c2440) mflash <@var{RST pin}> is GPIO B1, <@var{WP pin}> and <@var{DPD pin}> are not used.
+@smallexample
+mflash bank s3c2440 0x10000000 2 2 1b -1 -1 0
+@end smallexample
+(ex. of pxa270) mflash <@var{RST pin}> is GPIO 43, <@var{DPD pin}> is not used and <@var{DPD pin}> is GPIO 51.
+@smallexample
+mflash bank pxa270 0x08000000 2 2 43 -1 51 0  
+@end smallexample
 @node Target library
 @chapter Target library
 @cindex Target library
@@ -813,6 +851,19 @@ openocd -c "fast enable" -c "interface dummy" -f target/str710.cfg
 
 @subsection Target state handling
 @itemize @bullet
+@item @b{power} <@var{on}|@var{off}>
+@cindex reg
+@*Turn power switch to target on/off. 
+No arguments: print status.
+
+
+@item @b{reg} [@option{#}|@option{name}] [value]
+@cindex reg
+@*Access a single register by its number[@option{#}] or by its [@option{name}].
+No arguments: list all available registers for the current target.
+Number or name argument: display a register
+Number or name and value arguments: set register value
+
 @item @b{poll} [@option{on}|@option{off}]
 @cindex poll
 @*Poll the target for its current state. If the target is in debug mode, architecture
@@ -858,9 +909,18 @@ With no arguments a "reset run" is executed
 @*Immediately halt the target, and execute the reset script (works only with certain
 configurations)
 @end itemize
+
+@item @b{soft_reset_halt}
+@cindex reset
+@*Requesting target halt and executing a soft reset.
 @end itemize
 
 @subsection Memory access commands
+@itemize @bullet
+@item @b{meminfo}
+
+display available ram memory.
+@end itemize
 These commands allow accesses of a specific size to the memory system:
 @itemize @bullet
 @item @b{mdw} <@var{addr}> [@var{count}]
@@ -884,9 +944,26 @@ These commands allow accesses of a specific size to the memory system:
 
 @item @b{load_image} <@var{file}> <@var{address}> [@option{bin}|@option{ihex}|@option{elf}]
 @cindex load_image
+@anchor{load_image}
 @*Load image <@var{file}> to target memory at <@var{address}> 
+@item @b{fast_load_image} <@var{file}> <@var{address}> [@option{bin}|@option{ihex}|@option{elf}]
+@cindex fast_load_image
+@anchor{fast_load_image}
+@*Normally you should be using @b{load_image} or GDB load. However, for
+testing purposes or when IO overhead is significant(OpenOCD running on embedded
+host), then storing the image in memory and uploading the image to the target
+can be a way to upload e.g. multiple debug sessions when the binary does not change.
+Arguments as @b{load_image}, but image is stored in OpenOCD host
+memory, i.e. does not affect target.  This approach is also useful when profiling
+target programming performance as IO and target programming can easily be profiled
+seperately.
+@item @b{fast_load}
+@cindex fast_image
+@anchor{fast_image}
+@*Loads image stored in memory by @b{fast_load_image} to current target. Must be preceeded by fast_load_image.
 @item @b{dump_image} <@var{file}> <@var{address}> <@var{size}>
 @cindex dump_image
+@anchor{dump_image}
 @*Dump <@var{size}> bytes of target memory starting at <@var{address}> to a
 (binary) <@var{file}>.
 @item @b{verify_image} <@var{file}> <@var{address}> [@option{bin}|@option{ihex}|@option{elf}]
@@ -895,6 +972,23 @@ These commands allow accesses of a specific size to the memory system:
 This will first attempt comparison using a crc checksum, if this fails it will try a binary compare.
 @end itemize
 
+@subsection Breakpoint commands
+@cindex Breakpoint commands
+@itemize @bullet
+@item @b{bp} <@var{addr}> <@var{len}> [@var{hw}]
+@cindex bp
+@*set breakpoint <address> <length> [hw]
+@item @b{rbp} <@var{addr}>
+@cindex rbp
+@*remove breakpoint <adress>
+@item @b{wp} <@var{addr}> <@var{len}> <@var{r}|@var{w}|@var{a}> [@var{value}] [@var{mask}]
+@cindex wp
+@*set watchpoint <address> <length> <r/w/a> [value] [mask]
+@item @b{rwp} <@var{addr}>
+@cindex rwp
+@*remove watchpoint <adress>
+@end itemize
+
 @subsection Flash commands
 @cindex Flash commands
 @itemize @bullet
@@ -920,6 +1014,7 @@ updated information.
 @option{flash erase_sector} using the same syntax. 
 @item @b{flash erase_sector} <@var{num}> <@var{first}> <@var{last}>
 @cindex flash erase_sector
+@anchor{flash erase_sector}
 @*Erase sectors at bank <@var{num}>, starting at sector <@var{first}> up to and including
 <@var{last}>. Sector numbering starts at 0. Depending on the flash type, erasing may
 require the protection to be disabled first (e.g. Intel Advanced Bootblock flash using
@@ -929,10 +1024,12 @@ the CFI driver).
 @*Erase sectors starting at <@var{address}> for <@var{length}> bytes
 @item @b{flash write_bank} <@var{num}> <@var{file}> <@var{offset}>
 @cindex flash write_bank
+@anchor{flash write_bank}
 @*Write the binary <@var{file}> to flash bank <@var{num}>, starting at
 <@option{offset}> bytes from the beginning of the bank.
 @item @b{flash write_image} [@var{erase}] <@var{file}> [@var{offset}] [@var{type}]
 @cindex flash write_image
+@anchor{flash write_image}
 @*Write the image <@var{file}> to the current target's flash bank(s). A relocation
 [@var{offset}] can be specified and the file [@var{type}] can be specified
 explicitly as @option{bin} (binary), @option{ihex} (Intel hex), @option{elf}
@@ -944,6 +1041,473 @@ if the @option{erase} parameter is given.
 <@var{last}> of @option{flash bank} <@var{num}>.
 @end itemize
 
+@subsection mFlash commands
+@cindex mFlash commands
+@itemize @bullet
+@item @b{mflash probe} 
+@cindex mflash probe
+Probe mflash.
+@item @b{mflash write} <@var{num}> <@var{file}> <@var{offset}>
+@cindex mflash write
+Write the binary <@var{file}> to mflash bank <@var{num}>, starting at
+<@var{offset}> bytes from the beginning of the bank.
+@item @b{mflash dump} <@var{num}> <@var{file}> <@var{offset}> <@var{size}>
+@cindex mflash dump
+Dump <size> bytes, starting at <@var{offset}> bytes from the beginning of the <@var{num}> bank 
+to a <@var{file}>.
+@end itemize
+
+@page
+@section Target Commands
+@cindex Target Commands
+
+@subsection Overview
+@cindex Overview
+Pre "TCL" - many commands in OpenOCD where implemented as C functions. Post "TCL" 
+(Jim-Tcl to be more exact, June 2008) TCL became a bigger part of OpenOCD.
+
+One of the biggest changes is the introduction of 'target specific'
+commands. When every time you create a target, a special command name is
+created specifically for that target.
+For example - in TCL/TK - if you create a button (or any other screen object) you 
+can specify various "button configuration parameters". One of those parameters is 
+the "object cmd/name" [ In TK - this is referred to as the object path ]. Later 
+you    can use that 'path' as a command to modify the button, for example to make it 
+"grey", or change the color. In effect, the "path" function is an 'object 
+oriented command'. The TCL change in OpenOCD follows the same principle, you create 
+a target, and a specific "targetname" command is created.
+
+There are two methods of creating a target:
+
+@enumerate
+@item
+Using the old syntax (deprecated). Target names are autogenerated as: 
+  "target0", "target1", etc.;
+@cindex old syntax
+@item
+Using the new syntax, you can specify the name of the target.
+@cindex new syntax
+@end enumerate
+
+As most users will have a single JTAG target, and by default the command name will 
+probably default to "target0", thus for reasons of simplicity the instructions below 
+use the name "target0".
+
+@subsection Commands
+@cindex Commands
+OpenOCD has the following 'target' or 'target-like' commands:
+
+@enumerate
+@item
+@b{targets (plural)} - lists all known targets and a little bit of information about each 
+       target, most importantly the target *COMMAND*NAME* (it also lists the target number);
+@cindex targets
+@item
+@b{target (singular)} - used to create, configure list, etc the targets;
+@cindex target
+@item
+@b{target0} - the command object for the first target. Unless you specified another name.
+@cindex target0
+@end enumerate
+
+@subsubsection Targets Command
+@cindex Targets Command
+The "targets" command has 2 functions:
+
+@itemize
+@item
+With a parameter, you can change the current command line target.
+
+NOTE: "with a parameter" is really only useful with 'multiple JTAG targets' not something 
+you normally encounter (ie: If you had 2 arm chips - sharing the same JTAG chain).
+@verbatim
+# using a target name.
+(gdb) mon targets target0
+# or a target by number.
+(gdb) mon targets 3
+@end verbatim
+@cindex with a parameter
+@item
+Plain, without any parameter lists targets, for example:
+
+@verbatim
+(gdb) mon targets
+      CmdName     Type     Endian    ChainPos   State     
+--  ---------- ---------- ---------- -------- ----------
+    0: target0  arm7tdmi   little        0      halted
+@end verbatim
+
+This shows:
+@enumerate a
+@item
+in this example, a single target;
+@item
+target number 0 (1st column);
+@item
+the 'object name' is target0 (the default name);
+@item
+it is an arm7tdmi;
+@item
+little endian;
+@item
+the position in the JTAG chain;
+@item 
+and is currently halted.
+@end enumerate
+@cindex without any parameter
+@end itemize
+
+@subsubsection Target Command
+@cindex Target Command
+
+The "target" command has the following options:
+@itemize
+@item
+target create
+
+@verbatim
+       target create CMDNAME TYPE  ... config options ...
+               argv[0] = 'target'
+               argv[1] = 'create'
+               argv[2] = the 'object command'
+                      (normally, target0, see (3) above)
+               argv[3] = the target type, ie: arm7tdmi
+               argv[4..N] = configuration parameters
+@end verbatim
+@item
+target types
+
+       Lists all supported target types; ie: arm7tdmi, xscale, fericon, cortex-m3.
+       The result TCL list of all known target types (and is human readable).
+@item
+target names
+
+       Returns a TCL list of all known target commands (and is human readable).
+
+       Example:
+@verbatim  
+       foreach t [target names] {
+           puts [format "Target: %s\n" $t]
+       }
+@end verbatim
+@item   
+target current
+
+    Returns the TCL command name of the current target.
+
+       Example:
+@verbatim 
+       set ct [target current]
+       set t  [$ct cget -type]
+               
+       puts "Current target name is: $ct, and is a: $t"
+@end verbatim
+@item
+target number <VALUE>
+
+       Returns the TCL command name of the specified target.
+          
+       Example 
+@verbatim
+    set thename [target number $x]
+    puts [format "Target %d is: %s\n" $x $thename]
+@end verbatim
+       For instance, assuming the defaults
+@verbatim
+    target number 0
+@end verbatim
+       Would return 'target0' (or whatever you called it)
+@item
+target count
+
+       Returns the larget+1 target number.
+       
+       Example:
+@verbatim
+    set c [target count]
+    for { set x 0 } { $x < $c } { incr x } {
+               # Assuming you have this function..
+               print_target_details $x
+    }
+@end verbatim
+@end itemize
+
+@subsubsection Target0 Command
+@cindex Target0 Command
+The "target0" command (the "Target Object" command):
+
+Once a target is 'created' a command object by that targets name is created, for example
+@verbatim
+       target create BiGRed arm7tdmi -endian little -chain-position 3
+@end verbatim
+
+Would create a [case sensitive] "command" BiGRed
+
+If you use the old [deprecated] syntax, the name is automatically
+generated and is in the form:
+@verbatim
+       target0, target1, target2, target3, ... etc.
+@end verbatim
+
+@subsubsection Target CREATE, CONFIGURE and CGET Options Command
+@cindex Target CREATE, CONFIGURE and CGET Options Command
+The commands:
+@verbatim
+    target create CMDNAME TYPE  [configure-options]    
+    CMDNAME configure [configure-options]
+    CMDNAME cget      [configure-options]
+@end verbatim
+@itemize
+@item
+In the 'create' case, one is creating the target and can specify any
+number of configuration parameters.
+@item
+In the 'CMDNAME configure' case, one can change the setting [Not all things can, or should be changed].
+@item
+In the 'CMDNAME cget' case, the goal is to query the target for a
+specific configuration option.
+@end itemize
+
+In the above, the "default" name target0 is 'target0'.
+
+       Example:
+
+               From the (gdb) prompt, one can type this:
+
+@verbatim
+       (gdb) mon target0 configure -endian big
+@end verbatim
+
+               And change target0 to 'big-endian'.  This is a contrived example,
+               specifically for this document - don't expect changing endian
+               'mid-operation' to work you should set the endian at creation.
+
+Known options [30/august/2008] are:
+@itemize
+@item
+[Mandatory 'create' Options]
+       @itemize
+       @item
+    type arm7tdmi|arm720|etc ...
+       @item
+    chain-position NUMBER
+       @item
+    endian ENDIAN
+       @end itemize
+@item
+Optional
+       @itemize
+       @item
+    event EVENTNAME  "tcl-action"
+       @item
+    reset RESETACTION
+       @item
+    work-area-virt ADDR
+       @item
+    work-area-phys ADDR
+       @item
+    work-area-size ADDR
+       @item
+    work-area-backup BOOLEAN
+       @end itemize
+@end itemize
+Hint: To get a list of available options, try this:
+@verbatim
+       (gdb) mon target0 cget -BLAHBLAHBLAH
+@end verbatim
+
+    the above causes an error - and a helpful list of valid options.
+       
+One can query any of the above options at run time, for example:
+@verbatim
+ (gdb) mon target0 cget -OPTION [param]
+@end verbatim
+
+Example TCL script
+
+@verbatim
+    # For all targets...
+    set c [target count]
+    for { set x 0 } { $x < $c } { incr x ] {
+      set n [target number $x]
+      set t [$n cget -type]
+      set e [$n cget -endian]
+      puts [format "%d: %s, %s, endian: %s\n" $x $n $t $n]
+   }
+@end verbatim
+
+Might produce:
+
+@verbatim
+    0: pic32chip, mips_m4k, endain: little
+    1: arm7, arm7tdmi, endian: big
+    2: blackfin, bf534, endian: little
+@end verbatim
+
+Notice the above example is not target0, target1, target2 Why? Because in this contrived multi-target example - 
+more human understandable target names might be helpful.
+
+For example these two are the same:
+
+@verbatim
+   (gdb) mon blackfin configure -event FOO {puts "Hi mom"}
+@end verbatim
+
+or:
+
+@verbatim
+   (gdb) mon [target number 2] configure -event FOO {puts "Hi mom"}
+@end verbatim
+   
+In the second case, we use [] to get the command name of target #2, in this contrived example - it is "blackfin".
+
+Two important configuration options are:
+
+    "-event" and "-reset"
+
+The "-reset" option specifies what should happen when the chip is reset, for example should it 'halt', 're-init', 
+or what.
+
+The "-event" option less you specify a TCL command to occur when a specific event occurs.
+
+@subsubsection Other Target Commands
+@cindex Other Target Commands
+@itemize
+@item @b{profile} <@var{seconds}> <@var{gmon.out}>
+
+Profiling samples the CPU PC as quickly as OpenOCD is able, which will be used as a random sampling of PC.
+@end itemize
+
+@subsection Target Events
+@cindex Target Events
+
+@subsubsection Overview
+@cindex Overview
+At various points in time - certain 'target' events happen.  You can create a custom event action to occur at that time.
+For example - after reset, the PLLs and CLOCKs may need to be reconfigured, or perhaps the SDRAM needs to be re-initialized.
+Often the easiest way to do that is to create a simple script file containing the series of (mww [poke memory]) commands 
+you would type by hand, to reconfigure the target clocks. You could specify the "event action" like this:
+
+@verbatim
+   (gdb) mon target0 configure -event reset-init "script cfg.clocks"
+@end verbatim
+
+In the above example, when the event "reset-init" occurs, the "action-string" will be evaluated as if you typed it at the 
+console:
+@itemize
+@item @b{Option1} - The simple approach (above) is to create a script file with lots of "mww" (memory write word) commands 
+       to configure your targets clocks and/or external memory;
+@item @b{Option2} -    You can instead create a fancy TCL procedure and invoke that procedure instead of sourcing a file [In fact, 
+       "script" is a TCL procedure that loads a file].
+@end itemize
+
+@subsubsection Details
+@cindex Details
+There are many events one could use, to get a current list of events type the following invalid command, you'll get a helpful 
+"runtime error" message, see below [list valid as of 30/august/2008]:
+
+@verbatim
+(gdb) mon target0 cget -event FAFA
+Runtime error, file "../../../openocd23/src/helper/command.c", line 433:
+       -event: Unknown: FAFA, try one of: old-pre_reset, 
+       old-gdb_program_config, old-post_reset, halted, 
+       resumed, resume-start, resume-end, reset-start, 
+       reset-assert-pre, reset-assert-post, 
+       reset-deassert-pre, reset-deassert-post, 
+       reset-halt-pre, reset-halt-post, reset-wait-pre, 
+       reset-wait-post, reset-init, reset-end, 
+       examine-start, examine-end, debug-halted, 
+       debug-resumed, gdb-attach, gdb-detach, 
+       gdb-flash-write-start, gdb-flash-write-end, 
+       gdb-flash-erase-start, gdb-flash-erase-end, 
+       resume-start, resume-ok, or resume-end
+@end verbatim
+
+NOTE: The event-names "old-*" are deprecated and exist only to help old scripts continue to function, and the old "target_script" 
+command to work. Please do not rely on them.
+
+These are some other important names:
+@itemize
+@item gdb-flash-erase-start
+@item gdb-flash-erase-end
+@item gdb-flash-write-start
+@item gdb-flash-write-end
+@end itemize
+
+These occur when GDB/OpenOCD attempts to erase & program the FLASH chip via GDB. For example - some PCBs may have a simple GPIO 
+pin that acts like a "flash write protect" you might need to write a script that disables "write protect".
+
+To get a list of current 'event actions', type the following command:
+
+@verbatim
+   (gdb) mon target0 eventlist
+
+    Event actions for target (0) target0
+
+    Event                     | Body
+    ------------------------- | ----------------------------------------
+    old-post_reset            | script event/sam7x256_reset.script    
+@end verbatim
+
+Here is a simple example for all targets:
+
+@verbatim
+   (gdb)  mon foreach x [target names] { $x eventlist }
+@end verbatim
+
+The above uses some TCL tricks:
+@enumerate a
+@item foreach VARIABLE  LIST  BODY
+@item to generate the list, we use [target names]
+@item the BODY, contains $x - the loop variable and expands to the target specific name
+@end enumerate
+
+Recalling the earlier discussion - the "object command" there are other things you can 
+do besides "configure" the target.
+
+Note: Many of these commands exist as "global" commands, and they also exist as target 
+specific commands. For example, the "mww" (memory write word) operates on the current 
+target if you have more then 1 target, you must switch. In contrast to the normal 
+commands, these commands operate on the specific target. For example, the command "mww" 
+writes data to the *current* command line target. 
+
+Often, you have only a single target - but if you have multiple targets (ie: a PIC32 
+and an at91sam7 - your reset-init scripts might get a bit more complicated, ie: you must 
+specify which of the two chips you want to write to. Writing 'pic32' clock configuration 
+to an at91sam7 does not work).
+
+The commands are [as of 30/august/2008]:
+@verbatim
+    TNAME  mww ADDRESS VALUE
+    TNAME  mwh ADDRESS VALUE
+    TNAME  mwb ADDRESS VALUE
+          Write(poke): 32, 16, 8bit values to memory.
+
+    TNAME  mdw ADDRESS VALUE
+    TNAME  mdh ADDRESS VALUE
+    TNAME  mdb ADDRESS VALUE
+          Human 'hexdump' with ascii 32, 16, 8bit values
+
+    TNAME  mem2array  [see mem2array command]
+    TNAME  array2mem  [see array2mem command]
+
+    TNAME  curstate
+          Returns the current state of the target.
+
+    TNAME  examine
+          See 'advanced target reset'
+    TNAME  poll
+          See 'advanced target reset'
+    TNAME  reset assert
+          See 'advanced target reset'
+    TNAME  reset deassert
+          See 'advanced target reset'
+    TNAME  halt
+          See 'advanced target reset'
+    TNAME  waitstate STATENAME
+          See 'advanced target reset'
+@end verbatim
+
 @page
 @section Target Specific Commands
 @cindex Target Specific Commands
@@ -1049,7 +1613,7 @@ These are flash specific commands when using the stm32x driver.
 
 @subsection Stellaris specific commands
 @cindex Stellaris specific commands
-
 These are flash specific commands when using the Stellaris driver.
 @itemize @bullet
 @item @b{stellaris mass_erase} <@var{num}>
@@ -1090,6 +1654,7 @@ ARM920t or ARM926EJ-S.
 safe for all but ARM7TDMI--S cores (like Philips LPC). 
 @item @b{arm7_9 fast_memory_access} <@var{enable}|@var{disable}>
 @cindex arm7_9 fast_memory_access
+@anchor{arm7_9 fast_memory_access}
 @*Allow OpenOCD to read and write memory without checking completion of
 the operation. This provides a huge speed increase, especially with USB JTAG
 cables (FT2232), but might be unsafe if used with targets running at a very low
@@ -1264,6 +1829,22 @@ See libdcc in the contrib dir for more details.
 @*Enable/disable target debugmsgs requests. debugmsgs enable messages to be sent to the debugger while the target is running.
 @end itemize
 
+@node TFTP
+@chapter TFTP
+@cindex TFTP
+If OpenOCD runs on an embedded host(as ZY1000 does), then tftp can
+be used to access files on PCs(either developer PC or some other PC).
+
+The way this works is to prefix a filename by "/tftp/ip/" and append
+the tftp path on the tftp server(tftpd). E.g. "load_image /tftp/10.0.0.96/c:\temp\abc.elf"
+will load c:\temp\abc.elf from the developer pc (10.0.0.96) into memory as
+if the file was hosted on the embedded host.
+
+In order to achieve decent performance, you must choose a tftp server
+that supports a packet size bigger than the default packet size(512 bytes). There
+are numerous tftp servers out there(free and commercial) and you will have to do
+a bit of googling to find something that fits your requirements.
+
 @node Sample Scripts
 @chapter Sample Scripts
 @cindex scripts
@@ -1341,7 +1922,7 @@ working area.
 Informing gdb of the memory map of the target will enable gdb to protect any
 flash area of the target and use hardware breakpoints by default. This means
 that the OpenOCD option @option{gdb_breakpoint_override} is not required when
-using a memory map.
+using a memory map. @xref{gdb_breakpoint_override}.
 
 To view the configured memory map in gdb, use the gdb command @option{info mem}
 All other unasigned addresses within gdb are treated as RAM.
@@ -1444,6 +2025,18 @@ should be passed in to the proc in question.
 Low level commands are prefixed with "openocd_", e.g. openocd_flash_banks
 is the low level API upon which "flash banks" is implemented.
 
+@itemize @bullet
+@item @b{ocd_mem2array} <@var{varname}> <@var{width}> <@var{addr}> <@var{nelems}>
+
+Read memory and return as a TCL array for script processing
+@item @b{ocd_array2mem} <@var{varname}> <@var{width}> <@var{addr}> <@var{nelems}>
+
+Convert a TCL array to memory locations and write the values
+@item @b{ocd_flash_banks} <@var{driver}> <@var{base}> <@var{size}> <@var{chip_width}> <@var{bus_width}> <@var{target}> [@option{driver options} ...]
+
+Return information about the flash banks
+@end itemize
+
 OpenOCD commands can consist of two words, e.g. "flash banks". The
 startup.tcl "unknown" proc will translate this into a tcl proc
 called "flash_banks".
@@ -1457,29 +2050,29 @@ Certain OpenOCD commands have been deprecated/removed during the various revisio
 @itemize @bullet
 @item @b{load_binary}
 @cindex load_binary
-@*use @option{load_image} command with same args
+@*use @option{load_image} command with same args. @xref{load_image}.
 @item @b{target}
 @cindex target
 @*@option{target} no longer take the reset_init, reset_run, run_and_halt, run_and_init. The @option{reset} command
 always does a @option{reset run} when passed no arguments.
 @item @b{dump_binary}
 @cindex dump_binary
-@*use @option{dump_image} command with same args
+@*use @option{dump_image} command with same args. @xref{dump_image}.
 @item @b{flash erase}
 @cindex flash erase
-@*use @option{flash erase_sector} command with same args
+@*use @option{flash erase_sector} command with same args. @xref{flash erase_sector}.
 @item @b{flash write}
 @cindex flash write
-@*use @option{flash write_bank} command with same args
+@*use @option{flash write_bank} command with same args. @xref{flash write_bank}.
 @item @b{flash write_binary}
 @cindex flash write_binary
-@*use @option{flash write_bank} command with same args
+@*use @option{flash write_bank} command with same args. @xref{flash write_bank}.
 @item @b{arm7_9 fast_writes}
 @cindex arm7_9 fast_writes
-@*use @option{arm7_9 fast_memory_access} command with same args
+@*use @option{arm7_9 fast_memory_access} command with same args. @xref{arm7_9 fast_memory_access}.
 @item @b{flash auto_erase}
 @cindex flash auto_erase
-@*use @option{flash write_image} command passing @option{erase} as the first parameter.
+@*use @option{flash write_image} command passing @option{erase} as the first parameter. @xref{flash write_image}.
 @item @b{daemon_startup}
 @cindex daemon_startup
 @*this config option has been removed, simply adding @option{init} and @option{reset halt} to
@@ -1487,12 +2080,12 @@ the end of your config script will give the same behaviour as using @option{daem
 and @option{target cortex_m3 little reset_halt 0}.
 @item @b{arm7_9 sw_bkpts}
 @cindex arm7_9 sw_bkpts
-@*On by default. See also @option{gdb_breakpoint_override}. 
+@*On by default. See also @option{gdb_breakpoint_override}. @xref{gdb_breakpoint_override}.
 @item @b{arm7_9 force_hw_bkpts}
 @cindex arm7_9 force_hw_bkpts
 @*Use @option{gdb_breakpoint_override} instead. Note that GDB will use hardware breakpoints
 for flash if the gdb memory map has been set up(default when flash is declared in
-target configuration).
+target configuration). @xref{gdb_breakpoint_override}.
 @item @b{run_and_halt_time}
 @cindex run_and_halt_time
 @*This command has been removed for simpler reset behaviour, it can be simulated with the
@@ -1508,6 +2101,22 @@ halt
 @chapter FAQ
 @cindex faq
 @enumerate
+@item Why does not backslashes in paths under Windows doesn't work?
+
+OpenOCD uses Tcl and a backslash is an escape char. Use @{ and @}
+around Windows filenames. 
+
+@smallexample
+> echo \a
+
+> echo @{\a@}
+\a
+> echo "\a"
+
+>
+@end smallexample
+To 
+
 @item OpenOCD complains about a missing cygwin1.dll.
 
 Make sure you have Cygwin installed, or at least a version of OpenOCD that

Linking to existing account procedure

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

SSH host keys fingerprints

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