Skip to main content

OpenOCD commands overview

The available OpenOCD Tcl commands are listed in the following table. You can combine several commands in a single command-line or pass them via a configuration file.

The command can be invoked with the -c command option.

CommandDescription
versionDisplays a string identifying the OpenOCD version
helpWith no parameters, prints the help text for all commands
shutdownCloses the OpenOCD server, disconnecting all clients
log_outputRedirects logging to the file name; the initial log output channel is stderr
debug_levelDisplays the debug level
reset_configDisplays or modifies the reset configuration of your combination of the board and target
adapter speedSets the non-zero speed in kHz for the debug adapter
adapter serialSets the serial_number of the adapter to use
transport listDisplays the names of the transports supported by this version of OpenOCD
transport selectSelects a supported transport to use in this OpenOCD session
targetsDisplays a table of all known targets, or sets the current target to a given target with a given name
scan_chainDisplays the TAPs in the scan chain configuration and their status
md(w)(h)(b)Displays the contents of the address as 32-bit words (mdw), 16-bit half-words (mdh), or 8-bit bytes (mdb)
mw(w)(h)(b)Writes the specified word (32 bits), half-word (16 bits), or byte (8-bit) value, at the specified address
initTerminates the configuration stage and enters the run stage
reset [run] [halt] [init]Performs as hard a reset as possible, using SRST if possible
programPrograms a given programming file in the HEX, SREC, BIN, or ELF formats into flash
erase_allErases the flash memory
flash banksPrints a one-line summary of each flash bank of the target device
flash infoPrints info about the flash bank, a list of protection blocks, and their status
flash protectEnables (on) or disables (off) protection of flash blocks
flash erase_sectorErases sectors in a given bank
flash erase_addressErases sectors starting at a given address
flash write_bankWrites the binary file to a given flash bank
flash write_imageWrites the image file to the current target's flash bank(s)
flash fill(w)(h)(b)Fills the flash memory with the specified word (32 bits), half-word (16 bits), or byte
flash read_bankReads bytes from the flash bank and writes the contents to the binary file
flash verify_bankCompares the contents of the binary file with the contents of the flash
flash padded_valueSets the default value used for padding-any-image sections
flash rmwCan be used to modify flash individual bytes
add_verify_rangeAllows specifying the memory regions to be compared during the verify operation
show_verify_rangesDisplays all active verify ranges for all targets that were added using the add_verify_range command. This command does not take any arguments
clear_verify_rangesDeletes all verify ranges for the specified target that were added using the add_verify_range command
verify_imageVerifies a file against the target memory starting at a given address
verify_image_checksumVerifies a file against the target memory starting at a given address
load_imageLoads an image from a file to the target memory offset from its load address
dump_imageDumps bytes of the target memory to a binary file
kitprog3 acquire_configControls device acquisition parameters, and optionally enables acquisition during the early initialization phase
kitprog3 acquire_psocPerforms device acquisition
kitprog3 power_configControls KitProg3/MiniProg4 internal power supply parameters and optionally enables power
kitprog3 led_controlControls KitProg3/MiniProg4 LEDs
kitprog3 get_powerReports the target voltage in millivolts
psoc6/cat1c/traveo2/xmc5xxx sflash_restrictionsEnables or disables writes to dedicated SFlash regions
psoc6/cat1c/traveo2/xmc5xxx allow_efuse_programAllows or disallows writes to the EFuse region
psoc6/cat1c/traveo2/xmc5xxx reset_haltSimulates a broken vector catch on MCU
psoc4/cat1c/traveo2/xmc5xxx ecc_error_reportingEnables or disables the ECC error reporting
cat1c/traveo2/xmc5xxx wflash blank_map [first_sector [last_sector | 'last']]Displays per-word validity map of the given sectors of Fork Flash
cat1c/traveo2/xmc5xxx wflash write_image [filename] [offset]Programs individual 32-bit words from given file to the Work Flash
cat1c/traveo2/xmc5xxx wflash write_words [address] [word_1] [word_2] ... [word_N]Modifies individual 32-bit words in Work Flash
psoc6 secure_acquirePerforms acquisition of PSOC™ 64 "Secure Boot" MCUs
psoc4 reset_haltPerforms the alternate acquire sequence
psoc4 mass_erasePerforms a mass erase operation on the given flash bank
psoc4 chip_protectChanges chip protection mode to PROTECTED
psoc4 kill_modeChanges chip protection mode to KILL
sourceReads a file and executes it as a Tcl script
findFinds and returns the full path to a file with the Tcl script
setCreates a Tcl variable
add_script_search_dirAdds a directory to the file/script search path
sleepWaits for a given number of milliseconds before resuming