OpenOCD commands
OpenFacts, the Open Source Knowledge Database
The Open On-Chip Debugger (OpenOCD) allows user interaction through a telnet interface (default: port 4444) and a GDB server (default: port 3333). The command line interpreter is available from both the telnet interface and a GDB session. To issue commands to the interpreter from within a GDB session, use the "monitor" command, e.g. use 'monitor poll' to issue the 'poll' command. All output is relayed through the GDB session.
This page is supposed to document the current state of the OpenOCD - i.e. the latest version available from SVN.
Daemon
- sleep <msec>
- Wait for n milliseconds before resuming. Useful in connection with script files ('script' command and 'target_script' configuration).
- shutdown
- Close the OpenOCD daemon, disconnecting all clients (GDB, Telnet).
- debug_level [n]
- Display or adjust debug level to n<0-3>
- log_output <file>
- Redirect logging to <file> (default: stderr)
- script <file>
- Execute commands from <file>
Target state handling
- poll ['on'|'off']
- Poll the target for its current state. If the target is in debug mode, architecture specific information about the current state are printed. An optional parameter allows continuous polling to be enabled and disabled.
- halt
- Send a halt request to the target. The debugger signals the debug request, and waits for the target to enter debug mode.
- resume [address]
- Resume the target at its current code position, or at an optional address.
- step [address]
- Single-step the target at its current code position, or at an optional address.
- reset ['run'|'halt'|'init'|'run_and_halt'|'run_and_init']
- Do a hard-reset. The optional parameter specifies what should happen after the reset. This optional parameter overwrites the setting specified in the configuration file, making the new behaviour the default for the 'reset' command.
- run: Let the target run.
- halt: Immediately halt the target (works only with certain configurations).
- init: Immediately halt the target, and execute the reset script (works only with certain configurations)
- run_and_halt: Let the target run for a certain amount of time, then request a halt.
- run_and_init: Let the target run for a certain amount of time, then request a halt. Execute the reset script once the target entered debug mode.
Memory access commands
These commands allow accesses of a specific size to the memory system:- mdw <addr> [count]
- display memory words
- mdh <addr> [count]
- display memory half-words
- mdb <addr> [count]
- display memory bytes
- mww <addr> <value>
- write memory word
- mwh <addr> <value>
- write memory half-word
- mwb <addr> <value>
- write memory byte
- load_image <file> <address> ['bin'|'ihex'|'elf']
- Load image <file> to target memory at <address>
- dump_image <file> <address> <size>
- Dump <size> bytes of target memory starting at <address> to a (binary) <file>.
- load_binary <file> <address> [DEPRECATED]
- Load binary <file> to target memory at <address>
- dump_binary <file> <address> <size> [DEPRECATED]
- Dump <size> bytes of target memory starting at <address> to a (binary) <file>.
Flash commands
- flash banks
- List configured flash banks
- flash info <num>
- Print info about flash bank <num>
- flash probe <num>
- Identify the flash, or validate the parameters of the configured flash. Operation depends on the flash type.
- flash erase_check <num>
- Check erase state of sectors in flash bank <num>. This is the only operation that updates the erase state information displayed by 'flash info'. That means you have to issue an 'erase_check' command after erasing or programming the device to get updated information.
- flash protect_check <num>
- Check protection state of sectors in flash bank <num>.
- flash erase <num> <first> <last>
- Erase sectors at bank <num>, starting at sector <first> up to and including <last>. Sector numbering starts at 0. Depending on the flash type, erasing might require the protection to be disabled first (e.g. Intel Advanced Bootblock flash using the CFI driver).
- flash write <num> <file> <offset> [DEPRECATED]
- Write the binary <file> to flash bank <num>, starting at <offset> bytes from the beginning of the bank. This command was replaced by the new command 'flash write_binary' using the same syntax.
- flash write_binary <num> <file> <offset>
- Write the binary <file> to flash bank <num>, starting at <offset> bytes from the beginning of the bank.
- flash write_image <file> [offset] [type]
- Write the image <file> to the current target's flash bank(s). A relocation [offset] can be specified and the file [type] can be specified explicitly as 'bin' (binary), 'ihex' (Intel hex), 'elf' (ELF file) or 's19' (Motorola s19).
- flash protect <num> <first> <last> <'on'|'off'>
- Enable ('on') or disable ('off') protection of flash sectors <first> to <last> of flash bank <num>.
- flash auto_erase <on|off>
- Enable ('on') to erase flash banks prior to writing using the flash write_image command only. Default is ('off'), flash banks have to be erased using flash erase command.
OpenOCD - Target/Processor specific commands
OpenOCD - Architecture specific commands
OpenOCD - Low level debug and JTAG commands
This page has been written as part of the Open On-Chip Debugger project.
![[Main Page]](http://openfacts.berlios.de/images/berliOS_small_logo.png)