Openocd is not recognized

Hi all,

thank you for reading this. I am trying to upload code to my Nucleo L053R8. This should be a supported board by pio, but I’m having trouble with the ST-link and openocd. The error that I’m getting is:

openocd' is not recognized as an internal or external command, operable program or batch file

Building the project does show:

PACKAGES:
- framework-arduinoststm32 4.20000.210603 (2.0.0)
- framework-cmsis 2.50700.210515 (5.7.0)
- tool-dfuutil 1.9.200310
- tool-openocd 2.1100.0 (11.0)
- tool-stm32duino 1.0.2
- toolchain-gccarmnoneeabi 1.90201.191206 (9.2.1)

I’m not familiar with the way pio find its packages, but something seems to be going wrong here. I tried adding my own openocd install to the PATH variable (I’m on Windows 10 btw), but that lead to a second error:

Can't find interface/stlink.cfg

Anybody knows how to fix this issue?

Many thanks in advance,
Daan

Nonono, PlatformIO has its own OpenOCD version from the package registry. It should be locally in C:\Users\<user>\.platformio\packages\tool-openocd.

Undo your PATH change and remove the above-mentioned folder to trigger a clean redownload of OpenOCD.

If that still not works, answer these questions:

  • Does C:\Users\<user>\.platformio\packages\tool-openocd\bin\openocd.exe exist?
  • What is the output of the project task “Advanced → Verbose Upload”?
  • What is the platformio.ini?

Thank you for the quick reply. Removing all the tool-openocd packages and rebuilding did the trick!