OpenOCD Debugging
Espressif chips require a custom OpenOCD build with ESP32-specific patches. Download the latest release from OpenOCD for ESP32.
For detailed JTAG setup instructions, see JTAG debugging for ESP32.
Zephyr Thread Awareness
OpenOCD supports Zephyr RTOS thread awareness, allowing GDB to:
List all threads with
info threadsDisplay thread names, priorities, and states
Switch between thread contexts
Show backtraces for any thread
Requirements:
OpenOCD ESP32 v0.12.0-esp32-20251215 or later
Build with
CONFIG_DEBUG_THREAD_INFO=y
Example:
# From the root of the zephyr repository
west build -b <board> samples/hello_world -- -DCONFIG_DEBUG_THREAD_INFO=y -DOPENOCD=<path/to/bin/openocd> -DOPENOCD_DEFAULT_PATH=<path/to/openocd/share/openocd/scripts>
west debug
Using a Custom OpenOCD
The Zephyr SDK includes a bundled OpenOCD, but it may not have ESP32 support. To use the Espressif OpenOCD, specify the path when building:
# From the root of the zephyr repository
west build -b <board> samples/hello_world -- -DOPENOCD=/path/to/openocd -DOPENOCD_DEFAULT_PATH=/path/to/openocd/scripts
west debug