Unable to start debug session on Espressif IDE

Cambeast
Posts: 1
Joined: Sat Oct 07, 2023 11:00 pm

Unable to start debug session on Espressif IDE

Postby Cambeast » Sat Oct 07, 2023 11:53 pm

Hello,

I have been trying to start a debug session for my ESP32-DevkitC v4 board in the most recent Espressif-IDE version.

The DevKit I have contains a ESP-WROOM-32-DA.

I am able to start a debug session using OpenOCD and ESP-IDF from the command line, but I cannot successfully get one to start from a debug configuration within Espressif-IDE.

Has anyone had any success with creating a debug session for this board with a J-Link, and is this even a possibility in Espressif-IDE? I ask because within the Debug Configurations dialog, there is a selection box with other targets/hardware interfaces to select from, but I have to edit the config options to use "-f interface/jlink.cfg" interface because none of the available options matches my configuration. This may be incompatible and cause issues in the Espressif-IDE. Can anyone confirm this is my problem?

I am trying to use a J-Link V11 since I have one sitting around, but I am open to purchasing an FTDI 2232H or ESP_Prog board if necessary. But before I do so, I would like to confirm that my issue is with trying to use the J-Link and that one of these tools would actually work.

If I purchase an ESP_PROG board, would the appropriate board selection option in the Debug configuration settings be: ESP32 chip (via ESP-PROG)?

Also, I am able to flash the ESP32 using the J-Link from the Espressif-IDE, using the same options as when trying to debug (Selecting ESP32 chip (via ESP-PROG), but changing the interface to use jlink.cfg in the config options) and I get a successful (albeit very slow) flash.

More about my error:

In case I should actually be able to use a J-Link from within Espressif-IDE, I'll detail more about the error I am seeing.

Basically when I click debug, nothing happens. The OpenOCD server fails to start, with a "Starting OpenOCD timed out" error. Looking into the 'Starting OpenOCD" diaglog, I have this internal error:

Code: Select all

An internal error occurred during: "Starting OpenOCD".
RequestMonitor: Sequence "", result for executing step #1 = Status ERROR: org.eclipse.cdt.dsf code=10005 Request for monitor: 'RequestMonitor (org.eclipse.embedcdt.debug.gdbjtag.core.dsf.GnuMcuGdbServerBackend$GdbServerStep$1@4ece417b): Status OK: unknown code=0 OK' resulted in a rejected execution exception., done() method called more than once
Also, here is the error within the log file:

Code: Select all

!ENTRY com.espressif.idf.core 1 0 2023-10-07 19:30:32.005
!MESSAGE Open On-Chip Debugger v0.11.0-esp32-20221026 (2022-10-26-14:48)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html

!ENTRY org.eclipse.embedcdt.debug.gdbjtag.core 4 1 2023-10-07 19:30:32.008
!MESSAGE C:\Espressif\tools\openocd-esp32\v0.11.0-esp32-20221026\openocd-esp32\bin/openocd.exe -c gdb_port 3333 -c telnet_port 4444 -c tcl_port 6666 -s C:\Espressif\tools\openocd-esp32\v0.11.0-esp32-20221026\openocd-esp32\bin/share/openocd/scripts -f interface/jlink.cfg -f board/esp-wroom-32.cfg -c program_esp_bins C:/Projects/Cam-Rover/Rover-Controller/build flasher_args.json verify reset -c echo "Started by GNU MCU Eclipse"

!ENTRY org.eclipse.cdt.dsf 4 10005 2023-10-07 19:30:57.965
!MESSAGE Request for monitor: 'RequestMonitor (org.eclipse.cdt.dsf.concurrent.RequestMonitorWithProgress@6064c3f): Status ERROR: org.eclipse.embedcdt.debug.gdbjtag.core code=5010 Starting OpenOCD timed out.' resulted in an error.
!SUBENTRY 1 org.eclipse.embedcdt.debug.gdbjtag.core 4 5010 2023-10-07 19:30:57.965
!MESSAGE Starting OpenOCD timed out.

!ENTRY org.eclipse.cdt.dsf.gdb 4 5012 2023-10-07 19:30:57.968
!MESSAGE Error in services launch sequence
!STACK 1
org.eclipse.core.runtime.CoreException: Starting OpenOCD timed out.
	at org.eclipse.cdt.dsf.concurrent.Sequence.abortExecution(Sequence.java:599)
	at org.eclipse.cdt.dsf.concurrent.Sequence$2.handleErrorOrWarning(Sequence.java:448)
	at org.eclipse.cdt.dsf.concurrent.RequestMonitor.handleFailure(RequestMonitor.java:433)
	at org.eclipse.cdt.dsf.concurrent.RequestMonitor.handleCompleted(RequestMonitor.java:393)
	at org.eclipse.cdt.dsf.concurrent.RequestMonitor$2.run(RequestMonitor.java:317)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:833)
!SUBENTRY 1 org.eclipse.embedcdt.debug.gdbjtag.core 4 5010 2023-10-07 19:30:57.968
!MESSAGE Starting OpenOCD timed out.

!ENTRY org.eclipse.core.jobs 4 2 2023-10-07 19:30:57.986
!MESSAGE An internal error occurred during: "Starting OpenOCD".
!STACK 0
java.lang.IllegalStateException: RequestMonitor: Sequence "", result for executing step #1 = Status ERROR: org.eclipse.cdt.dsf code=10005 Request for monitor: 'RequestMonitor (org.eclipse.embedcdt.debug.gdbjtag.core.dsf.GnuMcuGdbServerBackend$GdbServerStep$1@4ece417b): Status OK: unknown code=0 OK' resulted in a rejected execution exception., done() method called more than once
	at org.eclipse.cdt.dsf.concurrent.RequestMonitor.done(RequestMonitor.java:288)
	at org.eclipse.cdt.dsf.concurrent.RequestMonitor.handleRejectedExecutionException(RequestMonitor.java:529)
	at org.eclipse.cdt.dsf.concurrent.RequestMonitor.done(RequestMonitor.java:326)
	at org.eclipse.embedcdt.debug.gdbjtag.core.dsf.GnuMcuGdbServerBackend$GdbServerStep$2.run(GnuMcuGdbServerBackend.java:735)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

I have also tried starting the OpenOCD server from the command line, and then de-selecting the 'Start OpenOCD locally' option, to see if I can start a gdb session if I off-load the server setup from Espressif-IDE.

When I try this, I seem to almost get a successful connection. But OpenOCD rejects the GDB connection on port 3333, and attempts to listen on 3334 instead. I'm not sure what is happening here. I thought it may have something to do with Firewall settings, but not sure.

From the command line:

Code: Select all

C:\Espressif\frameworks\esp-idf-v4.4.5>openocd -f interface/jlink.cfg -f target/esp32.cfg -c "adapter speed 100"
Open On-Chip Debugger v0.11.0-esp32-20221026 (2022-10-26-14:48)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
adapter speed: 100 kHz

Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : J-Link V11 compiled Aug  2 2023 10:34:01
Info : Hardware version: 11.00
Info : VTarget = 3.336 V
Info : clock speed 100 kHz
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] Target halted, PC=0x40000400, debug_reason=00000001
Info : [esp32.cpu0] Reset cause (3) - (Software core reset)
Info : Set GDB target to 'esp32.cpu0'
Info : [esp32.cpu1] Target halted, PC=0x40000400, debug_reason=00000000
Info : [esp32.cpu1] Reset cause (14) - (CPU1 reset by CPU0)
Info : accepting 'gdb' connection on tcp/3333
Error: attempted 'gdb' connection rejected
From Espressif-IDE error dialog:

Code: Select all

rror in final launch sequence
Failed to execute MI command:
-target-select remote localhost:3334
Error message from debugger back end:
localhost:3334: Connection timed out.
Failed to execute MI command:
-target-select remote localhost:3334
Error message from debugger back end:
localhost:3334: Connection timed out.
localhost:3334: Connection timed out.
I have also tried doing a regular gdb session by creating a "GDB Hardware Debugging" configuration, pointing it to the xtensa gdb executable and setting up an extended remote generic tcp connection to localhost:3333. This seems to get me very close to a successful startup, but I get errors when attempting to click 'run' or 'step'.

OpenOCD Server Command Line Output:

Code: Select all

C:\Espressif\frameworks\esp-idf-v4.4.5>openocd -f interface/jlink.cfg -f target/esp32.cfg -c "adapter speed 100"
Open On-Chip Debugger v0.11.0-esp32-20221026 (2022-10-26-14:48)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
adapter speed: 100 kHz

Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : J-Link V11 compiled Aug  2 2023 10:34:01
Info : Hardware version: 11.00
Info : VTarget = 3.325 V
Info : clock speed 100 kHz
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] Target halted, PC=0x40000400, debug_reason=00000001
Info : [esp32.cpu0] Reset cause (3) - (Software core reset)
Info : Set GDB target to 'esp32.cpu0'
Info : [esp32.cpu1] Target halted, PC=0x40000400, debug_reason=00000000
Info : [esp32.cpu1] Reset cause (14) - (CPU1 reset by CPU0)
Info : accepting 'gdb' connection on tcp/3333
Warn : No symbols for FreeRTOS!
Info : [esp32.cpu0] Target halted, PC=0x40092612, debug_reason=00000001
Info : Flash mapping 0: 0x10020 -> 0x3f400020, 48 KB
Info : Flash mapping 1: 0x20020 -> 0x400d0020, 135 KB
Info : [esp32.cpu0] Target halted, PC=0x40092612, debug_reason=00000001
Info : Auto-detected flash bank 'esp32.cpu0.flash' size 4096 KB
Info : Using flash bank 'esp32.cpu0.flash' size 4096 KB
Info : [esp32.cpu0] Target halted, PC=0x40092612, debug_reason=00000001
Info : Flash mapping 0: 0x10020 -> 0x3f400020, 48 KB
Info : Flash mapping 1: 0x20020 -> 0x400d0020, 135 KB
Info : Using flash bank 'esp32.cpu0.irom' size 136 KB
Info : [esp32.cpu0] Target halted, PC=0x40092612, debug_reason=00000001
Info : Flash mapping 0: 0x10020 -> 0x3f400020, 48 KB
Info : Flash mapping 1: 0x20020 -> 0x400d0020, 135 KB
Info : Using flash bank 'esp32.cpu0.drom' size 52 KB
Info : New GDB Connection: 1, Target esp32.cpu0, state: halted
Warn : keep_alive() was not invoked in the 1000 ms timelimit. GDB alive packet not sent! (2453 ms). Workaround: increase "set remotetimeout" in GDB
Warn : keep_alive() was not invoked in the 1000 ms timelimit. GDB alive packet not sent! (1083 ms). Workaround: increase "set remotetimeout" in GDB
Warn : keep_alive() was not invoked in the 1000 ms timelimit. GDB alive packet not sent! (1358 ms). Workaround: increase "set remotetimeout" in GDB
Warn : keep_alive() was not invoked in the 1000 ms timelimit. GDB alive packet not sent! (3055 ms). Workaround: increase "set remotetimeout" in GDB
Warn : keep_alive() was not invoked in the 1000 ms timelimit. GDB alive packet not sent! (3087 ms). Workaround: increase "set remotetimeout" in GDB
Warn : keep_alive() was not invoked in the 1000 ms timelimit. GDB alive packet not sent! (3072 ms). Workaround: increase "set remotetimeout" in GDB
Warn : keep_alive() was not invoked in the 1000 ms timelimit. GDB alive packet not sent! (1515 ms). Workaround: increase "set remotetimeout" in GDB
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 : [esp32.cpu0] requesting target halt and executing a soft reset
Info : [esp32.cpu0] Debug controller was reset.
Info : [esp32.cpu0] Core was reset.
Info : [esp32.cpu0] Target halted, PC=0x500000CF, debug_reason=00000000
Info : [esp32.cpu0] Reset cause (3) - (Software core reset)
Info : [esp32.cpu1] requesting target halt and executing a soft reset
Info : [esp32.cpu0] Core was reset.
Info : [esp32.cpu0] Target halted, PC=0x40000400, debug_reason=00000000
Info : [esp32.cpu1] Debug controller was reset.
Info : [esp32.cpu1] Core was reset.
Info : [esp32.cpu1] Target halted, PC=0x40000400, debug_reason=00000000
Info : [esp32.cpu1] Reset cause (14) - (CPU1 reset by CPU0)
Info : [esp32.cpu0] Reset cause (3) - (Software core reset)
Info : [esp32.cpu0] Target halted, PC=0x40092612, debug_reason=00000001
Warn : keep_alive() was not invoked in the 1000 ms timelimit. GDB alive packet not sent! (5310 ms). Workaround: increase "set remotetimeout" in GDB
Info : PROF: Erased 53248 bytes in 7638.01 ms
Warn : keep_alive() was not invoked in the 1000 ms timelimit. GDB alive packet not sent! (2390 ms). Workaround: increase "set remotetimeout" in GDB
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 : [esp32.cpu0] requesting target halt and executing a soft reset
Info : [esp32.cpu0] Debug controller was reset.
Info : [esp32.cpu0] Core was reset.
Info : [esp32.cpu0] Target halted, PC=0x500000CF, debug_reason=00000000
Info : [esp32.cpu0] Reset cause (3) - (Software core reset)
Info : [esp32.cpu1] requesting target halt and executing a soft reset
Info : [esp32.cpu0] Core was reset.
Info : [esp32.cpu0] Target halted, PC=0x40000400, debug_reason=00000000
Info : [esp32.cpu1] Debug controller was reset.
Info : [esp32.cpu1] Core was reset.
Info : [esp32.cpu1] Target halted, PC=0x40000400, debug_reason=00000000
Info : [esp32.cpu1] Reset cause (14) - (CPU1 reset by CPU0)
Info : [esp32.cpu0] Reset cause (3) - (Software core reset)
Warn : keep_alive() was not invoked in the 1000 ms timelimit. GDB alive packet not sent! (4992 ms). Workaround: increase "set remotetimeout" in GDB
Info : [esp32.cpu0] Target halted, PC=0x40092612, debug_reason=00000001
Info : PROF: Erased 139264 bytes in 8090.01 ms
Warn : keep_alive() was not invoked in the 1000 ms timelimit. GDB alive packet not sent! (2358 ms). Workaround: increase "set remotetimeout" in GDB
Info : PROF: Compressed 49316 bytes to 16747 bytes in 3.000000ms
Warn : keep_alive() was not invoked in the 1000 ms timelimit. GDB alive packet not sent! (18824 ms). Workaround: increase "set remotetimeout" in GDB
Warn : keep_alive() was not invoked in the 1000 ms timelimit. GDB alive packet not sent! (3271 ms). Workaround: increase "set remotetimeout" in GDB
Info : PROF: Data transferred in 3244.77 ms @ 5.04026 KB/s
Info : [esp32.cpu0] Target halted, PC=0x40092612, debug_reason=00000001
Info : PROF: Wrote 49316 bytes in 39354.6 ms (data transfer time included)
Info : PROF: Compressed 138847 bytes to 85298 bytes in 5.037000ms
Warn : keep_alive() was not invoked in the 1000 ms timelimit. GDB alive packet not sent! (35575 ms). Workaround: increase "set remotetimeout" in GDB
Warn : keep_alive() was not invoked in the 1000 ms timelimit. GDB alive packet not sent! (3286 ms). Workaround: increase "set remotetimeout" in GDB
Warn : keep_alive() was not invoked in the 1000 ms timelimit. GDB alive packet not sent! (3143 ms). Workaround: increase "set remotetimeout" in GDB
Warn : keep_alive() was not invoked in the 1000 ms timelimit. GDB alive packet not sent! (3125 ms). Workaround: increase "set remotetimeout" in GDB
Warn : keep_alive() was not invoked in the 1000 ms timelimit. GDB alive packet not sent! (3138 ms). Workaround: increase "set remotetimeout" in GDB
Warn : keep_alive() was not invoked in the 1000 ms timelimit. GDB alive packet not sent! (3132 ms). Workaround: increase "set remotetimeout" in GDB
Info : PROF: Data transferred in 16341.3 ms @ 5.09744 KB/s
Info : [esp32.cpu0] Target halted, PC=0x40092612, debug_reason=00000001
Info : PROF: Wrote 138847 bytes in 52445.9 ms (data transfer time included)
Warn : keep_alive() was not invoked in the 1000 ms timelimit. GDB alive packet not sent! (17108 ms). Workaround: increase "set remotetimeout" in GDB
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 : [esp32.cpu0] requesting target halt and executing a soft reset
Info : [esp32.cpu0] Debug controller was reset.
Info : [esp32.cpu0] Core was reset.
Info : [esp32.cpu0] Target halted, PC=0x500000CF, debug_reason=00000000
Info : [esp32.cpu0] Reset cause (3) - (Software core reset)
Info : [esp32.cpu1] requesting target halt and executing a soft reset
Info : [esp32.cpu0] Core was reset.
Info : [esp32.cpu0] Target halted, PC=0x40000400, debug_reason=00000000
Info : [esp32.cpu1] Debug controller was reset.
Info : [esp32.cpu1] Core was reset.
Info : [esp32.cpu1] Target halted, PC=0x40000400, debug_reason=00000000
Info : [esp32.cpu1] Reset cause (14) - (CPU1 reset by CPU0)
Info : [esp32.cpu0] Reset cause (3) - (Software core reset)
From Espressif-IDE Error Dialog upon pressing 'run' or 'step' commands:

Code: Select all

Failed to execute MI command
-exec-next 1
Error message from debugger backend
Invalid thread ID: 0
Any and all help is appreciated, thanks. I really just want to be able to do everything from the IDE, instead of relying on the command line to debug, or even worse, relying solely on print statements.

danieljabad@yahoo.it
Posts: 1
Joined: Sat Oct 28, 2023 11:46 am

Re: Unable to start debug session on Espressif IDE

Postby danieljabad@yahoo.it » Sat Oct 28, 2023 5:02 pm

I have the same problem... !!

ESP_kondalkolipaka
Posts: 188
Joined: Wed Jul 17, 2019 5:26 pm

Re: Unable to start debug session on Espressif IDE

Postby ESP_kondalkolipaka » Wed Nov 01, 2023 10:54 am

> !MESSAGE Starting OpenOCD timed out.

I apologize for the delayed response. I don't have a J-Link to verify this scenario. However, could you try increasing the OpenOCD server timeout and see if that helps?

You can find this option in the IDE preferences > Espressif > GDB server launch timeout
Screenshot 2023-11-01 at 11.52.42 AM.png
Screenshot 2023-11-01 at 11.52.42 AM.png (456.56 KiB) Viewed 29579 times

ESP-erhankur
Posts: 8
Joined: Fri Jan 08, 2021 10:37 pm

Re: Unable to start debug session on Espressif IDE

Postby ESP-erhankur » Wed Nov 01, 2023 10:16 pm

I gave a try with Jlink-EDU which has v10 firmware and seems no issue for me. I have used hello-world example. Adapter speed is 5000khz. 100khz is pretty slow and that is the reason you are getting some timeout warnings.

Debugger config options;

Code: Select all

-s ${openocd_path}/share/openocd/scripts -c 'adapter speed 5000' -f interface/jlink.cfg -f target/esp32.cfg
Espressif Product Information

Code: Select all

Operating System: mac os x
Java Runtime Version: 17.0.8+0
Eclipse Version: 4.29.0.v20230903-1000
Eclipse CDT Version: 11.3.0.202307110141
IDF Eclipse Plugin Version: 2.11.0.202309211121
ESP-IDF v5.3-dev-106-g659748748f-dirty
Python set for IDF_PYTHON_ENV: Python 3.9.6

PianoArcDave
Posts: 6
Joined: Mon Jul 18, 2022 2:31 pm

Re: Unable to start debug session on Espressif IDE

Postby PianoArcDave » Tue Jan 30, 2024 4:17 pm

Hi, My designs use the ESP32-S2. I am using the ESP-Prog from Eclipse IDE SDK 5.1 and have been for over a year. I have successfully launched debugging sessions from the Eclipse IDE thousands of times. Yet today I get the same error:

Error in final launch sequence
Failed to execute MI command:
-target-select remote localhost:3334
Error message from debugger back end:
localhost:3334: Connection timed out.
Failed to execute MI command:
-target-select remote localhost:3334
Error message from debugger back end:

I tried using the Zadig thing to reinstall the driver, restarted Eclipse, Rebooted the computer, Tried multiple ESP-Prog's, Tried 3 separate target boards, Changed all the cables. Yet something in the IDE hangs this up.

The compiler works. I can still program using the USB bootloader. But no dice on the ESP-Prog.

Should I reinstall something?
Is possible some annoying windows permission is screwed up?
Any help would be appreciated.

Thanks
Dave Starkey

Who is online

Users browsing this forum: No registered users and 19 guests