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.

Command

Description

version

Displays a string identifying the OpenOCD version

help

With no parameters, prints the help text for all commands

shutdown

Closes the OpenOCD server, disconnecting all clients

log_output

Redirects logging to the file name; the initial log output channel is stderr

debug_level

Displays the debug level

reset_config

Displays or modifies the reset configuration of your combination of the board and target

adapter speed

Sets the non-zero speed in kHz for the debug adapter

adapter serial

Sets the serial_number of the adapter to use

transport list

Displays the names of the transports supported by this version of OpenOCD

transport select

Selects a supported transport to use in this OpenOCD session

targets

Displays a table of all known targets, or sets the current target to a given target with a given name

scan_chain

Displays 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

init

Terminates the configuration stage and enters the run stage

reset [run] [halt] [init]

Performs as hard a reset as possible, using SRST if possible

program

Programs a given programming file in the HEX, SREC, BIN, or ELF formats into flash

erase_all

Erases the flash memory

flash banks

Prints a one-line summary of each flash bank of the target device

flash info

Prints info about the flash bank, a list of protection blocks, and their status

flash protect

Enables (on) or disables (off) protection of flash blocks

flash erase_sector

Erases sectors in a given bank

flash erase_address

Erases sectors starting at a given address

flash write_bank

Writes the binary file to a given flash bank

flash write_image

Writes 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_bank

Reads bytes from the flash bank and writes the contents to the binary file

flash verify_bank

Compares the contents of the binary file with the contents of the flash

flash padded_value

Sets the default value used for padding-any-image sections

flash rmw

Can be used to modify flash individual bytes

add_verify_range

Allows specifying the memory regions to be compared during the verify operation

show_verify_ranges

Displays 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_ranges

Deletes all verify ranges for the specified target that were added using the add_verify_range command

verify_image

Verifies a file against the target memory starting at a given address

verify_image_checksum

Verifies a file against the target memory starting at a given address

load_image

Loads an image from a file to the target memory offset from its load address

dump_image

Dumps bytes of the target memory to a binary file

kitprog3 acquire_config

Controls device acquisition parameters, and optionally enables acquisition during the early initialization phase

kitprog3 acquire_psoc

Performs device acquisition

kitprog3 power_config

Controls KitProg3/MiniProg4 internal power supply parameters and optionally enables power

kitprog3 led_control

Controls KitProg3/MiniProg4 LEDs

kitprog3 get_power

Reports the target voltage in millivolts

psoc6/cat1c/traveo2/xmc5xxx sflash_restrictions

Enables or disables writes to dedicated SFlash regions

psoc6/cat1c/traveo2/xmc5xxx allow_efuse_program

Allows or disallows writes to the EFuse region

psoc6/cat1c/traveo2/xmc5xxx reset_halt

Simulates a broken vector catch on MCU

psoc4/cat1c/traveo2/xmc5xxx ecc_error_reporting

Enables 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_acquire

Performs acquisition of PSOC™ 64 "Secure Boot" MCUs

psoc4 reset_halt

Performs the alternate acquire sequence

psoc4 mass_erase

Performs a mass erase operation on the given flash bank

psoc4 chip_protect

Changes chip protection mode to PROTECTED

psoc4 kill_mode

Changes chip protection mode to KILL

source

Reads a file and executes it as a Tcl script

find

Finds and returns the full path to a file with the Tcl script

set

Creates a Tcl variable

add_script_search_dir

Adds a directory to the file/script search path

sleep

Waits for a given number of milliseconds before resuming