Closed skanky-dev closed 1 year ago
Hi @skanky-dev
Actually the problem is not related to OpenOCD. Looks like VsCode debug session setup problem.
Do you use Espressif VsCode extention for debugging? Looks like not and you use VsCode builtin debugger instead. Here the description how to setup it. From my side I can tell that -exec-run
is wrong command when you already run the program and stopped at app_main
. -exec-continue
or its equivalent -interpreter-exec console "c"
should be used instead. But sorry I can not tell you why VsCode builtin debugger use -exec-run
in your case. I know that many people use it successfully for Espressif chips, so looks like configuration problem.
If you want to use Espressif VsCode extention for debugging, please have a look at how to setup it and how to debug with it and more details on debug configuration.
Hi, as far as I'm aware I'm already using the Espressif VsCode extension. This is my launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "OpenOCD Debugging",
"type": "gdb",
"request": "launch",
"printCalls": true,
"target": "./build/100_216_project1.elf",
"cwd": "${workspaceFolder}",
"autorun": [
"target remote :3333",
"mon reset halt",
"mon program_esp ./build/100_216_project1.bin 0x10000",
"flushregs",
"thb app_main",
"c"
],
"preLaunchTask": "openocd_debug",
"gdbpath": "C:\\Users\\Dev\\.espressif\\tools\\xtensa-esp32-elf\\esp-2021r2-patch5-8.4.0\\xtensa-esp32-elf\\bin\\xtensa-esp32-elf-gdb"
}
]
}
And this is my tasks.json openocd_debug task
{
"label": "openocd_debug",
"type": "shell",
"isBackground": true,
"command": "openocd -s C:\\Users\\Dev\\.espressif\\tools\\openocd-esp32\\v0.11.0-esp32-20220706\\openocd-esp32\\share\\openocd\\scripts -c 'adapter_khz 12000' -f interface\\ftdi\\esp32_devkitj_v1.cfg -f C:\\Users\\Dev\\.espressif\\tools\\openocd-esp32\\v0.11.0-esp32-20220706\\openocd-esp32\\share\\openocd\\scripts\\board\\esp-wroom-32.cfg ",
"problemMatcher": [
{
"pattern": [
{
"regexp": ".",
"file": 1,
"location": 2,
"message": 3
}
],
"background": {
"activeOnStart": true,
"beginsPattern": ".",
"endsPattern": ".",
}
}
]
}
No. It should have "type": "espidf"
like below. See here
{
"version": "0.2.0",
"configurations": [
{
"type": "espidf",
"name": "Launch",
"request": "launch",
"debugPort": 9998,
"logLevel": 2,
"mode": "manual",
"verifyAppBinBeforeDebug": false,
"tmoScaleFactor": 1,
"initGdbCommands": [
"target remote :3333",
"symbol-file /path/to/program.elf",
"mon reset halt",
"flushregs",
"thb app_main"
],
"env": {
"CUSTOM_ENV_VAR": "SOME_VALUE"
}
}
]
}
Thank you!!! I changed that and debugging is now working :-)
Development Kit
Custom board
Module or chip used
ESP32-WROOM-32E
Debug Adapter
ESP_PROG
OpenOCD version
v0.11.0-esp32-20220706
Operating System
Win10 Pro
Using an IDE ?
VS Code
OpenOCD command line
F5
JTAG Clock Speed
20000 kHz
ESP-IDF version
esp-idf-v4.4.3
Problem Description
Press F5 to debug project Programs as expected, sets up to start debugging as expected and then VS Code shows pop up message "Could not run/continue: Don't know how to run. Try "help target". (from exec-run)"
This is an existing project I've taken over. After extensive searching I can't find any results for this pop up error message and after working through everything I can think of on the project config I can't find what the problem might be!
Debug Logs
Expected behavior
Debugging to start as normal
Screenshots
No response