Unable to start debug session on Espressif IDE
Posted: 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:
Also, here is the error within the log file:
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:
From Espressif-IDE error dialog:
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:
From Espressif-IDE Error Dialog upon pressing 'run' or 'step' commands:
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.
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
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
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.
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)
Code: Select all
Failed to execute MI command
-exec-next 1
Error message from debugger backend
Invalid thread ID: 0