Re: HOWTO: Flashing with ST-Link v2
Posted: Mon Apr 06, 2020 7:36 pm
post deleted
openinverter Community
https://www.openinverter.org/forum/
Code: Select all
$ brew install openocd
$ brew install telnet
Code: Select all
`apt install`
Code: Select all
$ sudo /usr/local/bin/openocd -f /usr/local/share/openocd/scripts/interface/stlink-v2.cfg -f /usr/local/share/openocd/scripts/target/stm32f1x.cfg
Code: Select all
Open On-Chip Debugger 0.11.0
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : clock speed 1000 kHz
Info : STLINK V2J17S4 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.225688
Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : starting gdb server for stm32f1x.cpu on 3333
Info : Listening on port 3333 for gdb connections
Code: Select all
$ telnet localhost 4444
Code: Select all
Connected to localhost.
Escape character is '^]'.
Open On-Chip Debugger
Code: Select all
> flash probe 0
Code: Select all
device id = 0x20036410
STM32 flash size failed, probe inaccurate - assuming 128k flash
flash size = 128kbytes
Device Security Bit Set
flash 'stm32f1x' found at 0x08000000
Code: Select all
> reset halt
Code: Select all
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0xfffffffe msp: 0xfffffffc
Code: Select all
> stm32f1x unlock 0
Code: Select all
stm32x unlocked.
INFO: a reset or power cycle is required for the new settings to take effect.
Code: Select all
> reset halt
Code: Select all
> flash write_image erase /path/to/files/stm32_loader.hex
> flash write_image /path/to/files/stm32_firmware.hex
Code: Select all
> flash write_image erase /path/to/files/stm32_loader.bin 0x08000000 bin
> flash write_image /path/to/files/stm32_firmware.bin 0x08001000 bin
Code: Select all
> reset
Code: Select all
> shutdown
This push-pin SWD-connector is sort of proprietary. Its cheap to produce on PCB, but the connector is way too expensive. Please do not support this connector and just solder the wires on the pads. When done with flashing, unsolder the wires again when there is a risk of accidentally pulling on the soldered wires.