-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Debug ESP32-C3 using JTAG over USB on Arduino IDE 2.x #8353
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
did you try adding a breakpoint in the loop and hitting the resume button for debug? |
The debug starts up. I press the continue button, it get to setup:
I hit the continue button and the looks like nothing happened, The screen looks the same as the image I showed above. I restarted this. I exited the IDE, turned off power to the ESP32-C3 and then turned on did a fresh upload, and then started up the debugger again
The server stuff is longer so included file instead: I did the continue button (twice)... The only new stuff in debug console:
And the GDB server one was again going endless with data, until I told the debugger to stop. Note: I see in my temp directory a file that looks like the complete gdb log: Let me know if you need any additional information, |
Please help with triage of this ticket @me-no-dev, thanks |
This is much the same as I explained in another thread. The debugger stopped the ESP in |
Hello, closing this as expired, if needed you can reopen. |
Is there any advice on resolving this issue? |
Board
ESP32-C3-DevKitC-02 and ESP32-C3-DevkitM-1 and LuotOS.com/t/esp32C3
Device Description
I have tried 3 different setups for ESP32-C3
For the: ESP32-C3-DevKitC-02 and ESP32-C3-DevkitM-1 I use breadboard, to a USB breakout board.
For LuotOS version, the USB connector is actually connected to pins IO18 and IO19. More details about this board up at: https://m.media-amazon.com/images/I/91S2q9qyLcL.pdf
Hardware Configuration
Nothing other than mentioned above where IO18 and IO19 connected to USB connector.
Version
2.0.9
IDE Name
Arduino IDE 2.1 and and nightly build 20230625
Operating System
Windows 11
Flash frequency
80mhz
PSRAM enabled
yes
Upload speed
921600
Description
Using the Arduino IDE 2.x debug facility on the ESP32-C3 does not appear to work. Initially it looks like the debugger starts up. But trying to do anything causes it to hang or crash.
Note: this is related to #8334 by @mjs513 but that issue started off as more of a question or issue on how to setup the JTAG for the ESP32-C3 and programming, and this one has more to do once the JTAG over USB is setup, and it appears like the debugger starts up. You soon find that nothing appears to work.
If you feel like this is a duplicate, feel free to close it as such. Some groups like to group things together and others like each specific thing broken out as a new issue.
Sketch
Any sketch will do, but current one:
Debug Message
Not sure what to include here.
Did include a lot of debug information in the steps to reproduce.
Other Steps to Reproduce
Build your sketch: Note: I have sketch->Opmtimize for debug turned on:

I have JTAG using USB as the image below shows.
I build and upload the sketch,

I then press the debug button and it looks like the debugger comes up:
The debug console window comes up:
The gdb-server data: (removed most as text too long)
Debug: 6476 11256 gdb_server.c:404 gdb_log_outgoing_packet(): [esp32c3] sending packet: $#2
Debug: 6477 11324 gdb_server.c:390 gdb_log_incoming_packet(): [esp32c3] received packet: m3fc95774,4
Debug: 6478 11324 gdb_server.c:1533 gdb_read_memory_packet(): addr: 0x000000003fc95774, len: 0x00000004
Debug: 6479 11324 target.c:2522 target_read_buffer(): reading buffer of 4 byte at 0x3fc95774
Debug: 6480 11327 riscv-013.c:2859 log_mem_access_result(): Succeeded to read memory via system bus.
Debug: 6481 11327 gdb_server.c:407 gdb_log_outgoing_packet(): [esp32c3] sending packet: $00000000#80
Debug: 6482 11648 gdb_server.c:390 gdb_log_incoming_packet(): [esp32c3] received packet: m3fc95774,4
Debug: 6483 11649 gdb_server.c:1533 gdb_read_memory_packet(): addr: 0x000000003fc95774, len: 0x00000004
Debug: 6484 11649 target.c:2522 target_read_buffer(): reading buffer of 4 byte at 0x3fc95774
Debug: 6485 11654 riscv-013.c:2859 log_mem_access_result(): Succeeded to read memory via system bus.
Debug: 6486 11655 gdb_server.c:407 gdb_log_outgoing_packet(): [esp32c3] sending packet: $00000000#80
Debug: 6487 11655 gdb_server.c:390 gdb_log_incoming_packet(): [esp32c3] received packet: m3fc95774,4
Debug: 6488 11655 gdb_server.c:1533 gdb_read_memory_packet(): addr: 0x000000003fc95774, len: 0x00000004
Debug: 6489 11655 target.c:2522 target_read_buffer(): reading buffer of 4 byte at 0x3fc95774
Debug: 6490 11658 riscv-013.c:2859 log_mem_access_result(): Succeeded to read memory via system bus.
Debug: 6491 11658 gdb_server.c:407 gdb_log_outgoing_packet(): [esp32c3] sending packet: $00000000#80
JTAG tap: esp32c3.cpu tap/device found: 0x00005c25 (mfg: 0x612 (Espressif Systems), part: 0x0005, ver: 0x0)
Reset cause (3) - (Software core reset)
Hardware assisted breakpoint 1 at 0x4200004c: file C:\Users\kurte\Documents\Arduino\Rainbow/Rainbow.ino, line 9.
Note: automatically using hardware breakpoints for read-only addresses.
[New Thread 1070463660]
[New Thread 1070177460]
[New Thread 1070169048]
[New Thread 1070174784]
[Switching to Thread 1070463660]
Thread 2 "loopTask" hit Temporary breakpoint 1, setup () at C:\Users\kurte\Documents\Arduino\Rainbow/Rainbow.ino:9
9 void setup() {
Debug: 348949 743354 riscv.c:3893 register_get(): [esp32c3] read 0x40387716 from pc (valid=0)
Debug: 348950 743354 gdb_server.c:407 gdb_log_outgoing_packet(): [esp32c3] sending packet: $000000004a773840e0bfc93f00c2c83f3032c93f0e8905400f000000000000004e0000420000000003010000e4bfc93f0100000000000000020000000100000000000000000000000020033c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016773840#4b
Debug: 348951 743365 gdb_server.c:390 gdb_log_incoming_packet(): [esp32c3] received packet: qXfer:threads:read::0,1000
Debug: 348952 743365 gdb_server.c:404 gdb_log_outgoing_packet(): [esp32c3] sending packet: $#12
Debug: 348953 743366 gdb_server.c:390 gdb_log_incoming_packet(): [esp32c3] received packet: z1,4200007a,2
Debug: 348954 743366 gdb_server.c:1745 gdb_breakpoint_watchpoint_packet(): [esp32c3]
Debug: 348955 743366 riscv.c:930 remove_trigger(): [0] Stop using resource 0 for bp 2
Debug: 348956 743366 riscv-013.c:4087 riscv013_get_register(): [esp32c3] reading register tselect
Debug: 348957 743366 riscv-013.c:800 execute_abstract_command(): command=0x2207a0; access register, size=32, postexec=0, transfer=1, write=0, regno=0x7a0
Debug: 348958 743367 riscv-013.c:1504 register_read_direct(): {0} tselect = 0x0
Debug: 348959 743367 riscv.c:3539 riscv_get_register(): [esp32c3] tselect: 0
Debug: 348960 743368 riscv.c:3482 riscv_set_register(): [esp32c3] tselect <- 0
Debug: 348961 743368 riscv-013.c:4116 riscv013_set_register(): [0] writing 0x0 to register tselect
Debug: 348962 743368 riscv-013.c:1315 register_write_direct(): {0} tselect <- 0x0
Debug: 348963 743368 riscv-013.c:800 execute_abstract_command(): command=0x2307a0; access register, size=32, postexec=0, transfer=1, write=1, regno=0x7a0
Debug: 348964 743369 riscv.c:3501 riscv_set_register(): [esp32c3] wrote 0x0 to tselect valid=0
Debug: 348965 743369 riscv.c:3482 riscv_set_register(): [esp32c3] tdata1 <- 0
Debug: 348966 743369 riscv-013.c:4116 riscv013_set_register(): [0] writing 0x0 to register tdata1
Debug: 348967 743369 riscv-013.c:1315 register_write_direct(): {0} tdata1 <- 0x0
Debug: 348968 743370 riscv-013.c:800 execute_abstract_command(): command=0x2307a1; access register, size=32, postexec=0, transfer=1, write=1, regno=0x7a1
Debug: 348969 743370 riscv.c:3501 riscv_set_register(): [esp32c3] wrote 0x0 to tdata1 valid=0
Debug: 348970 743370 riscv.c:3482 riscv_set_register(): [esp32c3] tselect <- 0
Debug: 348971 743370 riscv-013.c:4116 riscv013_set_register(): [0] writing 0x0 to register tselect
Debug: 348972 743370 riscv-013.c:1315 register_write_direct(): {0} tselect <- 0x0
Debug: 348973 743372 riscv-013.c:800 execute_abstract_command(): command=0x2307a0; access register, size=32, postexec=0, transfer=1, write=1, regno=0x7a0
Debug: 348974 743373 riscv.c:3501 riscv_set_register(): [esp32c3] wrote 0x0 to tselect valid=0
Debug: 348975 743373 breakpoints.c:291 breakpoint_free(): free BPID: 2 --> 0
Debug: 348976 743373 gdb_server.c:407 gdb_log_outgoing_packet(): [esp32c3] sending packet: $OK#9a
Debug: 348977 743373 gdb_server.c:390 gdb_log_incoming_packet(): [esp32c3] received packet: m3fc9bfc0,40
Debug: 348978 743373 gdb_server.c:1533 gdb_read_memory_packet(): addr: 0x000000003fc9bfc0, len: 0x00000040
Debug: 348979 743374 target.c:2522 target_read_buffer(): reading buffer of 64 byte at 0x3fc9bfc0
Debug: 348980 743379 riscv-013.c:2859 log_mem_access_result(): Succeeded to read memory via system bus.
Debug: 348981 743379 gdb_server.c:407 gdb_log_outgoing_packet(): [esp32c3] sending packet: $a5a5a5a5a5a5a5a5a5a5a50a01000000000000000000000000000000000000000100000001000000000000004e0000420020033c0050c93f7cc0c93f00820042#6c
Debug: 348982 743383 gdb_server.c:390 gdb_log_incoming_packet(): [esp32c3] received packet: m3fc9c040,40
Debug: 348983 743383 gdb_server.c:1533 gdb_read_memory_packet(): addr: 0x000000003fc9c040, len: 0x00000040
Debug: 348984 743383 target.c:2522 target_read_buffer(): reading buffer of 64 byte at 0x3fc9c040
Debug: 348985 743387 riscv-013.c:2859 log_mem_access_result(): Succeeded to read memory via system bus.
Debug: 348986 743387 gdb_server.c:407 gdb_log_outgoing_packet(): [esp32c3] sending packet: $a5a5a5a5a5a5a5a5a5a5a5a582809235a5a5a5a5a5a5a5a5a5a5a5a5000000000100000000000000b0c0c93fe2850042a5a5a5a5a5a5a5a5a5a5a5a500000000#e2
Debug: 348987 743528 gdb_server.c:228 gdb_get_char_inner(): GDB connection closed by the remote client
Debug: 348988 743529 gdb_server.c:1115 gdb_connection_closed(): GDB Close, Target: esp32c3, state: halted, gdb_actual_connections=0
Debug: 348989 743529 target.c:1847 target_call_event_callbacks(): target event 8 (gdb-end) for core esp32c3
Debug: 348990 743529 esp32c3.c:177 esp32c3_handle_target_event(): 8
Debug: 348991 743531 esp_riscv.c:356 esp_riscv_handle_target_event(): 8
Debug: 348992 743531 target.c:1847 target_call_event_callbacks(): target event 23 (gdb-detach) for core esp32c3
Debug: 348993 743531 esp32c3.c:177 esp32c3_handle_target_event(): 23
Debug: 348994 743531 esp_riscv.c:356 esp_riscv_handle_target_event(): 23
Info : 348995 743531 server.c:569 server_loop(): dropped 'gdb' connection
[2023-06-26T14:24:38.569Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session closed
GDB server session ended. This terminal will be reused, waiting for next session to start...
The text was updated successfully, but these errors were encountered: