Trying out PlatformIO for the 1st time I am having problems uploading to a module. No doubt I am missing some setting.
ST-Link seems correctly connected, and COM4 appears to work. The test program compiles. This board works ok on the ARM compiler IDE.
Any suggestion would be appreeciated.
Terminal output is:
Uploading .pio\build\nucleo_f303k8\firmware.elf
xPack Open On-Chip Debugger 0.12.0-01004-g9ea7f3d64-dirty (2023-01-30-15:04)
Licensed under GNU GPL v2
For bug reports, read OpenOCD: Bug Reporting
debug_level: 1
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
[stm32f3x.cpu] halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08000300 msp: 0x20003000
** Programming Started **
Warn : Adding extra erase range, 0x08007c30 … 0x08007fff
Error: error writing to flash at address 0x08000000 at offset 0x00000000
embedded:startup.tcl:1516: Error: ** Programming Failed **
in procedure ‘program’
in procedure ‘program_error’ called at file “embedded:startup.tcl”, line 1581
at file “embedded:startup.tcl”, line 1516
*** [upload] Error 1
=========================== [FAILED] Took 7.87 seconds ===========================
I also got the Nucleo_f303k8 board with legit STM32F103 STLink, but the same error message, if I use upload_protocol = stlink. Error: error writing to flash at address 0x08000000 at offset 0x00000000.
The adress changes dependet if the code changes.
I didnt got the unexpected idcode, because I cant reproduce the unlocking procedure.
A new question rises: How to debug using the onboard STLink. If I append debug_tool = stlink the programm compiles successful, but the terminal wont show the mbed upload procedure unlike in “regulare” Upload. 3 seconds later the STLink LEDs blink like in the programming procedure but stops 1 sec after it. No Debugger window (Step into, Step over,…) ever appear.
I have the same issue, but only on my Ubuntu setup (VScode with latest pio --dev) it uses OpenOCD v12 as described in the first post of this thread.
Only upload_protocol = mbed works
I have another setup on MacOS, but it uses OpenOCD v11, and it works great with upload_protocol = stlink
** Programming Started **
Warn : Adding extra erase range, 0x0800325c .. 0x080037ff
Error: error writing to flash at address 0x08000000 at offset 0x00000000
embedded:startup.tcl:1516: Error: ** Programming Failed **
in procedure 'program'
in procedure 'program_error' called at file "embedded:startup.tcl", line 1581
at file "embedded:startup.tcl", line 1516
*** [upload] Error 1
If I take the firmware.elf and upload it via STM32CubeProgrammer it works fine.