source

Reads a file and executes it as a script. It is usually used with the result of the

find

command.

source [find FILENAME]

Example (KitProg3 & PSOC™ Edge MCU):

openocd -s ../scripts -c "source [find interface/kitprog3.cfg]; source [find target/infineon/pse84xgxs2.cfg]; targets; shutdown"

find

Finds and returns a full path to a file with a given name. It is usually used as an argument of the

source

command. This command uses an internal search path. (Do not try to use a filename which includes the "#" character. That character begins Tcl comments.)

source [find FILENAME]

Example (KitProg3 & PSOC™ Edge MCU):

openocd -s ../scripts -c "source [find interface/kitprog3.cfg]; source [find target/infineon/pse84xgxs2.cfg]; targets; shutdown"

set

Stores a value to a named variable, first creating the variable if it does not already exist. Declaration variable must be done before usage.

set VARNAME value

Example (KitProg3 & PSOC™ Edge MCU):

openocd -s ../scripts -c "set ENABLE_CM0 0; source [find interface/kitprog3.cfg]; source [find target/infineon/cy8c6xxx.cfg]; targets; shutdown"

sleep

Waits for at least

msec

milliseconds before resuming. Useful in a combination with script files.

sleep msec

Example:

openocd -c "sleep 1000; shutdown"

add_script_search_dir

Adds a directory to a file/script search path. Equivalent to the

--search

command-line option.

add_script_search_dir [directory]

Example (KitProg3 & PSOC™ Edge MCU):

openocd -c "add_script_search_dir ../scripts; source [find interface/kitprog3.cfg]; source [find target/infineon/pse84xgxs2.cfg]; targets; shutdown"