Stuck with debugging ESP32-S3 in VS-Code

Remyhx
Posts: 23
Joined: Thu Jun 17, 2021 8:22 pm

Stuck with debugging ESP32-S3 in VS-Code

Postby Remyhx » Fri Oct 07, 2022 6:05 am

Hi,

I bought a ESP32-S3 development board to test the USB connection for flashing/debugging and I can flash to the board, but am stuck debugging it. The documentation only mentions steps for eclips and the command line to work.

I am working on a Mac, updated to the latest master IDF. (ESP-IDF v5.1-dev-992-gaf28c1fa21)

My launch.json:

Code: Select all

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "ESP32 OpenOCD",
      "type": "cppdbg",
      "request": "launch",
      "miDebuggerPath": "/Users/remyhurx/.espressif/tools/xtensa-esp32s3-elf/esp-2022r1-11.2.0/xtensa-esp32s3-elf/bin/xtensa-esp32s3-elf-gdb",
      "cwd": "${workspaceFolder}/build",
      //change the name of the elf file as required
      "program": "/Users/remyhurx/Esp-proj/testdebug/build/testdebug.elf",
      "setupCommands": [
        {
          "description": "Enable pretty-printing for gdb",
          "text": "-enable-pretty-printing",
          "ignoreFailures": true
        },
        {
          "text": "target remote :3333"
        },
        {
          "text": "set remote hardware-watchpoint-limit 2"
        },
        {
          "text": "monitor reset halt"
        },
        {
          "text": "flushregs"
        }
      ],
      "externalConsole": false,

      "logging": {
        // "trace": true,
        // "traceResponse": true,
        //"engineLogging": true
      }
    }
  ]
}
Inside Vscode I start openocd one time:

Code: Select all

openocd -f board/esp32s3-builtin.cfg
That results in:
Open On-Chip Debugger v0.11.0-esp32-20220706 (2022-07-06-15:49)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : only one transport option; autoselect 'jtag'
Info : esp_usb_jtag: VID set to 0x303a and PID to 0x1001
Info : esp_usb_jtag: capabilities descriptor set to 0x2000
Warn : Transport "jtag" was already selected
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : esp_usb_jtag: serial (7C:DF:A1:E0:9F:C8)
Info : esp_usb_jtag: Device found. Base speed 40000KHz, div range 1 to 255
Info : clock speed 40000 kHz
Info : JTAG tap: esp32s3.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32s3.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : [esp32s3.cpu0] Target halted, PC=0x40000400, debug_reason=00000000
Info : [esp32s3.cpu1] Target halted, PC=0x40000400, debug_reason=00000000
Info : starting gdb server for esp32s3.cpu0 on 3333
Info : Listening on port 3333 for gdb connections
Then when I build, flash and monitor everything goes well. I go to the debug part at the left.(Run and debug). Press the green play button with the profile next to it and it returns:
Unable to start debugging. Program path '/Users/remyhurx/Esp-proj/testdebug/build/testdebug.elf' is missing or invalid.

GDB failed with message: I'm sorry, Dave, I can't do that. Symbol format `elf32-xtensa-le' unknown.

This may occur if the process's executable was changed after the process was started, such as when installing an update. Try re-launching the application or restarting the machine.
In the terminal:
Warn : No symbols for FreeRTOS!
Info : [esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
Info : Set GDB target to 'esp32s3.cpu0'
Info : Flash mapping 0: 0x10020 -> 0x3c020020, 41 KB
Info : Flash mapping 1: 0x20020 -> 0x42000020, 116 KB
Info : [esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
Info : Auto-detected flash bank 'esp32s3.cpu0.flash' size 8192 KB
Info : Using flash bank 'esp32s3.cpu0.flash' size 8192 KB
Info : [esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
Info : Flash mapping 0: 0x10020 -> 0x3c020020, 41 KB
Info : Flash mapping 1: 0x20020 -> 0x42000020, 116 KB
Info : Using flash bank 'esp32s3.cpu0.irom' size 120 KB
Info : [esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
Info : Flash mapping 0: 0x10020 -> 0x3c020020, 41 KB
Info : Flash mapping 1: 0x20020 -> 0x42000020, 116 KB
Info : Using flash bank 'esp32s3.cpu0.drom' size 44 KB
Info : New GDB Connection: 1, Target esp32s3.cpu0, state: halted
Warn : negative reply, retrying
Warn : Prefer GDB command "target extended-remote :3333" instead of "target remote :3333"
Info : JTAG tap: esp32s3.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32s3.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : [esp32s3.cpu0] requesting target halt and executing a soft reset
Info : [esp32s3.cpu0] Debug controller was reset.
Info : [esp32s3.cpu0] Core was reset.
Info : [esp32s3.cpu0] Target halted, PC=0x500000EF, debug_reason=00000000
Info : [esp32s3.cpu1] requesting target halt and executing a soft reset
Info : [esp32s3.cpu0] Core was reset.
Info : [esp32s3.cpu0] Target halted, PC=0x40000400, debug_reason=00000000
Info : [esp32s3.cpu1] Debug controller was reset.
Info : [esp32s3.cpu1] Core was reset.
Info : [esp32s3.cpu1] Target halted, PC=0x40000400, debug_reason=00000000
Info : dropped 'gdb' connection

What to do?

crazypill
Posts: 1
Joined: Tue Nov 15, 2022 12:28 am

Re: Stuck with debugging ESP32-S3 in VS-Code

Postby crazypill » Tue Nov 15, 2022 12:30 am

I have the same problem on MacOS X 12.6.

I can debug fine with "idf.py gdb" so not sure why this is happening...

yuvaraj
Posts: 1
Joined: Mon Dec 05, 2022 5:45 am

Re: Stuck with debugging ESP32-S3 in VS-Code

Postby yuvaraj » Mon Dec 05, 2022 6:16 am

Hi,

I'm also getting the same problem. But i'm able to debug with ESP32 module. Here i m giving the log for your reference.

cmd

openocd -f board/esp32s3-builtin.cfg

log:

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6

PS C:\Espressif\frameworks\esp-idf-v4.4.3\examples\get-started\blink> openocd -f board/esp32s3-builtin.cfg
Open On-Chip Debugger v0.11.0-esp32-20220706 (2022-07-06-15:48)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : only one transport option; autoselect 'jtag'
Info : esp_usb_jtag: VID set to 0x303a and PID to 0x1001
Info : esp_usb_jtag: capabilities descriptor set to 0x2000
Warn : Transport "jtag" was already selected
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Error: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED
Info : esp_usb_jtag: serial (7C:DF:A1:E2:03:20)
Info : esp_usb_jtag: Device found. Base speed 40000KHz, div range 1 to 255
Info : clock speed 40000 kHz
Info : JTAG tap: esp32s3.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32s3.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : [esp32s3.cpu0] Debug controller was reset.
Info : [esp32s3.cpu0] Core was reset.
Info : [esp32s3.cpu1] Debug controller was reset.
Info : [esp32s3.cpu1] Core was reset.
Info : starting gdb server for esp32s3.cpu0 on 3333
Info : Listening on port 3333 for gdb connections

Terminal Msg during debugging:

PS C:\Espressif\frameworks\esp-idf-v4.4.3\examples\get-started\blink> & 'c:\Users\DELL\.vscode\extensions\ms-vscode.cpptools-1.12.4-win32-x64\debugAdapters\bin\WindowsDebugLauncher.exe' '--stdin=Microsoft-MIEngine-In-wn5m35bi.ggc' '--stdout=Microsoft-MIEngine-Out-a5i3knmn.qv0' '--stderr=Microsoft-MIEngine-Error-f3rgyov2.oom' '--pid=Microsoft-MIEngine-Pid-mc12tkew.3qv' '--dbgExe=C:/Espressif/tools/xtensa-esp32s3-elf/esp-2021r2-patch5-8.4.0/xtensa-esp32s3-elf/bin/xtensa-esp32s3-elf-gdb.exe' '--interpreter=mi'

Below i given a launch and tasks .json file for reference.

launch.json

{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
// "preLaunchTask": "preRun",
"name": "ESP32 OpenOCD",
"type": "cppdbg",
"request": "launch",
"cwd": "${workspaceFolder}/build",
"program": "${workspaceFolder}/build/blink.elf",
"miDebuggerPath": "C:/Espressif/tools/xtensa-esp32s3-elf/esp-2021r2-patch5-8.4.0/xtensa-esp32s3-elf/bin/xtensa-esp32s3-elf-gdb.exe",
"setupCommands": [
{ "text": "target remote 127.0.0.1:3333" },
{ "text": "set remote hardware-watchpoint-limit 2" },
{ "text": "monitor reset halt" },
{ "text": "flushregs"},
{ "text": "thb app_main"},
{ "text": "c"}
]
}
]
}

tasks.json

{
"version": "2.0.0",
"tasks": [
{
"label": "preRun",
"type": "shell",
"windows":{
// "command": "clear & start openocd -c \"set ESP_RTOS none\" -f board/esp32s3-bridge.cfg & exit"
"command": "clear & start openocd -c \"set ESP_RTOS none\" -f board/esp32s3-builtin.cfg & exit"
}
}
]
}

if anyone provide the solution it will be really helpful for me.

Regards,

Yuvaraj N
Attachments
GDB error.JPG
GDB error.JPG (86.61 KiB) Viewed 3134 times

Who is online

Users browsing this forum: No registered users and 78 guests