espressif / arduino-esp32

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

ESP32C3 Dev Module - esp_algo_flash_probe(): Target not halted #7988

Open matsujirushi opened 1 year ago

matsujirushi commented 1 year ago

Board

ESP32C3 Dev Module

Device Description

ESP32C3 Dev Module is selected for the board. The physical board uses Seeed Studio XIAO ESP32C3.

Hardware Configuration

Built-in USB only.

Version

v2.0.7

IDE Name

Arduino IDE 2.0.4

Operating System

Windows 11

Flash frequency

80MHz

PSRAM enabled

no

Upload speed

921600

Description

An error occurs when I start debugging with the Arduino IDE while the ESP32C3 program is running.

Error: 298 2330 esp_flash.c:935 esp_algo_flash_probe(): Target not halted

Sketch

void setup() {
  Serial.begin(115200);
}

void loop() {
  Serial.println(millis());
  delay(1000);
}

Debug Message

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

Debug: 178 76 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: 179 77 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: 180 80 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: 181 80 target.c:2225 target_free_all_working_areas_restore(): freeing all working areas
Debug: 182 81 target.c:2225 target_free_all_working_areas_restore(): freeing all working areas
Debug: 183 81 target.c:2225 target_free_all_working_areas_restore(): freeing all working areas
Debug: 184 81 target.c:2225 target_free_all_working_areas_restore(): freeing all working areas
Debug: 185 81 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: 186 82 target.c:2225 target_free_all_working_areas_restore(): freeing all working areas
Debug: 187 83 target.c:2225 target_free_all_working_areas_restore(): freeing all working areas
Debug: 188 83 target.c:2225 target_free_all_working_areas_restore(): freeing all working areas
Debug: 189 84 target.c:2225 target_free_all_working_areas_restore(): freeing all working areas
Debug: 190 84 command.c:155 script_debug(): command - flash bank esp32c3.flash esp32c3 0x0 0 0 0 esp32c3
Debug: 191 84 command.c:289 register_command(): command 'esp' is already registered
Debug: 192 85 tcl.c:1305 handle_flash_bank_command(): 'esp32c3' driver usage field missing
Debug: 193 85 command.c:155 script_debug(): command - flash bank esp32c3.irom esp32c3 0x0 0 0 0 esp32c3
Debug: 194 86 command.c:289 register_command(): command 'esp' is already registered
Debug: 195 86 command.c:289 register_command(): command 'esp appimage_offset' is already registered
Debug: 196 86 command.c:289 register_command(): command 'esp compression' is already registered
Debug: 197 87 command.c:289 register_command(): command 'esp verify_bank_hash' is already registered
Debug: 198 87 command.c:289 register_command(): command 'esp flash_stub_clock_boost' is already registered
Debug: 199 88 tcl.c:1305 handle_flash_bank_command(): 'esp32c3' driver usage field missing
Debug: 200 89 command.c:155 script_debug(): command - flash bank esp32c3.drom esp32c3 0x0 0 0 0 esp32c3
Debug: 201 90 command.c:289 register_command(): command 'esp' is already registered
Debug: 202 90 command.c:289 register_command(): command 'esp appimage_offset' is already registered
Debug: 203 91 command.c:289 register_command(): command 'esp compression' is already registered
Debug: 204 91 command.c:289 register_command(): command 'esp verify_bank_hash' is already registered
Debug: 205 91 command.c:289 register_command(): command 'esp flash_stub_clock_boost' is already registered
Debug: 206 92 tcl.c:1305 handle_flash_bank_command(): 'esp32c3' driver usage field missing
Debug: 207 92 command.c:155 script_debug(): command - riscv set_reset_timeout_sec 2
Debug: 208 93 command.c:155 script_debug(): command - riscv set_command_timeout_sec 5
Debug: 209 93 command.c:155 script_debug(): command - riscv set_mem_access sysbus progbuf abstract
Debug: 210 94 command.c:155 script_debug(): command - riscv set_ebreakm on
Debug: 211 94 command.c:155 script_debug(): command - riscv set_ebreaks on
Debug: 212 94 command.c:155 script_debug(): command - riscv set_ebreaku on
Info : 213 97 server.c:292 add_service(): Listening on port 50001 for tcl connections
Info : 214 97 server.c:292 add_service(): Listening on port 50002 for telnet connections
Debug: 215 98 command.c:155 script_debug(): command - init
Debug: 216 98 command.c:155 script_debug(): command - target init
Debug: 217 99 command.c:155 script_debug(): command - target names
Debug: 218 99 command.c:155 script_debug(): command - esp32c3 cget -event gdb-flash-erase-start
Debug: 219 99 command.c:155 script_debug(): command - esp32c3 configure -event gdb-flash-erase-start reset init
Debug: 220 99 command.c:155 script_debug(): command - esp32c3 cget -event gdb-flash-write-end
Debug: 221 100 command.c:155 script_debug(): command - esp32c3 configure -event gdb-flash-write-end reset halt
Debug: 222 101 command.c:155 script_debug(): command - esp32c3 cget -event gdb-attach
Debug: 223 101 target.c:1659 handle_target_init_command(): Initializing targets...
Debug: 224 102 riscv.c:444 riscv_init_target(): riscv_init_target()
Debug: 225 102 semihosting_common.c:107 semihosting_common_init():  
Info : 226 163 esp_usb_jtag.c:657 esp_usb_jtag_init(): esp_usb_jtag: serial (10:91:A8:02:BD:7C)
Debug: 227 167 libusb_helper.c:326 jtag_libusb_choose_interface(): usb ep out 02
Debug: 228 167 libusb_helper.c:326 jtag_libusb_choose_interface(): usb ep in 83
Debug: 229 177 libusb_helper.c:334 jtag_libusb_choose_interface(): Claiming interface 2
Info : 230 178 esp_usb_jtag.c:732 esp_usb_jtag_init(): esp_usb_jtag: Device found. Base speed 40000KHz, div range 1 to 255
Debug: 231 178 adapter.c:215 adapter_khz_to_speed(): convert khz to adapter specific speed value
Debug: 232 180 adapter.c:219 adapter_khz_to_speed(): have adapter set up
Debug: 233 180 esp_usb_jtag.c:791 esp_usb_jtag_khz(): Divisor for 40000 KHz with base clock of 40000 khz is 1
Debug: 234 180 esp_usb_jtag.c:807 esp_usb_jtag_speed(): esp_usb_jtag: setting divisor 1
Debug: 235 181 adapter.c:215 adapter_khz_to_speed(): convert khz to adapter specific speed value
Debug: 236 181 adapter.c:219 adapter_khz_to_speed(): have adapter set up
Debug: 237 181 esp_usb_jtag.c:791 esp_usb_jtag_khz(): Divisor for 40000 KHz with base clock of 40000 khz is 1
Info : 238 181 adapter.c:179 adapter_init(): clock speed 40000 kHz
Debug: 239 181 openocd.c:134 handle_init_command(): Debug Adapter init complete
Debug: 240 181 command.c:155 script_debug(): command - transport init
Debug: 241 181 transport.c:219 handle_transport_init(): handle_transport_init
Debug: 242 182 core.c:718 legacy_jtag_add_reset(): SRST line released
Debug: 243 182 core.c:742 legacy_jtag_add_reset(): TRST line released
Debug: 244 182 core.c:328 jtag_call_event_callbacks(): jtag event: TAP reset
Debug: 245 182 command.c:155 script_debug(): command - jtag arp_init
Debug: 246 183 core.c:1509 jtag_init_inner(): Init JTAG chain
Debug: 247 183 core.c:328 jtag_call_event_callbacks(): jtag event: TAP reset
Debug: 248 183 core.c:1234 jtag_examine_chain(): DR scan interrogation for IDCODE/BYPASS
Debug: 249 185 core.c:328 jtag_call_event_callbacks(): jtag event: TAP reset
Debug: 250 186 esp_usb_jtag.c:404 esp_usb_jtag_recv_buf(): esp_usb_jtag: usb received only 6 out of 64 bytes.
Error: 251 186 esp_usb_jtag.c:373 esp_usb_jtag_recv_buf(): esp_usb_jtag: IN buffer overflow! (0, size 48)
Error: 252 186 bitq.c:274 bitq_execute_queue(): missing data from bitq interface
Error: 253 187 core.c:1554 jtag_init_inner(): Trying to use configured scan chain anyway...
Debug: 254 187 core.c:1364 jtag_validate_ircapture(): IR capture validation scan
Error: 255 189 core.c:1416 jtag_validate_ircapture(): esp32c3.cpu: IR capture error; saw 0x1f not 0x01
Debug: 256 190 core.c:328 jtag_call_event_callbacks(): jtag event: TAP reset
Warn : 257 191 core.c:1577 jtag_init_inner(): Bypassing JTAG setup events due to errors
Debug: 258 191 command.c:155 script_debug(): command - dap init
Debug: 259 191 arm_dap.c:97 dap_init_all(): Initializing all DAPs ...
Debug: 260 191 openocd.c:151 handle_init_command(): Examining targets...
Debug: 261 191 target.c:1847 target_call_event_callbacks(): target event 19 (examine-start) for core esp32c3
Debug: 262 192 esp32c3.c:177 esp32c3_handle_target_event(): 19
Debug: 263 192 esp_riscv.c:356 esp_riscv_handle_target_event(): 19
Debug: 264 192 riscv.c:1120 riscv_examine(): riscv_examine()
Debug: 265 194 riscv.c:405 dtmcontrol_scan(): DTMCONTROL: 0x0 -> 0xffffffff
Debug: 266 196 riscv.c:1130 riscv_examine(): dtmcontrol=0xffffffff
Debug: 267 196 riscv.c:1132 riscv_examine():   version=0xf
Error: 268 196 riscv.c:424 get_target_type(): Unsupported DTM version: 15
Debug: 269 196 target.c:1847 target_call_event_callbacks(): target event 20 (examine-fail) for core esp32c3
Debug: 270 196 esp32c3.c:177 esp32c3_handle_target_event(): 20
Debug: 271 197 esp_riscv.c:356 esp_riscv_handle_target_event(): 20
Warn : 272 198 target.c:804 target_examine(): target esp32c3 examination failed
Debug: 273 198 openocd.c:153 handle_init_command(): target examination failed
Debug: 274 198 command.c:155 script_debug(): command - flash init
Debug: 275 198 tcl.c:1375 handle_flash_init_command(): Initializing flash devices...
Debug: 276 198 command.c:155 script_debug(): command - nand init
Debug: 277 198 tcl.c:487 handle_nand_init_command(): Initializing NAND devices...
Debug: 278 198 command.c:155 script_debug(): command - pld init
Debug: 279 200 pld.c:194 handle_pld_init_command(): Initializing PLDs...
Debug: 280 200 command.c:155 script_debug(): command - tpiu init
Info : 281 200 gdb_server.c:3799 gdb_target_start(): starting gdb server for esp32c3 on 50000
Info : 282 200 server.c:292 add_service(): Listening on port 50000 for gdb connections
Info : 283 2321 server.c:84 add_connection(): accepting 'gdb' connection on tcp/50000
Debug: 284 2322 breakpoints.c:363 breakpoint_clear_target_internal(): Delete all breakpoints for target: esp32c3
Debug: 285 2322 breakpoints.c:551 watchpoint_clear_target(): Delete all watchpoints for target: esp32c3
Debug: 286 2323 target.c:1847 target_call_event_callbacks(): target event 22 (gdb-attach) for core esp32c3
Debug: 287 2324 target.c:5139 target_handle_event(): target(0): esp32c3 (esp32c3) event: 22 (gdb-attach) action: 
    # '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: 288 2326 command.c:155 script_debug(): command - halt 1000
Debug: 289 2327 target.c:3351 handle_halt_command(): -
Error: 290 2327 target.c:592 target_halt(): Target not examined yet
Debug: 291 2327 command.c:545 run_command(): Command 'halt' failed with error code -4
User : 292 2328 target.c:5164 target_handle_event(): Error executing event gdb-attach on target esp32c3:

Debug: 293 2329 esp32c3.c:177 esp32c3_handle_target_event(): 22
Debug: 294 2329 esp_riscv.c:356 esp_riscv_handle_target_event(): 22
Debug: 295 2329 FreeRTOS.c:1369 freertos_clean(): freertos_clean
Debug: 296 2330 FreeRTOS.c:865 freertos_update_threads(): freertos_update_threads
Warn : 297 2330 FreeRTOS.c:873 freertos_update_threads(): No symbols for FreeRTOS!
Error: 298 2330 esp_flash.c:935 esp_algo_flash_probe(): Target not halted
Error: 299 2331 core.c:291 get_flash_bank_by_num(): auto_probe failed
Error: 300 2331 gdb_server.c:1062 gdb_new_connection(): Connect failed. Consider setting up a gdb-attach event for the target to prepare target for GDB connect, or use 'gdb_memory_map disable'.
Error: 301 2332 server.c:88 add_connection(): attempted 'gdb' connection rejected
[2023-03-23T23:48:02.166Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session closed

Other Steps to Reproduce

No response

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

matsujirushi commented 1 year ago

debug_custom.json is default.

{
    "name":"Arduino on ESP32-C3",
    "toolchainPrefix":"riscv32-esp-elf",
    "svdFile":"debug.svd",
    "request":"attach",
    "serverArgs":[
        "-d3"
    ],
    "overrideAttachCommands":[
        "set remote hardware-watchpoint-limit 8",
        "monitor reset",
        "monitor halt",
        "monitor gdb_sync",
        "thb setup"
    ],
    "overrideRestartCommands":[
        "monitor reset",
        "monitor halt",
        "monitor gdb_sync",
        "thb setup"
    ]
}