This is taken from OpenOCD User’s manual
Configuration files and scripts are searched for in
- the current directory,
- any search dir specified on the command line using the
-soption, - any search dir specified using the
add_script_search_dircommand, - a directory in the
OPENOCD_SCRIPTSenvironment variable (if set), %APPDATA%/OpenOCD(only on Windows
),$HOME/Library/Preferences/org.openocd(only on Darwin
),$XDG_CONFIG_HOME/openocd($XDG_CONFIG_HOMEdefaults to$HOME/.config),$HOME/.openocd,- the site wide script library
$pkgdatadir/site($pkgdatadiris compile time variable and usually set to/usr/share/openocd/, and - the OpenOCD-supplied script library
$pkgdatadir/scripts.
The first found file with a matching file name will be used.