ESP-IDF 1.8.0 Debugging won't start

brianpdx
Posts: 10
Joined: Fri Jan 29, 2021 6:07 am

ESP-IDF 1.8.0 Debugging won't start

Postby brianpdx » Wed Jul 10, 2024 2:36 am

Hello,

I'm using VSCode 1.91.0 with ESP-IDF 1.8.0 on MacOS Sonoma 14.5.

I've created a new project using blink template and I'm targeting a WROVER-KIT development board. I'm using all the default settings that ESP-IDF created in settings.json and launch.json and the default debugging target is "Eclipse CDT GDB Adapter".

Building and flashing the project works, and OpenOCD seems to run fine and detect the board. Output looks like:

Code: Select all

OpenOCD]
Open On-Chip Debugger v0.12.0-esp32-20230921 (2023-09-21-13:27)
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
...
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : starting gdb server for esp32.cpu0 on 3333
Info : Listening on port 3333 for gdb connections
Info : [esp32.cpu0] Debug controller was reset.
Info : [esp32.cpu0] Core was reset.
...
When I try to start debugging however VSCode throws an error that says "Cannot read properties of null (reading 'port'):
Screenshot 2024-07-09 at 7.33.26 PM.png
Screenshot 2024-07-09 at 7.33.26 PM.png (84.79 KiB) Viewed 5369 times
Does anyone have any ideas on how to resolve this?

I've read the docs here: https://github.com/espressif/vscode-esp ... BUGGING.md

Those docs suggest manually adding a "target" block to the launch.json configuration that specifies the port, for example:

Code: Select all

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "gdbtarget",
      "request": "attach",
      "name": "Eclipse CDT GDB Adapter",
      "target": {
        "port": "3333"
      }
    },
...
  ]
}
But this doesn't have any effect. The dialog still pops up every time.

Thank you!

Brian

ESP_bignacio
Posts: 229
Joined: Wed May 02, 2018 12:12 pm

Re: ESP-IDF 1.8.0 Debugging won't start

Postby ESP_bignacio » Thu Jul 11, 2024 11:06 am

Can you remove the target part and just use

Code: Select all

{
   "type": "gdbtarget",
   "request": "attach",
   "name": "Eclipse CDT GDB Adapter"
}
I'm not sure why but the documentation was updated and the target part was updated. Maybe you are seeing and old version of this debugging doc. Code I just shared should be the same as master branch.

The port problem could be due to debug adapter server not being created for some reason. Is the port 43476 busy in your environment? You can try using a different server port like 12345 like:

Code: Select all

{
   "type": "gdbtarget",
   "request": "attach",
   "name": "Eclipse CDT GDB Adapter",
   "debugPort': 12345
}

jordoncheng
Posts: 1
Joined: Fri Sep 06, 2024 2:41 am

Re: ESP-IDF 1.8.0 Debugging won't start

Postby jordoncheng » Fri Sep 06, 2024 2:51 am

I also encountered the same problem, and strangely enough, since my own project needed debugging, I began to study the debugging function of ESP32-S3. The development board model was ESP32-S3-DevKITC-1. In the blink example, although it was not smooth, the debugging was finally successful, with only a few defects. After each burning, you need to press the Reset button on the development board to successfully debug. But back in my own project, burning can succeed, but every time I click debug, it will pop up the "Cannot read properties of null (reading 'port')" window, tried to add a "target" field, no effect, I tried the "debugPort" field, but it didn't work either.

abuhanzala

Re: ESP-IDF 1.8.0 Debugging won't start

Postby abuhanzala » Sat Sep 14, 2024 8:48 am

Hey Brian, I’ve run into similar issues with VSCode and ESP-IDF debugging in the past. The port configuration issue sounds tricky. Have you tried updating the ESP-IDF extension or reinstalling the GDB debugger? Sometimes a fresh install resolves odd behavior with ports not being detected properly. Also, double-check that the 'transport' setting in OpenOCD matches your board setup. Hopefully, one of these fixes works for you!

Who is online

Users browsing this forum: No registered users and 73 guests