When an OpenOCD config file specifies a target_script, the script file must reside in the directory that contains the OpenOCD executable, or the complete path to the script file must be specified in the config file. This is an inconvienience when it comes to writing “portable” code. Presently I use shell commands to dynamically create a config file to pass to OpenOCD with the -f switch, but that is awkward.
I see two solutions to this:
- Make it possible to specify the target_script on the command line rather than from the .cfg file. My thinking is that the target_script line should remain in the .cfg file with the exception of the actual script filename. Thus, a script could be called from the command line like so:
openocd-ftd2xx.exe -f configfile.cfg -s scriptfile.script
To maintain backwards compatibility, -s option would over-ride any file that might be specified in the config file.
- As an alternative to the above, why not allow script commands to be specified within the .cfg file, instead of refering to an external file??? For example:
Proposed method to specify script within .cfg file
target_script 0 reset internal
script halt
script sleep 10
script flash probe 0
script flash write 0 image.bin 0x0
script sleep 10
script shutdown
(Or the script could be enclosed with <target_script 0 reset> </target_script> tags or similar.)
Comments?
- Joe