Using OpenOCD with VisualGDB

OpenOCD is an open-source tool that provides support for many inexpensive JTAG/SWD debuggers that don’t come with their own software. The OpenOCD tool is very flexible and powerful, however it requires some initial setup for most of the cases. VisualGDB simplifies the initial setup by providing user interface with shortcuts to most frequently used functionality.

VisualGDB can automatically install the following OpenOCD forks, based on the device you are debugging:

OpenOCD fork Original fork Recommended devices
OpenOCD-ST https://github.com/STMicroelectronics/OpenOCD Multi-core STM32H7 devices
OpenOCD-RP2040 (integrated into mainline OpenOCD) https://github.com/raspberrypi/openocd/ Raspberry Pi Pico (RP2040)
OpenOCD-STM32MP https://github.com/STMicroelectronics/device-stm-openocd STM32MP1
OpenOCD-Kendryte https://github.com/kendryte/openocd-kendryte Kendryte K210
OpenOCD-ESP8266 https://github.com/projectgus/openocd ESP8266
OpenOCD-ESP32 https://github.com/espressif/openocd-esp32 ESP32
OpenOCD-Mainline git://git.code.sf.net/p/openocd/code All other devices (including regular STM32)

VisualGDB provides convenient GUI for configuring the OpenOCD and managing the JTAG debugger drivers. In most cases, you can simply select the debug interface and the target device, and VisualGDB will configure OpenOCD automatically:You can always tweak the OpenOCD parameters by expanding the “Advanced Settings” view and editing the OpenOCD command line, or the GDB commands used to start the debug session.

Differences between the Mainline OpenOCD and the ST Fork

The mainline OpenOCD reliably supports most of the regular ARM-based devices (including the STM32 devices). However, it lacks support for debugging multi-core STM32H7 devices with ST-Link and uses slightly different implementations for some low-level functions.

We recommend using the mainline OpenOCD for most debug configurations, unless you need to debug both cores of a multi-core device at the same time.

If you are planning to debug multiple cores, or experience problems with the regular OpenOCD branch, please consider using the ST fork. It is based on the same code base as the version shipped with the STM32CubeIDE and should behave the same way.

Troubleshooting

If you encounter OpenOCD errors while trying to debug your target, check this page for troubleshooting instructions for most common issues.