VSCode JTAG debugging not working
Posted: Mon Apr 07, 2025 9:27 am
I'm trying to run JTAG OpenOCD debugging on my ESP32-S3 using VSCode.
I’ve set JTAG as the main port and configured the board properly, but when I try to flash or debug, it doesn't work (it does work with UARTT). I suspect that the OpenOCD command isn't picking up the correct config file.
However, if I manually launch OpenOCD from the ESP-IDF terminal, I can flash the board—but I still can't debug, since the debugger complains that the port is already in use by the manually started OpenOCD instance.
I changed the config file in settings.json, from something called ***_bridge.cfg file, to this:
And now I’m able to flash and monitor over JTAG without having to start the OpenOCD server manually. But when I try to start a debug session, the output just hangs at this point:
VSCode recognises that some sort of debuggin session is happening but no breakpoints are hit trying to pause/restart the debugger either crashes or does nothing, for some context i'll put my launch.json and settings.json configs.
launch.json configuration:
settings.json config:
Any help would be immensely appreciated.
I’ve set JTAG as the main port and configured the board properly, but when I try to flash or debug, it doesn't work (it does work with UARTT). I suspect that the OpenOCD command isn't picking up the correct config file.
However, if I manually launch OpenOCD from the ESP-IDF terminal, I can flash the board—but I still can't debug, since the debugger complains that the port is already in use by the manually started OpenOCD instance.
I changed the config file in settings.json, from something called ***_bridge.cfg file, to this:
Code: Select all
"idf.openOcdConfigs": [
"board/esp32s3-builtin.cfg"
]
Code: Select all
/Users/<myusername>/.espressif/tools/xtensa-esp-elf-gdb/15.2_20241112/xtensa-esp-elf-gdb/bin/xtensa-esp32s3-elf-gdb
launch.json configuration:
Code: Select all
{
"type": "gdbtarget",
"request": "attach",
"name": "Eclipse CDT GDB Adapter",
"program": "${workspaceFolder}/build/${command:espIdf.getProjectName}.elf",
"initCommands": [
"target remote :3333",
"set remote hardware-watchpoint-limit IDF_TARGET_CPU_WATCHPOINT_NUM",
"mon reset halt",
"maintenance flush register-cache"
],
"gdb": "${command:espIdf.getToolchainGdb}",
"target": {
"connectCommands": [
"set remotetimeout 20",
"-target-select extended-remote localhost:3333"
]
}
}Code: Select all
{
"C_Cpp.intelliSenseEngine": "default",
"idf.espIdfPathWin": "C:\\Users\\conta\\esp\\v5.4\\esp-idf",
"idf.pythonInstallPath": "/Users/<username>/anaconda3/bin/python",
"idf.openOcdConfigs": [
"board/esp32s3-builtin.cfg"
],
"idf.portWin": "COM3",
"idf.toolsPathWin": "C:\\Users\\conta\\.espressif",
"idf.flashType": "JTAG",
"idf.customExtraVars": {
"IDF_TARGET": "esp32s3"
},
"idf.port": "/dev/tty.usbmodem101",
"files.associations": {
"*.json": "jsonc",
"nvs_flash.h": "c",
"esp_log.h": "c",
"esp_netif.h": "c",
"esp_mac.h": "c",
"tcp_server.h": "c"
}
}