A hint is the following info
I would advise that if possible use srst for this connection, it is usually easier if you create a openocd.cfg and source files from that, eg.Error: Target not halted
reset_config srst_only srst_nogate
source [find interface/stlink-v2.cfg]
source [find target/stm32f1x_stlink.cfg]
# you can also program from the same file bu calling init
init
reset init
...
I would not recommend to use soft_reset_halt, as it will only reset the core, and not the peripherals - use “reset init”
Infact that cmd was only really intended for arm7/9 targets and is not really for armv7m.
Also the telnet port defaults to 4444, so is not required.
Newer versions of OpenOCD have a programming helper function, eg.
program stm32b-eval.bin 0x08000000 verify
# no address required if using elf/hex/s19
program stm32b-eval.elf verify
If you want this on a cmd line then
openocd -f interface/stlink-v2.cfg -f target/stm32f1x_stlink.cfg -c "program stm32b-eval.elf verify"
But then again if you are using gdb then why not program using gdb load cmd.
Cheers
Spen