I'm on a system with external flash, so I'm unable to program it easily. However, I can load firmware through JTAG - OpenOCD - GDB chain. I automated it as far as I'm able with bash and .gdbinit, but it's, well... shit. Doesn't work most of the time, I have to constantly fix it by hand or power cycle the board.

So I was wondering, does anyone knows a way to load a program using only OpenOCD?

In essence I'm looking to implement following GDB commands in OpenOCD script:

monitor reset halt

They've got their own fork of OpenOCD. I'm pretty sure I can't use OpenOCD's program or flash commands, it's the first thing I tried.