openocdgdb example.elf(gdb) target remote localhost:3333monitor reset , monitor halt , monitor reset halt monitor actually issues OpenOCD commands thru GDB.monitor verify_image /full/path/to/my.elfActually the search path is the directory that OpenOCD started in.
monitor flash write_image erase /full/path/to/my.elfgdb -ex "target remote localhost:3333" ~/my.elfv1=copy-paste-your-path-to-elf-here.elf
(echo flash write_image erase $(pwd)/$v1 ; sleep 1) | telnet localhost 4444
```
fetch_and_load() { echo Starting OpenOCD Server openocd -f ~/openocdconfigs/stm32f4discovery/openocd.cfg & echo Fetching and Loading new firmware: $v1 wget ffn.bootladder.com:9001/$v1
(echo reset halt; sleep 1) | telnet localhost 4444
sleep 2
(echo flash write_image erase $(pwd)/$v1 ; sleep 1) | telnet localhost 4444
sleep 2
(echo reset; sleep 1) | telnet localhost 4444
sleep 2
(echo shutdown; sleep 1) | telnet localhost 4444
}
v1=$(curl ffn.bootladder.com:9001/target/ffnbeagle-woodland-stm32discovery 2>/dev/null)
ls $v1 >/dev/null || fetch_and_load
```
This appears to work, but not sure if it works every time. Hence the sleeps.
OpenOCD server is started and stopped for each write_image.
The curl retrieves the contents of the URL, which is a filename
* If the local system has that file, don't do anything.
* If not, grab that file and load it.
Loop the above to achieve automatic firmware updates
while true; do sh fetch-and-load-ffnbeagle-woodland-stm32discovery.sh ; sleep 1; done;
Ahh nice, sudo apt install libhidapi-dev , ./configure --enable-cmsis-dap . Props to http://www.signal11.us/oss/