Hi
I’m trying to script OpenOCD to upload to Flash (write to flash) for a nRF51822
Currently I have been running the openocd exe then telnetting and issueing the commands
halt
flash write_image erase myfile.hex 0
restart
However, I’d really like to be able to script this up, so its run automatically.
I know I can probably do this my piping the commands into telnet, but as OpenOCD seems to be able to have commands (or possibly just one command) passed with the --command option, I was hoping that either I could pass commands on the command line, or possibly run a commands script.
The command script is not ideal as the filename of the hex file to flash changes depending on the project, so ideally I’d like to pass commands
But I’ve tried a few things and even the basics like
openocd --command halt
doesnt seem to work.
So I’m obviously doing something completely wrong.
Perhaps I need to use GDB, but in which case I don’t know how to tell gdb to do the flash write_image erase, as it only seems to have the mass_erase command, and this isnt ideal as it will wipe the whole MCU including the bootloader.
Thanks