espressif / arduino-esp32

Arduino core for the ESP32
GNU Lesser General Public License v2.1
13.66k stars 7.42k forks source link

JTAG programming ESP32-C3 Not Working #8334

Open mjs513 opened 1 year ago

mjs513 commented 1 year ago

Board

ESP32-C3 Dev Board

Device Description

DIYmall NiceMCU-C3F V1.0 ESP32-C3

Hardware Configuration

RGB LED attached to GPIO8, GPIO5 and GPIO4.

GPIO18/19 attached to usb cable: GPIO18 D- to WTH on the cable GPIO19 D+ to GRN on the cable

Version

v2.0.9

IDE Name

Arduino IDE 2.1.1 nightly 20230529

Operating System

Windows 10 x64

Flash frequency

80Mz

PSRAM enabled

yes

Upload speed

921600

Description

For last week or so we have been trying to get Debug working using the Arduino IDE 2.x debugger with no luck. On setup is based on attacing a USB cable to pins IO18/19 with gnd to gnd and powering from the USB connector. This is based on the following: Configure ESP32-C3 built-in JTAG Interface

We also downloaded ESP-tools so we have the correct drivers install as we saw this: Arduino IDE 2.X Debug however even with the driver installed I am see this for the USB connected to D-/D_ Capture

When I went to manually install the driver it did not update so went in and tried a different way and gave me an error that said I needed the x64 driver???

GDB console shows the following error:

Debug: 223 62 semihosting_common.c:107 semihosting_common_init():  
Error: 224 91 esp_usb_jtag.c:642 esp_usb_jtag_init(): esp_usb_jtag: could not find or open device!
Debug: 225 91 command.c:545 run_command(): Command 'init' failed with error code -4
User : 226 92 command.c:608 command_run_line(): 
Error: 227 92 riscv.c:1755 riscv_get_gdb_arch(): Unsupported xlen: -1
Error: 228 92 esp_semihosting.c:67 target_to_esp_semihost_data(): Unknown target arch!
Debug: 229 92 riscv.c:490 riscv_deinit_target(): riscv_deinit_target()
Debug: 230 92 target.c:2225 target_free_all_working_areas_restore(): freeing all working areas
[2023-06-19T17:27:37.548Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session closed
GDB server session ended. This terminal will be reused, waiting for next session to start...

Sketch

/*
  Blink

  Turns an LED on for one second, then off for one second, repeatedly.

  Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO
  it is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN is set to
  the correct LED pin independent of which board is used.
  If you want to know what pin the on-board LED is connected to on your Arduino
  model, check the Technical Specs of your board at:
  https://www.arduino.cc/en/Main/Products

  modified 8 May 2014
  by Scott Fitzgerald
  modified 2 Sep 2016
  by Arturo Guadalupi
  modified 8 Sep 2016
  by Colby Newman

  This example code is in the public domain.

  https://www.arduino.cc/en/Tutorial/BuiltInExamples/Blink
*/

#define LED_BUILTIN 8

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, HIGH);  // turn the LED on (HIGH is the voltage level)
  delay(1000);                      // wait for a second
  digitalWrite(LED_BUILTIN, LOW);   // turn the LED off by making the voltage LOW
  delay(1000);                      // wait for a second
}

### Debug Message

```plain
Debug: 223 62 semihosting_common.c:107 semihosting_common_init():  
Error: 224 91 esp_usb_jtag.c:642 esp_usb_jtag_init(): esp_usb_jtag: could not find or open device!
Debug: 225 91 command.c:545 run_command(): Command 'init' failed with error code -4
User : 226 92 command.c:608 command_run_line(): 
Error: 227 92 riscv.c:1755 riscv_get_gdb_arch(): Unsupported xlen: -1
Error: 228 92 esp_semihosting.c:67 target_to_esp_semihost_data(): Unknown target arch!
Debug: 229 92 riscv.c:490 riscv_deinit_target(): riscv_deinit_target()
Debug: 230 92 target.c:2225 target_free_all_working_areas_restore(): freeing all working areas
[2023-06-19T17:27:37.548Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session closed
GDB server session ended. This terminal will be reused, waiting for next session to start...

Here is the entire log

[2023-06-19T17:27:37.378Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session connected. You can switch to "DEBUG CONSOLE" to see GDB interactions.
"C:\\Users\\Merli\\AppData\\Local\\Arduino15\\packages\\esp32\\tools\\openocd-esp32\\v0.11.0-esp32-20221026/bin/openocd" -c "gdb_port 50000" -c "tcl_port 50001" -c "telnet_port 50002" -s "d:\\Users\\Merli\\Documents\\Arduino\\Blink_rgb" -f "F:/Arduino-2-0/resources/app/plugins/cortex-debug/extension/support/openocd-helpers.tcl" -f debug.cfg -d3
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
User : 3 3 options.c:52 configuration_output_handler(): debug_level: 3
User : 4 3 options.c:52 configuration_output_handler(): 
Debug: 5 3 options.c:233 add_default_dirs(): bindir=/builds/idf/openocd-esp32/_build/../openocd-esp32/bin
Debug: 6 4 options.c:234 add_default_dirs(): pkgdatadir=/builds/idf/openocd-esp32/_build/../openocd-esp32/share/openocd
Debug: 7 4 options.c:235 add_default_dirs(): exepath=C:/Users/Merli/AppData/Local/Arduino15/packages/esp32/tools/openocd-esp32/v0.11.0-esp32-20221026/bin
Debug: 8 4 options.c:236 add_default_dirs(): bin2data=../share/openocd
Debug: 9 4 configuration.c:33 add_script_search_dir(): adding C:/Users/Merli/AppData/Roaming/OpenOCD
Debug: 10 4 configuration.c:33 add_script_search_dir(): adding C:/Users/Merli/AppData/Local/Arduino15/packages/esp32/tools/openocd-esp32/v0.11.0-esp32-20221026/bin/../share/openocd/site
Debug: 11 5 configuration.c:33 add_script_search_dir(): adding C:/Users/Merli/AppData/Local/Arduino15/packages/esp32/tools/openocd-esp32/v0.11.0-esp32-20221026/bin/../share/openocd/scripts
Debug: 12 5 command.c:155 script_debug(): command - gdb_port 50000
Debug: 13 5 command.c:155 script_debug(): command - tcl_port 50001
Debug: 14 5 command.c:155 script_debug(): command - telnet_port 50002
Debug: 15 5 command.c:155 script_debug(): command - ocd_find F:/Arduino-2-0/resources/app/plugins/cortex-debug/extension/support/openocd-helpers.tcl
Debug: 16 6 configuration.c:88 find_file(): found F:/Arduino-2-0/resources/app/plugins/cortex-debug/extension/support/openocd-helpers.tcl
User : 17 10 options.c:52 configuration_output_handler(): CDRTOSConfigureUser : 18 10 options.c:52 configuration_output_handler(): 
Debug: 19 10 command.c:155 script_debug(): command - ocd_find debug.cfg
Debug: 20 11 configuration.c:88 find_file(): found debug.cfg
Debug: 21 11 command.c:155 script_debug(): command - ocd_find interface/esp_usb_jtag.cfg
Debug: 22 12 configuration.c:88 find_file(): found C:/Users/Merli/AppData/Local/Arduino15/packages/esp32/tools/openocd-esp32/v0.11.0-esp32-20221026/bin/../share/openocd/scripts/interface/esp_usb_jtag.cfg
Debug: 23 12 command.c:155 script_debug(): command - adapter driver esp_usb_jtag
Info : 24 13 transport.c:107 allow_transports(): only one transport option; autoselect 'jtag'
Debug: 25 13 command.c:155 script_debug(): command - espusbjtag vid_pid 0x303a 0x1001
Info : 26 13 esp_usb_jtag.c:890 esp_usb_jtag_vid_pid(): esp_usb_jtag: VID set to 0x303a and PID to 0x1001
Debug: 27 13 command.c:155 script_debug(): command - espusbjtag caps_descriptor 0x2000
Info : 28 13 esp_usb_jtag.c:901 esp_usb_jtag_caps_descriptor(): esp_usb_jtag: capabilities descriptor set to 0x2000
Debug: 29 13 command.c:155 script_debug(): command - adapter speed 40000
Debug: 30 14 adapter.c:251 adapter_config_khz(): handle adapter khz
Debug: 31 14 adapter.c:215 adapter_khz_to_speed(): convert khz to adapter specific speed value
Debug: 32 14 adapter.c:215 adapter_khz_to_speed(): convert khz to adapter specific speed value
Debug: 33 14 command.c:155 script_debug(): command - ocd_find target/esp32c3.cfg
Debug: 34 15 configuration.c:88 find_file(): found C:/Users/Merli/AppData/Local/Arduino15/packages/esp32/tools/openocd-esp32/v0.11.0-esp32-20221026/bin/../share/openocd/scripts/target/esp32c3.cfg
Debug: 35 16 command.c:155 script_debug(): command - transport select jtag
Warn : 36 16 transport.c:276 jim_transport_select(): Transport "jtag" was already selected
Debug: 37 17 command.c:155 script_debug(): command - ocd_find bitsbytes.tcl
Debug: 38 18 configuration.c:88 find_file(): found C:/Users/Merli/AppData/Local/Arduino15/packages/esp32/tools/openocd-esp32/v0.11.0-esp32-20221026/bin/../share/openocd/scripts/bitsbytes.tcl
Debug: 39 19 command.c:155 script_debug(): command - expr 1 << $x
Debug: 40 19 command.c:155 script_debug(): command - expr $x + 1
Debug: 41 19 command.c:155 script_debug(): command - expr 1 << $x
Debug: 42 19 command.c:155 script_debug(): command - expr $x + 1
Debug: 43 19 command.c:155 script_debug(): command - expr 1 << $x
Debug: 44 20 command.c:155 script_debug(): command - expr $x + 1
Debug: 45 20 command.c:155 script_debug(): command - expr 1 << $x
Debug: 46 20 command.c:155 script_debug(): command - expr $x + 1
Debug: 47 21 command.c:155 script_debug(): command - expr 1 << $x
Debug: 48 21 command.c:155 script_debug(): command - expr $x + 1
Debug: 49 21 command.c:155 script_debug(): command - expr 1 << $x
Debug: 50 21 command.c:155 script_debug(): command - expr $x + 1
Debug: 51 21 command.c:155 script_debug(): command - expr 1 << $x
Debug: 52 21 command.c:155 script_debug(): command - expr $x + 1
Debug: 53 21 command.c:155 script_debug(): command - expr 1 << $x
Debug: 54 21 command.c:155 script_debug(): command - expr $x + 1
Debug: 55 22 command.c:155 script_debug(): command - expr 1 << $x
Debug: 56 22 command.c:155 script_debug(): command - expr $x + 1
Debug: 57 22 command.c:155 script_debug(): command - expr 1 << $x
Debug: 58 22 command.c:155 script_debug(): command - expr $x + 1
Debug: 59 22 command.c:155 script_debug(): command - expr 1 << $x
Debug: 60 22 command.c:155 script_debug(): command - expr $x + 1
Debug: 61 22 command.c:155 script_debug(): command - expr 1 << $x
Debug: 62 23 command.c:155 script_debug(): command - expr $x + 1
Debug: 63 23 command.c:155 script_debug(): command - expr 1 << $x
Debug: 64 23 command.c:155 script_debug(): command - expr $x + 1
Debug: 65 23 command.c:155 script_debug(): command - expr 1 << $x
Debug: 66 23 command.c:155 script_debug(): command - expr $x + 1
Debug: 67 23 command.c:155 script_debug(): command - expr 1 << $x
Debug: 68 23 command.c:155 script_debug(): command - expr $x + 1
Debug: 69 23 command.c:155 script_debug(): command - expr 1 << $x
Debug: 70 24 command.c:155 script_debug(): command - expr $x + 1
Debug: 71 24 command.c:155 script_debug(): command - expr 1 << $x
Debug: 72 24 command.c:155 script_debug(): command - expr $x + 1
Debug: 73 24 command.c:155 script_debug(): command - expr 1 << $x
Debug: 74 24 command.c:155 script_debug(): command - expr $x + 1
Debug: 75 24 command.c:155 script_debug(): command - expr 1 << $x
Debug: 76 24 command.c:155 script_debug(): command - expr $x + 1
Debug: 77 25 command.c:155 script_debug(): command - expr 1 << $x
Debug: 78 25 command.c:155 script_debug(): command - expr $x + 1
Debug: 79 25 command.c:155 script_debug(): command - expr 1 << $x
Debug: 80 25 command.c:155 script_debug(): command - expr $x + 1
Debug: 81 25 command.c:155 script_debug(): command - expr 1 << $x
Debug: 82 25 command.c:155 script_debug(): command - expr $x + 1
Debug: 83 25 command.c:155 script_debug(): command - expr 1 << $x
Debug: 84 25 command.c:155 script_debug(): command - expr $x + 1
Debug: 85 25 command.c:155 script_debug(): command - expr 1 << $x
Debug: 86 26 command.c:155 script_debug(): command - expr $x + 1
Debug: 87 26 command.c:155 script_debug(): command - expr 1 << $x
Debug: 88 26 command.c:155 script_debug(): command - expr $x + 1
Debug: 89 26 command.c:155 script_debug(): command - expr 1 << $x
Debug: 90 26 command.c:155 script_debug(): command - expr $x + 1
Debug: 91 26 command.c:155 script_debug(): command - expr 1 << $x
Debug: 92 26 command.c:155 script_debug(): command - expr $x + 1
Debug: 93 27 command.c:155 script_debug(): command - expr 1 << $x
Debug: 94 27 command.c:155 script_debug(): command - expr $x + 1
Debug: 95 27 command.c:155 script_debug(): command - expr 1 << $x
Debug: 96 27 command.c:155 script_debug(): command - expr $x + 1
Debug: 97 27 command.c:155 script_debug(): command - expr 1 << $x
Debug: 98 27 command.c:155 script_debug(): command - expr $x + 1
Debug: 99 27 command.c:155 script_debug(): command - expr 1 << $x
Debug: 100 28 command.c:155 script_debug(): command - expr $x + 1
Debug: 101 28 command.c:155 script_debug(): command - expr 1 << $x
Debug: 102 28 command.c:155 script_debug(): command - expr $x + 1
Debug: 103 28 command.c:155 script_debug(): command - expr 1024 * $x
Debug: 104 28 command.c:155 script_debug(): command - expr $x * 2
Debug: 105 28 command.c:155 script_debug(): command - expr 1024 * $x
Debug: 106 28 command.c:155 script_debug(): command - expr $x * 2
Debug: 107 29 command.c:155 script_debug(): command - expr 1024 * $x
Debug: 108 29 command.c:155 script_debug(): command - expr $x * 2
Debug: 109 29 command.c:155 script_debug(): command - expr 1024 * $x
Debug: 110 29 command.c:155 script_debug(): command - expr $x * 2
Debug: 111 29 command.c:155 script_debug(): command - expr 1024 * $x
Debug: 112 29 command.c:155 script_debug(): command - expr $x * 2
Debug: 113 29 command.c:155 script_debug(): command - expr 1024 * $x
Debug: 114 29 command.c:155 script_debug(): command - expr $x * 2
Debug: 115 30 command.c:155 script_debug(): command - expr 1024 * $x
Debug: 116 30 command.c:155 script_debug(): command - expr $x * 2
Debug: 117 30 command.c:155 script_debug(): command - expr 1024 * $x
Debug: 118 30 command.c:155 script_debug(): command - expr $x * 2
Debug: 119 30 command.c:155 script_debug(): command - expr 1024 * $x
Debug: 120 30 command.c:155 script_debug(): command - expr $x * 2
Debug: 121 30 command.c:155 script_debug(): command - expr 1024 * $x
Debug: 122 30 command.c:155 script_debug(): command - expr $x * 2
Debug: 123 31 command.c:155 script_debug(): command - expr 1024 * $x
Debug: 124 31 command.c:155 script_debug(): command - expr $x * 2
Debug: 125 31 command.c:155 script_debug(): command - expr 1024 * 1024 * $x
Debug: 126 31 command.c:155 script_debug(): command - expr $x * 2
Debug: 127 31 command.c:155 script_debug(): command - expr 1024 * 1024 * $x
Debug: 128 31 command.c:155 script_debug(): command - expr $x * 2
Debug: 129 31 command.c:155 script_debug(): command - expr 1024 * 1024 * $x
Debug: 130 32 command.c:155 script_debug(): command - expr $x * 2
Debug: 131 32 command.c:155 script_debug(): command - expr 1024 * 1024 * $x
Debug: 132 32 command.c:155 script_debug(): command - expr $x * 2
Debug: 133 32 command.c:155 script_debug(): command - expr 1024 * 1024 * $x
Debug: 134 32 command.c:155 script_debug(): command - expr $x * 2
Debug: 135 32 command.c:155 script_debug(): command - expr 1024 * 1024 * $x
Debug: 136 32 command.c:155 script_debug(): command - expr $x * 2
Debug: 137 33 command.c:155 script_debug(): command - expr 1024 * 1024 * $x
Debug: 138 33 command.c:155 script_debug(): command - expr $x * 2
Debug: 139 33 command.c:155 script_debug(): command - expr 1024 * 1024 * $x
Debug: 140 33 command.c:155 script_debug(): command - expr $x * 2
Debug: 141 33 command.c:155 script_debug(): command - expr 1024 * 1024 * $x
Debug: 142 33 command.c:155 script_debug(): command - expr $x * 2
Debug: 143 34 command.c:155 script_debug(): command - expr 1024 * 1024 * $x
Debug: 144 34 command.c:155 script_debug(): command - expr $x * 2
Debug: 145 34 command.c:155 script_debug(): command - expr 1024 * 1024 * $x
Debug: 146 34 command.c:155 script_debug(): command - expr $x * 2
Debug: 147 34 command.c:155 script_debug(): command - ocd_find memory.tcl
Debug: 148 35 configuration.c:88 find_file(): found C:/Users/Merli/AppData/Local/Arduino15/packages/esp32/tools/openocd-esp32/v0.11.0-esp32-20221026/bin/../share/openocd/scripts/memory.tcl
Debug: 149 37 command.c:155 script_debug(): command - expr $RWX_R_ONLY + $RWX_W_ONLY
Debug: 150 37 command.c:155 script_debug(): command - expr $RWX_R_ONLY + $RWX_X_ONLY
Debug: 151 37 command.c:155 script_debug(): command - expr $RWX_R_ONLY + $RWX_W_ONLY + $RWX_X_ONLY
Debug: 152 37 command.c:155 script_debug(): command - expr $ACCESS_WIDTH_8 + $ACCESS_WIDTH_16 + $ACCESS_WIDTH_32
Debug: 153 37 command.c:155 script_debug(): command - ocd_find mmr_helpers.tcl
Debug: 154 39 configuration.c:88 find_file(): found C:/Users/Merli/AppData/Local/Arduino15/packages/esp32/tools/openocd-esp32/v0.11.0-esp32-20221026/bin/../share/openocd/scripts/mmr_helpers.tcl
Debug: 155 40 command.c:155 script_debug(): command - ocd_find target/esp_common.cfg
Debug: 156 40 configuration.c:88 find_file(): found C:/Users/Merli/AppData/Local/Arduino15/packages/esp32/tools/openocd-esp32/v0.11.0-esp32-20221026/bin/../share/openocd/scripts/target/esp_common.cfg
Debug: 157 41 command.c:155 script_debug(): command - add_help_text program_esp write an image to flash, address is only required for binary images. verify, reset, exit, compress, restore_clock are optional
Debug: 158 42 command.c:155 script_debug(): command - add_usage_text program_esp <filename> [address] [verify] [reset] [exit] [compress] [no_clock_boost] [restore_clock]
Debug: 159 42 command.c:155 script_debug(): command - add_help_text program_esp_bins write all the images at address specified in flasher_args.json generated while building idf project
Debug: 160 43 command.c:155 script_debug(): command - add_usage_text program_esp_bins <build_dir> flasher_args.json [verify] [reset] [exit] [compress] [no_clock_boost] [restore_clock]
Debug: 161 43 command.c:155 script_debug(): command - add_help_text esp_get_mac Print MAC address of the chip. Use a `format` argument to return formatted MAC value
Debug: 162 43 command.c:155 script_debug(): command - add_usage_text esp_get_mac [format]
Debug: 163 44 command.c:155 script_debug(): command - jtag newtap esp32c3 cpu -irlen 5 -expected-id 0x00005c25
Debug: 164 44 tcl.c:558 jim_newtap_cmd(): Creating New Tap, Chip: esp32c3, Tap: cpu, Dotted: esp32c3.cpu, 4 params
Debug: 165 44 tcl.c:582 jim_newtap_cmd(): Processing option: -irlen
Debug: 166 44 tcl.c:582 jim_newtap_cmd(): Processing option: -expected-id
Debug: 167 44 core.c:1478 jtag_tap_init(): Created Tap: esp32c3.cpu @ abs position 0, irlen 5, capture: 0x1 mask: 0x3
Debug: 168 44 command.c:155 script_debug(): command - target create esp32c3 esp32c3 -chain-position esp32c3.cpu -rtos FreeRTOS
Debug: 169 45 target.c:2225 target_free_all_working_areas_restore(): freeing all working areas
Debug: 170 45 target.c:2225 target_free_all_working_areas_restore(): freeing all working areas
Debug: 171 45 FreeRTOS.c:1396 freertos_create(): freertos_create
Debug: 172 45 command.c:289 register_command(): command 'esp' is already registered
Debug: 173 46 command.c:289 register_command(): command 'esp32c3 esp' is already registered
Debug: 174 46 command.c:155 script_debug(): command - esp32c3 configure -event reset-assert-post  esp32c3_soc_reset 
Debug: 175 46 command.c:155 script_debug(): command - esp32c3 configure -event halted 
    esp32c3_wdt_disable

Debug: 176 46 command.c:155 script_debug(): command - esp32c3 configure -event examine-end 
    # Need this to handle 'apptrace init' syscall correctly because semihosting is not enabled by default
    arm semihosting enable
    arm semihosting_resexit enable
    if { [info exists _SEMIHOST_BASEDIR] } {
        if { $_SEMIHOST_BASEDIR != "" } {
            arm semihosting_basedir $_SEMIHOST_BASEDIR
        }
    }

Debug: 177 47 command.c:155 script_debug(): command - esp32c3 configure -event gdb-attach 
    # 'halt' is necessary to auto-probe flash bank when GDB is connected and generate proper memory map
    halt 1000
    if { [esp32c3_memprot_is_enabled] } {
        # 'reset halt' to disable memory protection and allow flasher to work correctly
        echo "Memory protection is enabled. Reset target to disable it..."
        reset halt
    }
    # by default mask interrupts while stepping
    riscv set_maskisr steponly

Debug: 178 48 command.c:155 script_debug(): command - esp32c3 configure -work-area-phys 0x40380000 -work-area-virt 0x40380000 -work-area-size 0x4000 -work-area-backup 1
Debug: 179 48 target.c:2225 target_free_all_working_areas_restore(): freeing all working areas
Debug: 180 48 target.c:2225 target_free_all_working_areas_restore(): freeing all working areas
Debug: 181 49 target.c:2225 target_free_all_working_areas_restore(): freeing all working areas
Debug: 182 49 target.c:2225 target_free_all_working_areas_restore(): freeing all working areas
Debug: 183 49 command.c:155 script_debug(): command - esp32c3 configure -alt-work-area-phys 0x3FC84000 -alt-work-area-virt 0x3FC84000 -alt-work-area-size 0x20000 -alt-work-area-backup 1
Debug: 184 49 target.c:2225 target_free_all_working_areas_restore(): freeing all working areas
Debug: 185 50 target.c:2225 target_free_all_working_areas_restore(): freeing all working areas
Debug: 186 50 target.c:2225 target_free_all_working_areas_restore(): freeing all working areas
Debug: 187 50 target.c:2225 target_free_all_working_areas_restore(): freeing all working areas
Debug: 188 50 command.c:155 script_debug(): command - flash bank esp32c3.flash esp32c3 0x0 0 0 0 esp32c3
Debug: 189 50 command.c:289 register_command(): command 'esp' is already registered
Debug: 190 51 tcl.c:1305 handle_flash_bank_command(): 'esp32c3' driver usage field missing
Debug: 191 51 command.c:155 script_debug(): command - flash bank esp32c3.irom esp32c3 0x0 0 0 0 esp32c3
Debug: 192 51 command.c:289 register_command(): command 'esp' is already registered
Debug: 193 51 command.c:289 register_command(): command 'esp appimage_offset' is already registered
Debug: 194 51 command.c:289 register_command(): command 'esp compression' is already registered
Debug: 195 51 command.c:289 register_command(): command 'esp verify_bank_hash' is already registered
Debug: 196 52 command.c:289 register_command(): command 'esp flash_stub_clock_boost' is already registered
Debug: 197 52 tcl.c:1305 handle_flash_bank_command(): 'esp32c3' driver usage field missing
Debug: 198 52 command.c:155 script_debug(): command - flash bank esp32c3.drom esp32c3 0x0 0 0 0 esp32c3
Debug: 199 52 command.c:289 register_command(): command 'esp' is already registered
Debug: 200 52 command.c:289 register_command(): command 'esp appimage_offset' is already registered
Debug: 201 53 command.c:289 register_command(): command 'esp compression' is already registered
Debug: 202 53 command.c:289 register_command(): command 'esp verify_bank_hash' is already registered
Debug: 203 53 command.c:289 register_command(): command 'esp flash_stub_clock_boost' is already registered
Debug: 204 53 tcl.c:1305 handle_flash_bank_command(): 'esp32c3' driver usage field missing
Debug: 205 53 command.c:155 script_debug(): command - riscv set_reset_timeout_sec 2
Debug: 206 54 command.c:155 script_debug(): command - riscv set_command_timeout_sec 5
Debug: 207 54 command.c:155 script_debug(): command - riscv set_mem_access sysbus progbuf abstract
Debug: 208 55 command.c:155 script_debug(): command - riscv set_ebreakm on
Debug: 209 55 command.c:155 script_debug(): command - riscv set_ebreaks on
Debug: 210 55 command.c:155 script_debug(): command - riscv set_ebreaku on
Info : 211 59 server.c:292 add_service(): Listening on port 50001 for tcl connections
Info : 212 60 server.c:292 add_service(): Listening on port 50002 for telnet connections
Debug: 213 60 command.c:155 script_debug(): command - init
Debug: 214 60 command.c:155 script_debug(): command - target init
Debug: 215 60 command.c:155 script_debug(): command - target names
Debug: 216 61 command.c:155 script_debug(): command - esp32c3 cget -event gdb-flash-erase-start
Debug: 217 61 command.c:155 script_debug(): command - esp32c3 configure -event gdb-flash-erase-start reset init
Debug: 218 61 command.c:155 script_debug(): command - esp32c3 cget -event gdb-flash-write-end
Debug: 219 61 command.c:155 script_debug(): command - esp32c3 configure -event gdb-flash-write-end reset halt
Debug: 220 62 command.c:155 script_debug(): command - esp32c3 cget -event gdb-attach
Debug: 221 62 target.c:1659 handle_target_init_command(): Initializing targets...
Debug: 222 62 riscv.c:444 riscv_init_target(): riscv_init_target()
Debug: 223 62 semihosting_common.c:107 semihosting_common_init():  
Error: 224 91 esp_usb_jtag.c:642 esp_usb_jtag_init(): esp_usb_jtag: could not find or open device!
Debug: 225 91 command.c:545 run_command(): Command 'init' failed with error code -4
User : 226 92 command.c:608 command_run_line(): 
Error: 227 92 riscv.c:1755 riscv_get_gdb_arch(): Unsupported xlen: -1
Error: 228 92 esp_semihosting.c:67 target_to_esp_semihost_data(): Unknown target arch!
Debug: 229 92 riscv.c:490 riscv_deinit_target(): riscv_deinit_target()
Debug: 230 92 target.c:2225 target_free_all_working_areas_restore(): freeing all working areas
[2023-06-19T17:27:37.548Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session closed

### Other Steps to Reproduce

Settings:
Core Debug Level: DEBUG
JTAG Adapter: Integrated USB JTAG
Note I do not see an optimization level
-----------------------------

Other info:  
Fuse summary

espefuse.py v4.5.1 Connecting.... Detecting chip type... ESP32-C3

=== Run "summary" command === EFUSE_NAME (Block) Description = [Meaningful Value] [Readable/Writeable] (Hex Value)

Calibration fuses: TEMP_SENSOR_CAL (BLOCK2) Temperature calibration = -3.2 R/W (0b100100000) ADC1_MODE0_D2 (BLOCK2) ADC1 calibration 1 = -208 R/W (0xb4) ADC1_MODE1_D2 (BLOCK2) ADC1 calibration 2 = 356 R/W (0x59) ADC1_MODE2_D2 (BLOCK2) ADC1 calibration 3 = -44 R/W (0x8b) ADC1_MODE3_D2 (BLOCK2) ADC1 calibration 4 = 292 R/W (0x49) ADC2_MODE0_D2 (BLOCK2) ADC2 calibration 5 = -472 R/W (0xf6) ADC2_MODE1_D2 (BLOCK2) ADC2 calibration 6 = 296 R/W (0x4a) ADC2_MODE2_D2 (BLOCK2) ADC2 calibration 7 = -388 R/W (0xe1) ADC2_MODE3_D2 (BLOCK2) ADC2 calibration 8 = 32 R/W (0x08) ADC1_MODE0_D1 (BLOCK2) ADC1 calibration 9 = 44 R/W (0b001011) ADC1_MODE1_D1 (BLOCK2) ADC1 calibration 10 = 96 R/W (0b011000) ADC1_MODE2_D1 (BLOCK2) ADC1 calibration 11 = 52 R/W (0b001101) ADC1_MODE3_D1 (BLOCK2) ADC1 calibration 12 = 8 R/W (0b000010) ADC2_MODE0_D1 (BLOCK2) ADC2 calibration 13 = 0 R/W (0b000000) ADC2_MODE1_D1 (BLOCK2) ADC2 calibration 14 = 0 R/W (0b000000) ADC2_MODE2_D1 (BLOCK2) ADC2 calibration 15 = 0 R/W (0b000000) ADC2_MODE3_D1 (BLOCK2) ADC2 calibration 16 = 0 R/W (0b000000)

Config fuses: DIS_ICACHE (BLOCK0) Disables ICache = False R/W (0b0) DIS_DOWNLOAD_ICACHE (BLOCK0) Disables Icache when SoC is in Download mode = False R/W (0b0) DIS_FORCE_DOWNLOAD (BLOCK0) Disables forcing chip into Download mode = False R/W (0b0) DIS_CAN (BLOCK0) Disables the TWAI Controller hardware = False R/W (0b0) VDD_SPI_AS_GPIO (BLOCK0) Set this bit to vdd spi pin function as gpio = False R/W (0b0) BTLC_GPIO_ENABLE (BLOCK0) Enable btlc gpio = 0 R/W (0b00) POWERGLITCH_EN (BLOCK0) Set this bit to enable power glitch function = False R/W (0b0) POWER_GLITCH_DSENSE (BLOCK0) Sample delay configuration of power glitch = 0 R/W (0b00) DIS_DIRECT_BOOT (BLOCK0) Disables direct boot mode = False R/W (0b0) DIS_USB_SERIAL_JTAG_ROM_PRINT (BLOCK0) Disables USB-Serial-JTAG ROM printing = False R/W (0b0) UART_PRINT_CONTROL (BLOCK0) Sets the default UART boot message output mode = Enabled R/W (0b00) FORCE_SEND_RESUME (BLOCK0) Force ROM code to send a resume command during SPI = False R/W (0b0) bootduring SPI boot ERR_RST_ENABLE (BLOCK0) Use BLOCK0 to check error record registers = without check R/W (0b0) DISABLE_WAFER_VERSION_MAJOR (BLOCK0) Disables check of wafer version major = False R/W (0b0) DISABLE_BLK_VERSION_MAJOR (BLOCK0) Disables check of blk version major = False R/W (0b0) BLOCK_USR_DATA (BLOCK3) User data = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 R/W

Efuse fuses: WR_DIS (BLOCK0) Disables programming of individual eFuses = 0 R/W (0x00000000) RD_DIS (BLOCK0) Disables software reading from BLOCK4-10 = 0 R/W (0b0000000)

Flash Config fuses: FLASH_TPUW (BLOCK0) Configures flash startup delay after SoC power-up, = 0 R/W (0x0) unit is (ms/2). When the value is 15, delay is 7. 5 ms

Identity fuses: SECURE_VERSION (BLOCK0) Secure version (used by ESP-IDF anti-rollback feat = 0 R/W (0x0000) ure) MAC (BLOCK1) Factory MAC Address = 60:55:f9:25:c7:cc (OK) R/W WAFER_VERSION_MINOR_LO (BLOCK1) WAFER_VERSION_MINOR least significant bits = 3 R/W (0b011) PKG_VERSION (BLOCK1) Package version = 0 R/W (0b000) BLK_VERSION_MINOR (BLOCK1) BLOCK version minor = 1 R/W (0b001) WAFER_VERSION_MINOR_HI (BLOCK1) WAFER_VERSION_MINOR most significant bits = 0 R/W (0b0) WAFER_VERSION_MAJOR (BLOCK1) WAFER_VERSION_MAJOR = 0 R/W (0b00) OPTIONAL_UNIQUE_ID (BLOCK2) Optional unique 128-bit ID = 17 34 a4 98 f4 eb e6 3a 7a 48 96 74 c2 99 62 5b R/W BLK_VERSION_MAJOR (BLOCK2) BLOCK version major = With calibration R/W (0b01) CUSTOM_MAC (BLOCK3) Custom MAC Address = 00:00:00:00:00:00 (OK) R/W WAFER_VERSION_MINOR (BLOCK0) calc WAFER VERSION MINOR = WAFER_VERSION_MINOR_HI = 3 R/W (0x3) << 3 + WAFER_VERSION_MINOR_LO (read only)

Jtag Config fuses: SOFT_DIS_JTAG (BLOCK0) Software disables JTAG. When software disabled, JT = 0 R/W (0b000) AG can be activated temporarily by HMAC peripheral DIS_PAD_JTAG (BLOCK0) Permanently disable JTAG access via pads. USB JTAG = False R/W (0b0) is controlled separately.

Security fuses: DIS_DOWNLOAD_MANUAL_ENCRYPT (BLOCK0) Disables flash encryption when in download boot mo = False R/W (0b0) des SPI_BOOT_CRYPT_CNT (BLOCK0) Enables encryption and decryption, when an SPI boo = Disable R/W (0b000) t mode is set. Enabled when 1 or 3 bits are set,di sabled otherwise SECURE_BOOT_KEY_REVOKE0 (BLOCK0) If set, revokes use of secure boot key digest 0 = False R/W (0b0) SECURE_BOOT_KEY_REVOKE1 (BLOCK0) If set, revokes use of secure boot key digest 1 = False R/W (0b0) SECURE_BOOT_KEY_REVOKE2 (BLOCK0) If set, revokes use of secure boot key digest 2 = False R/W (0b0) KEY_PURPOSE_0 (BLOCK0) KEY0 purpose = USER R/W (0x0) KEY_PURPOSE_1 (BLOCK0) KEY1 purpose = USER R/W (0x0) KEY_PURPOSE_2 (BLOCK0) KEY2 purpose = USER R/W (0x0) KEY_PURPOSE_3 (BLOCK0) KEY3 purpose = USER R/W (0x0) KEY_PURPOSE_4 (BLOCK0) KEY4 purpose = USER R/W (0x0) KEY_PURPOSE_5 (BLOCK0) KEY5 purpose = USER R/W (0x0) SECURE_BOOT_EN (BLOCK0) Enables secure boot = False R/W (0b0) SECURE_BOOT_AGGRESSIVE_REVOKE (BLOCK0) Enables aggressive secure boot key revocation mode = False R/W (0b0) DIS_DOWNLOAD_MODE (BLOCK0) Disables all Download boot modes = False R/W (0b0) ENABLE_SECURITY_DOWNLOAD (BLOCK0) Enables secure UART download mode (read/write flas = False R/W (0b0) h only) BLOCK_KEY0 (BLOCK4) Purpose: USER Encryption key0 or user data = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 R/W BLOCK_KEY1 (BLOCK5) Purpose: USER Encryption key1 or user data = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 R/W BLOCK_KEY2 (BLOCK6) Purpose: USER Encryption key2 or user data = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 R/W BLOCK_KEY3 (BLOCK7) Purpose: USER Encryption key3 or user data = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 R/W BLOCK_KEY4 (BLOCK8) Purpose: USER Encryption key4 or user data = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 R/W BLOCK_KEY5 (BLOCK9) Purpose: USER Encryption key5 or user data = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 R/W BLOCK_SYS_DATA2 (BLOCK10) System data (part 2) = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 R/W

Spi_Pad_Config fuses: SPI_PAD_CONFIG_CLK (BLOCK1) SPI CLK pad = 0 R/W (0b000000) SPI_PAD_CONFIG_Q (BLOCK1) SPI Q (D1) pad = 0 R/W (0b000000) SPI_PAD_CONFIG_D (BLOCK1) SPI D (D0) pad = 0 R/W (0b000000) SPI_PAD_CONFIG_CS (BLOCK1) SPI CS pad = 0 R/W (0b000000) SPI_PAD_CONFIG_HD (BLOCK1) SPI HD (D3) pad = 0 R/W (0b000000) SPI_PAD_CONFIG_WP (BLOCK1) SPI WP (D2) pad = 0 R/W (0b000000) SPI_PAD_CONFIG_DQS (BLOCK1) SPI DQS pad = 0 R/W (0b000000) SPI_PAD_CONFIG_D4 (BLOCK1) SPI D4 pad = 0 R/W (0b000000) SPI_PAD_CONFIG_D5 (BLOCK1) SPI D5 pad = 0 R/W (0b000000) SPI_PAD_CONFIG_D6 (BLOCK1) SPI D6 pad = 0 R/W (0b000000) SPI_PAD_CONFIG_D7 (BLOCK1) SPI D7 pad = 0 R/W (0b000000)

Usb Config fuses: DIS_USB_JTAG (BLOCK0) Disables USB JTAG. JTAG access via pads is control = False R/W (0b0) led separately DIS_USB_DEVICE (BLOCK0) Disables USB DEVICE = False R/W (0b0) USB_EXCHG_PINS (BLOCK0) Exchanges USB D+ and D- pins = False R/W (0b0) DIS_USB_SERIAL_JTAG_DOWNLOAD_MODE (BLOCK0) Disables USB-Serial-JTAG download feature in UART = False R/W (0b0) download boot mode

Wdt Config fuses: WDT_DELAY_SEL (BLOCK0) Selects RTC WDT timeout threshold at startup = False R/W (0b0)

PS D:\Espressif\frameworks\esp-idf-v5.0.2>



### I have checked existing issues, online documentation and the Troubleshooting Guide

- [X] I confirm I have checked existing issues, online documentation and Troubleshooting guide.
KurtE commented 1 year ago

@mjs513 - I have the same issue with a different C3 module: https://www.amazon.com/dp/B0BWN14X65

I have also tried hooking it up to an RPI Pico board. running as a CMIS-DAP JTAG using https://github.com/ataradov/free-dap I have another Pico running the same software that talks to an Arduino MKRZero using swd mode. I believe the ESP32-C3 does not support SWD mode so I hooked it up with 4 signal wires: RPI pin ESP32_pin 11(SWCLK/TCK) -> GPIO6 12(SWDIO/TMS) -> GPIO4 13 TDI -> GPIO5 14 TDO -> GPIO7

So far they are not talking. It is unclear to me how to configure the IDE to support this? image

me-no-dev commented 1 year ago

@mjs513 your configuration is correct. Did you make sure that before starting debug you actually built and uploaded the sketch that you want to debug? This must be done any time you restart the IDE/reopen the sketch. Necessary because some files need to be copied to the sketch folder and ELF to be picked up by GDB. Use only the top 3 buttons of the IDE to compile and start debug.

me-no-dev commented 1 year ago

@KurtE C3 has integrated JTAG. No external hardware or connections are necessary other than the USB port, as @mjs513 explained

mjs513 commented 1 year ago

@me-no-dev thanks for getting back to us so fast. The answer to your question is yes I uploaded the sketch first and then hit the debug button on the top of the IDE. As @KurtE said he tried it with a different board than I have as well as trying to use the JTAG connectors.

At this point do not know where to go from here. As you said it should work.

edit: Think whats bothering me is that its not seeing the debug port as a USB/JTAG port.

EDIT2: It might be related to https://github.com/espressif/arduino-esp32/pull/7295, followed the same procedure to update driver. it shows driver is installed but my x64 machine is not seeing it or not recognizing that the driver is associated the port.

mjs513 commented 1 year ago

@me-no-dev and @KurtE Tried using VSCode just to see if would recognize the port and upload and if failed with the same error. Its not seeing the usb cable attached to pins 18/19 as as seperate device. Only seeing one device on com8. From what I understand I should be seeing 2 com ports but I am not. If I try to install with have disk I am seeing:

Capture

KurtE commented 1 year ago

@KurtE C3 has integrated JTAG. No external hardware or connections are necessary other than the USB port, as @mjs513 explained

Understood, but when the USB connection did not works, I thought I would try the other option. LIke what is described in: https://visualgdb.com/tutorials/esp32/esp32-c3/

Note some of their instructions for using the USB Port version: image

Their cable made no sense to me as I believe they are the same pins that hook up to the actual USB connector: image

Wondering when the board boots up and I open up the Serial Monitor window, I see a bunch of text messages: That appear like the keep repeating, with data like:

ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xf (SPI_FAST_FLASH_BOOT)
Saved PC:0x403cf890
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd5810,len:0x438
load:0x403cc710,len:0x91c
load:0x403ce710,len:0x25b0
entry 0x403cc710

If this is related with JTAG stuff or potentially some internal debug stuff that is outputting by default?

Thanks Kurt

SuGlider commented 1 year ago

Wondering when the board boots up and I open up the Serial Monitor window, I see a bunch of text messages: That appear like the keep repeating, with data like:

ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xf (SPI_FAST_FLASH_BOOT)
Saved PC:0x403cf890
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd5810,len:0x438
load:0x403cc710,len:0x91c
load:0x403ce710,len:0x25b0
entry 0x403cc710

If this is related with JTAG stuff or potentially some internal debug stuff that is outputting by default?

@KurtE This is the ESP32-C3 bootloader messages. Not related to the debugging process.

mjs513 commented 1 year ago

Not sure if this pertains to the current issue or not. After some more googling I found this https://www.esp32.com/viewtopic.php?t=31380

basically it adds the following command arg to opencd: -c "gdb_memory_map disable" I would try to add it but not sure where to even give it a try.

KurtE commented 1 year ago

Wondering when the board boots up and I open up the Serial Monitor window, I see a bunch of text messages: That appear like the keep repeating, with data ... If this is related with JTAG stuff or potentially some internal debug stuff that is outputting by default?

@KurtE This is the ESP32-C3 bootloader messages. Not related to the debugging process.

Thanks, today I have had some luck at least getting the debugger up. My ESP32-c3 board has external 4mb flash and I need to configure the flash to DIO mode instead of QIO mode.

Now at least the debugger comes up. Not sure what the configuration should be if the ESP32-c3 has internal flash. WIll hopefully find out soon, as other one(s) arrive in a few days.

Note, I don't think it is working overly well, as if you try to step or the like it sort of hangs or restarts... But at least it comes up.

Wonder if some of these issues are due to differences between Arm Cortex versus risc-v

mjs513 commented 1 year ago

I just found this related to wifi: https://github.com/espressif/esp-at/issues/615#issuecomment-1065018934

SuGlider commented 1 year ago

I just found this related to wifi: espressif/esp-at#615 (comment)

Arduino 2.0.9 uses IDF 4.4, therefore this fix is already included.

mjs513 commented 1 year ago

I just found this related to wifi: espressif/esp-at#615 (comment)

Arduino 2.0.9 uses IDF 4.4, therefore this fix is already included.

Thanks - need to make sure. But I just received a ESP32-C3 WROOM DevKitC-02 and connected it up and it works out of the box - the second serial port shows as USB Serial that pins 18/19 are connected with the USB cable so it has to be something with the board.

mjs513 commented 1 year ago

Just to close the loop I finally tracked down the issue with JTAG not working on this paticular board. Turns out its a hardware issue - pins18/19 are shorted together even though there does not seem to be a solder bridge on my soldering on the header pins. Pulled out my multimeter and tested. Tried it a different board (came in a package of three) and it worked so going to close out this issue.

KurtE commented 1 year ago

@me-no-dev @mjs513 - I can start up the debugger on a couple of the different boards, but wondering does any of it actually work?

Once it starts up can you get it to set a breakpoint and have it be hit. And if it is hit, can you continue from this location? Can you use the step in and step over?

If I try to get the code to continue, the gdb-server panel starts producing lots of debug output. I am running the c3 devkit m... And nothing beyond the startup appears to work for me.
I am probably missing something obvious. but wondering if any of the stuff works for you?

Kurt

mjs513 commented 1 year ago

@KurtE Just hooked the C3 up again (Espressif WROOM esp32-c3 devkit) and can confirm its doing the same thing for me as well. Yesterday I did not notice it.

I am running the BlinkRGB example with a extra Serial.print right before the endif. I hit continue button and I get

gdb_log_outgoing_packet(): [esp32c3] sending packet: $a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5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a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a081384040af38401031c93f00c2c83fc495c83f0e8905400f000000ffffffff002000608000000024bfc83f3c31c93f40a1000040000000000000e0000000f0ffffffffffffffff80a1000000f0c83f000000004cbfc83f5844c93f40000000000100004cbfc83f0000000000f0c83f00e000000000000000200060ee813840a5a5a5a5fc0000003c31c93f400000000000c93f0000c93f00e0000040af3840a4f8c83f94f8c83f6cbfc83fe46c3840ffffffffffffffffffffffffff00000000f0c83fffffffff6cbfc83f00de0000000200000002000020bfc83fb430384000000000000200006cbfc83f4a1d3840787538406e8c00420032c93f0ef0924dc495c83fffffffff94a5384000000000000000000000000000000000000000000080033c2041c93fc032c93f00f0c83f00f0c83f6441c93fe840c93fe263004200100000ffffffff000000000000000000100000500100000843c93fff00000000f0c83fffffffffffffffffffffffff180000001400000004080000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0ef0924d00180000a80100005400000000000000000000000000000000000000000000000080033c2041c93f0080033c00f0c83f6441c93fc032c93fe840c93f0a63004250f9c83f00000000000000000ef0924d1800000014000000001800000000c93f0000060000000000000038c04800c93f50f9c83f0000000050f9c83f869e384000f0c83f00000000e840c93f7856adba0000000000000000240000003aa138402800000024000000040800000000c93f0000060000000000000038c01843c93f6cf9cd3f000000006cf9cd3f869e38405006000080f9cd3f80f9cd3f7856adbad0ffcd3f00000000540100003aa13840580100005401000000180000fe263840da753840c6753840b033c93f00c2c83fc495c83f0e890540b8713840ffffffff00000000000000000100000001000000000000000100000000000c600000c93facfacd3fffff7f800000000000000000000000000000000000000000000000000000000000000000000000000000000000000200ffffffffffffffffffffffff0000000000000000000000000a7538400000000000000000000000000000000000000000a5a5a5a5a5a5a5a5a5a5a5a5#e2

in the GDB window. If I hit it again then the spew starts and goes on endlessly.

Here is the sketch I am using:


void setup() {
  // No need to initialize the RGB LED
  Serial.begin(115200);
}

// the loop function runs over and over again forever
void loop() {
#ifdef RGB_BUILTIN
  digitalWrite(RGB_BUILTIN, HIGH);   // Turn the RGB LED white
  delay(1000);
  digitalWrite(RGB_BUILTIN, LOW);    // Turn the RGB LED off
  delay(1000);

  neopixelWrite(RGB_BUILTIN,RGB_BRIGHTNESS,0,0); // Red
  delay(1000);
  neopixelWrite(RGB_BUILTIN,0,RGB_BRIGHTNESS,0); // Green
  delay(1000);
  neopixelWrite(RGB_BUILTIN,0,0,RGB_BRIGHTNESS); // Blue
  delay(1000);
  neopixelWrite(RGB_BUILTIN,0,0,0); // Off / black
  delay(1000);
  Serial.println("end cycle");
#endif
}

also seems to break in setup at Serial.begin(115200) on the first continue button push and then on the second the infinite loop:

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 0x42000020: file D:\Users\Merli\Documents\Arduino\BlinkRGB_ESP32C3/BlinkRGB_ESP32C3.ino, line 20.
Note: automatically using hardware breakpoints for read-only addresses.
Program
 received signal SIGINT, Interrupt.
0x4004c0d6 in ?? ()
[New Thread 1070463660]
[New Thread 1070154348]
[New Thread 1070145936]
[New Thread 1070151672]
[Switching to Thread 1070463660]
Thread 2 "loopTask" hit Temporary breakpoint 1, setup () at D:\Users\Merli\Documents\Arduino\BlinkRGB_ESP32C3/BlinkRGB_ESP32C3.ino:20
20    Serial.begin(115200);
VojtechBartoska commented 1 year ago

@me-no-dev Can you please help with triage and possibly close this issue? Thanks

me-no-dev commented 1 year ago

@VojtechBartoska we need to investigate all outcomes and provide a good info/tutorial on using JTAG with Arduino. The last message clearly states that the JTAG hit the setup() breakpoint, but I suspect that the interface in the IDE did not update. There are different issues between the plugin versions used in the different IDE versions and also some on our side (openocd/gdb) that we have poked the relevant teams about, but seem unfixed still.

I want to make clear that we are mere users of what Espressif offers as OpenOCD/GDB and what Arduino.cc offers as IDE2+cortex-debug. Our configurations were vetted by the IDF team and should work as best as possible on the current platform. It's the nuances between the chips/architecture/interface that are most important to figure out and document. When using external debugger (as required for ESP32 and ESP32-S2) there are far less issues and debugging works much more as expected. Having the USB-JTAG internal, means that the interface gets restarted with the chip and more.