---
** [tickets:#293] STM8 program command fails with "invalid subcommand
write_image erase.."**
**Status:** new
**Milestone:** 0.10.0
**Labels:** stm8 flashing
**Created:** Sat Jan 16, 2021 05:37 PM UTC by Maximilian Gerhardt
**Last Updated:** Sat Jan 16, 2021 05:37 PM UTC
**Owner:** nobody
**Attachments:**
-
[firmware.bin](https://sourceforge.net/p/openocd/tickets/293/attachment/firmware.bin)
(2.6 kB; application/octet-stream)
-
[firmware.ihx](https://sourceforge.net/p/openocd/tickets/293/attachment/firmware.ihx)
(6.3 kB; application/octet-stream)
Using PlatformIO I've generated a blinky firmware for an STM8S (firmware in
intelhex format attached).
I can also flash the target file using https://github.com/vdudouyt/stm8flash
~~~
stm8flash.exe -c stlinkv21 -u -p stm8s103?3 -c stlinkv2 -s flash -w
"C:\Users\Max\Documents\PlatformIO\Projects\stm8_testing\.pio\build\stm8sblue\firmware.ihx"
Determine FLASH area
libusb: error [init_device] device
'\\.\USB#VID_062A&PID_5918&MI_01#9&1953ACC1&0&0001' is no longer connected!
Due to its file extension (or lack thereof),
"C:\Users\Max\Documents\PlatformIO\Projects\stm8_testing\.pio\build\stm8sblue\firmware.ihx"
is considered as INTEL HEX format!
2576 bytes at 0x8000... OK
Bytes written: 2576
~~~
And it runs fine. Using OpenOCD, I can connect to the chip
~~~
>C:\Users\Max\.platformio\packages/tool-openocd/bin/openocd -f
>interface\stlink-dap.cfg -f target\stm8s103.cfg
xPack OpenOCD, x86_64 Open On-Chip Debugger 0.10.0+dev-00378-ge5be992df
(2020-06-26-09:29)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
srst_only separate srst_gates_jtag srst_open_drain connect_deassert_srst
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : STLINK V2J37S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.253616
Info : clock speed 800 kHz
Info : starting gdb server for stm8s.cpu on 3333
Info : Listening on port 3333 for gdb connections
target halted due to undefined, pc: 0x00008000
~~~
However I cannot get OpenOCD to program the target chip. Using the command
~~~
>C:\Users\Max\Downloads\xpack-openocd-0.10.0-15\bin\openocd -f
>interface\stlink-dap.cfg -f target\stm8s103.cfg -c "program
>{C:\Users\Max\Documents\PlatformIO\Projects\stm8_testing\.pio\build\stm8sblue\firmware.ihx}
> verify reset exit"
xPack OpenOCD, x86_64 Open On-Chip Debugger 0.10.0+dev (2020-10-13-17:29)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
srst_only separate srst_gates_jtag srst_open_drain connect_deassert_srst
Info : STLINK V2J37S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.253616
Info : clock speed 800 kHz
Info : starting gdb server for stm8s.cpu on 3333
Info : Listening on port 3333 for gdb connections
target halted due to debug-request, pc: 0x00008000
** Programming Started **
flash
flash bank bank_id driver_name base_address size_bytes chip_width_bytes
bus_width_bytes target [driver_options ...]
flash banks
flash init
flash list
gdb_flash_program ('enable'|'disable')
nand
program <filename> [address] [pre-verify] [verify] [reset] [exit]
stm8 enable_stm8l [1/0]
stm8s.cpu stm8 enable_stm8l [1/0]
Error: invalid subcommand "write_image erase
C:\Users\Max\Documents\PlatformIO\Projects\stm8_testing\.pio\build\stm8sblue\firmware.ihx"
** Programming Failed **
shutdown command invoked
embedded:startup.tcl:583: Error:
at file "embedded:startup.tcl", line 583
~~~
Also doesn't work with the `.elf` or `.bin` versions of the firmware.
~~~
>C:\Users\Max\Downloads\xpack-openocd-0.10.0-15\bin\openocd -f
>interface\stlink-dap.cfg -f target\stm8s103.cfg -c "program
>{C:\Users\Max\Documents\PlatformIO\Projects\stm8_testing\.pio\build\stm8sblue\firmware.bin}
> 0x8000 verify reset exit"
xPack OpenOCD, x86_64 Open On-Chip Debugger 0.10.0+dev (2020-10-13-17:29)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
srst_only separate srst_gates_jtag srst_open_drain connect_deassert_srst
Info : STLINK V2J37S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.253616
Info : clock speed 800 kHz
Info : starting gdb server for stm8s.cpu on 3333
Info : Listening on port 3333 for gdb connections
target halted due to debug-request, pc: 0x00008000
** Programming Started **
flash
flash bank bank_id driver_name base_address size_bytes chip_width_bytes
bus_width_bytes target [driver_options ...]
flash banks
flash init
flash list
gdb_flash_program ('enable'|'disable')
nand
program <filename> [address] [pre-verify] [verify] [reset] [exit]
stm8 enable_stm8l [1/0]
stm8s.cpu stm8 enable_stm8l [1/0]
Error: invalid subcommand "write_image erase
C:\Users\Max\Documents\PlatformIO\Projects\stm8_testing\.pio\build\stm8sblue\firmware.bin
0x8000"
** Programming Failed **
shutdown command invoked
embedded:startup.tcl:583: Error:
at file "embedded:startup.tcl", line 583
~~~
Is my `"program
{C:\Users\Max\Documents\PlatformIO\Projects\stm8_testing\.pio\build\stm8sblue\firmware.bin}
0x8000 verify reset exit"` command malformed? I've tried a lot of different
combinations but I can't get past that errror. Or is `write_image` not
supported for STM8 targets?
---
Sent from sourceforge.net because openocd-devel@lists.sourceforge.net is
subscribed to https://sourceforge.net/p/openocd/tickets/
To unsubscribe from further messages, a project admin can change settings at
https://sourceforge.net/p/openocd/admin/tickets/options. Or, if this is a
mailing list, you can unsubscribe from the mailing list.
_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel