I've heard that OpenOCD is supposed to daemonize after running some commands.
I try giving commands as CLI arguments. The commands are run, but OpenOCD does not background afterwards, so GDB is never run. I could add '&' to the end of the openocd command, but then I have a race condition with GDB.
How can I make OpenOCD daemonize after loading the flash?
13 # Launch OpenOCD
14 # specify our hardware debugger and mcu type
15 # reset target
16 # erase in bank 0 from 20k (0x5000) to end of flash
17 # load hex format because elf has extraneous section at 0x00000000
18 # NOTE: we don't use 'erase' so we can't blow away bootloader
19 # ??? daemonize when done so GDB can run
20 openocd -f interface/olimex-arm-usb-tiny-h.cfg -f target/stm32f1x.cfg \
21 -l .openocd.log \
22 -c "init" -c "reset init" \
23 -c "flash erase_sector 0 20 last" \
24 -c "flash write_image $HEXFILE"
25
26 # run gdb
...