Skip to content
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

ESP32-C6 Debugging with USB-Serial-Jtag (OCD-893) #315

Closed
Vineetha1705 opened this issue Feb 5, 2024 · 36 comments
Closed

ESP32-C6 Debugging with USB-Serial-Jtag (OCD-893) #315

Vineetha1705 opened this issue Feb 5, 2024 · 36 comments

Comments

@Vineetha1705
Copy link

Vineetha1705 commented Feb 5, 2024

Development Kit

ESP32-C6-DevKitM

Module or chip used

ESP32-C6

Debug Adapter

Builtin USB-JTAG

OpenOCD version

v0.12.0-esp32-20230921

Operating System

Windows

Using an IDE ?

Espressif ide

OpenOCD command line

-s ${openocd_path}/share/openocd/scripts -f board/esp32c6-builtin.cfg

JTAG Clock Speed

Default

ESP-IDF version

v5.1.2

Problem Description

  1. Go to debug configuration.
  2. Choose the application file and click on debug.
    3.It is not entering into debug instead showing error like failed to get flash maps(6) in console.

Debug Logs

No response

Expected behavior

Esp32c6 should enter into debug mode without any errors.

Screenshots

Screenshot 2024-02-05 120619

@github-actions github-actions bot changed the title ESP32-C6 Debugging with USB-Serial-Jtag ESP32-C6 Debugging with USB-Serial-Jtag (OCD-893) Feb 5, 2024
@gerekon
Copy link
Collaborator

gerekon commented Feb 7, 2024

Hi

  1. Have you written app binary to flash?
  2. There is warning message with the possible solution following the error. If your app binary or partition table were written to flash at the non-default offsets you need to specify it using appimage_offset command. See https://github.com/espressif/openocd-esp32/wiki/Troubleshooting-FAQ#openocd-reports-a-flasher-stub-running-problem-because-of-the-application-binary-location

@Vineetha1705
Copy link
Author

Vineetha1705 commented Feb 8, 2024 via email

@Vineetha1705
Copy link
Author

Vineetha1705 commented Feb 19, 2024 via email

@erhankur
Copy link
Collaborator

@Vineetha1705 We couldn't see the picture. Can you attach it again?

Also, can you send OpenOCD logs? You will add -d3 -l log.txt to the end of the config options. https://github.com/espressif/idf-eclipse-plugin/blob/master/docs/OpenOCD%20Debugging.md#debugger-tab

And it would be good to see application start log screen and partition_table.csv.

@Vineetha1705
Copy link
Author

This is the output log before adding -d3 -1 log.txt to the end of the config options.


Open On-Chip Debugger v0.12.0-esp32-20230921 (2023-09-21-13:40)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : only one transport option; autoselecting 'jtag'
Info : esp_usb_jtag: VID set to 0x303a and PID to 0x1001
Info : esp_usb_jtag: capabilities descriptor set to 0x2000
Info : esp_usb_jtag: serial (40:4C:CA:46:C4:8C)
Info : esp_usb_jtag: Device found. Base speed 24000KHz, div range 1 to 255
Info : clock speed 24000 kHz
Error: esp_usb_jtag: IN buffer overflow! (0, size 48)
Error: missing data from bitq interface
Error: Trying to use configured scan chain anyway...
Error: esp32c6.cpu: IR capture error; saw 0x1f not 0x01
Warn : Bypassing JTAG setup events due to errors
Error: [esp32c6] Unsupported DTM version: 15
Warn : target esp32c6 examination failed
Info : starting gdb server for esp32c6 on 3333
Info : Listening on port 3333 for gdb connections
Error: Target not examined yet
C:\Users\Vineetha.espressif\tools\openocd-esp32\v0.12.0-esp32-20230921\openocd-esp32\share\openocd\scripts/target/esp_common.cfg:9: Error:
at file "C:\Users\Vineetha.espressif\tools\openocd-esp32\v0.12.0-esp32-20230921\openocd-esp32\share\openocd\scripts/target/esp_common.cfg", line 9
Error: [esp32c6] Unsupported DTM version: 15


This is the output after adding -d3 -1 log.txt to the end of the config options.


Open On-Chip Debugger v0.12.0-esp32-20230921 (2023-09-21-13:40)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
User : 3 2 options.c:52 configuration_output_handler(): debug_level: 3User : 4 2 options.c:52 configuration_output_handler():
Debug: 5 2 options.c:233 add_default_dirs(): bindir=/builds/idf/openocd-esp32/_build/../openocd-esp32/bin
Debug: 6 2 options.c:234 add_default_dirs(): pkgdatadir=/builds/idf/openocd-esp32/_build/../openocd-esp32/share/openocd
Debug: 7 2 options.c:235 add_default_dirs(): exepath=C:/Users/Vineetha/.espressif/tools/openocd-esp32/v0.12.0-esp32-20230921/openocd-esp32/bin
Debug: 8 3 options.c:236 add_default_dirs(): bin2data=../share/openocd
Debug: 9 3 configuration.c:33 add_script_search_dir(): adding C:\Users\Vineetha.espressif\tools\openocd-esp32\v0.12.0-esp32-20230921\openocd-esp32\share\openocd\scripts
Debug: 10 3 configuration.c:33 add_script_search_dir(): adding C:/Users/Vineetha/AppData/Roaming/OpenOCD
Debug: 11 3 configuration.c:33 add_script_search_dir(): adding C:/Users/Vineetha/.espressif/tools/openocd-esp32/v0.12.0-esp32-20230921/openocd-esp32/bin/../share/openocd/site
Debug: 12 3 configuration.c:33 add_script_search_dir(): adding C:/Users/Vineetha/.espressif/tools/openocd-esp32/v0.12.0-esp32-20230921/openocd-esp32/bin/../share/openocd/scripts
Debug: 13 3 command.c:151 script_debug(): command - gdb_port 3333
Debug: 14 3 command.c:151 script_debug(): command - telnet_port 4444
Debug: 15 3 command.c:151 script_debug(): command - tcl_port 6666
Debug: 16 4 command.c:151 script_debug(): command - ocd_find board/esp32c6-builtin.cfg
Debug: 17 4 configuration.c:88 find_file(): found C:\Users\Vineetha.espressif\tools\openocd-esp32\v0.12.0-esp32-20230921\openocd-esp32\share\openocd\scripts/board/esp32c6-builtin.cfg
Debug: 18 5 command.c:151 script_debug(): command - ocd_find interface/esp_usb_jtag.cfg
Debug: 19 5 configuration.c:88 find_file(): found C:\Users\Vineetha.espressif\tools\openocd-esp32\v0.12.0-esp32-20230921\openocd-esp32\share\openocd\scripts/interface/esp_usb_jtag.cfg
Debug: 20 5 command.c:151 script_debug(): command - adapter driver esp_usb_jtag
Info : 21 5 transport.c:106 allow_transports(): only one transport option; autoselecting 'jtag'
Debug: 22 5 command.c:151 script_debug(): command - espusbjtag vid_pid 0x303a 0x1001
Info : 23 5 esp_usb_jtag.c:901 esp_usb_jtag_vid_pid(): esp_usb_jtag: VID set to 0x303a and PID to 0x1001
Debug: 24 5 command.c:151 script_debug(): command - espusbjtag caps_descriptor 0x2000
Info : 25 5 esp_usb_jtag.c:912 esp_usb_jtag_caps_descriptor(): esp_usb_jtag: capabilities descriptor set to 0x2000
Debug: 26 6 command.c:151 script_debug(): command - adapter speed 40000
Debug: 27 6 adapter.c:249 adapter_config_khz(): handle adapter khz
Debug: 28 6 adapter.c:213 adapter_khz_to_speed(): convert khz to adapter specific speed value
Debug: 29 6 adapter.c:213 adapter_khz_to_speed(): convert khz to adapter specific speed value
Debug: 30 6 command.c:151 script_debug(): command - ocd_find target/esp32c6.cfg
Debug: 31 6 configuration.c:88 find_file(): found C:\Users\Vineetha.espressif\tools\openocd-esp32\v0.12.0-esp32-20230921\openocd-esp32\share\openocd\scripts/target/esp32c6.cfg
Debug: 32 6 command.c:151 script_debug(): command - ocd_find target/esp_common.cfg
Debug: 33 6 configuration.c:88 find_file(): found C:\Users\Vineetha.espressif\tools\openocd-esp32\v0.12.0-esp32-20230921\openocd-esp32\share\openocd\scripts/target/esp_common.cfg
Debug: 34 7 command.c:151 script_debug(): command - ocd_find bitsbytes.tcl
Debug: 35 7 configuration.c:88 find_file(): found C:\Users\Vineetha.espressif\tools\openocd-esp32\v0.12.0-esp32-20230921\openocd-esp32\share\openocd\scripts/bitsbytes.tcl
Debug: 36 7 command.c:151 script_debug(): command - ocd_find memory.tcl
Debug: 37 7 configuration.c:88 find_file(): found C:\Users\Vineetha.espressif\tools\openocd-esp32\v0.12.0-esp32-20230921\openocd-esp32\share\openocd\scripts/memory.tcl
Debug: 38 8 command.c:151 script_debug(): command - ocd_find mmr_helpers.tcl
Debug: 39 8 configuration.c:88 find_file(): found C:\Users\Vineetha.espressif\tools\openocd-esp32\v0.12.0-esp32-20230921\openocd-esp32\share\openocd\scripts/mmr_helpers.tcl
Debug: 40 8 command.c:151 script_debug(): command - ocd_find target/esp_version.cfg
Debug: 41 8 configuration.c:88 find_file(): found C:\Users\Vineetha.espressif\tools\openocd-esp32\v0.12.0-esp32-20230921\openocd-esp32\share\openocd\scripts/target/esp_version.cfg
Debug: 42 8 command.c:151 script_debug(): command - version
Debug: 43 8 command.c:151 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 and encrypt are optional
Debug: 44 9 command.c:151 script_debug(): command - add_usage_text program_esp [address] [verify] [reset] [exit] [compress] [no_clock_boost] [restore_clock] [encrypt]
Debug: 45 9 command.c:151 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: 46 9 command.c:151 script_debug(): command - add_usage_text program_esp_bins <build_dir> flasher_args.json [verify] [reset] [exit] [compress] [no_clock_boost] [restore_clock]
Debug: 47 9 command.c:151 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: 48 9 command.c:151 script_debug(): command - add_usage_text esp_get_mac [format]
Debug: 49 9 command.c:151 script_debug(): command - jtag newtap esp32c6 cpu -irlen 5 -expected-id 0x0000dc25
Debug: 50 9 tcl.c:419 handle_jtag_newtap_args(): Creating New Tap, Chip: esp32c6, Tap: cpu, Dotted: esp32c6.cpu, 4 params
Debug: 51 9 core.c:1476 jtag_tap_init(): Created Tap: esp32c6.cpu @ abs position 0, irlen 5, capture: 0x1 mask: 0x3
Debug: 52 10 command.c:151 script_debug(): command - target create esp32c6 esp32c6 -chain-position esp32c6.cpu -coreid 0 -rtos FreeRTOS
Debug: 53 10 target.c:2166 target_free_all_working_areas_restore(): freeing all working areas
Debug: 54 10 FreeRTOS.c:1414 freertos_create(): freertos_create
Debug: 55 10 command.c:285 register_command(): command 'esp' is already registered
Debug: 56 10 command.c:285 register_command(): command 'esp32c6 esp' is already registered
Debug: 57 10 command.c:151 script_debug(): command - esp32c6 configure -work-area-phys 0x40800000 -work-area-virt 0x40800000 -work-area-size 0x24000 -work-area-backup 1
Debug: 58 10 target.c:2166 target_free_all_working_areas_restore(): freeing all working areas
Debug: 59 10 target.c:2166 target_free_all_working_areas_restore(): freeing all working areas
Debug: 60 11 target.c:2166 target_free_all_working_areas_restore(): freeing all working areas
Debug: 61 11 target.c:2166 target_free_all_working_areas_restore(): freeing all working areas
Debug: 62 11 command.c:151 script_debug(): command - flash bank esp32c6.flash esp32c6 0x0 0 0 0 esp32c6
Debug: 63 11 command.c:285 register_command(): command 'esp' is already registered
Debug: 64 11 tcl.c:1307 handle_flash_bank_command(): 'esp32c6' driver usage field missing
Debug: 65 11 command.c:151 script_debug(): command - flash bank esp32c6.irom esp32c6 0x0 0 0 0 esp32c6
Debug: 66 11 command.c:285 register_command(): command 'esp' is already registered
Debug: 67 11 command.c:285 register_command(): command 'esp appimage_offset' is already registered
Debug: 68 11 command.c:285 register_command(): command 'esp compression' is already registered
Debug: 69 11 command.c:285 register_command(): command 'esp verify_bank_hash' is already registered
Debug: 70 11 command.c:285 register_command(): command 'esp flash_stub_clock_boost' is already registered
Debug: 71 11 command.c:285 register_command(): command 'esp encrypt_binary' is already registered
Debug: 72 12 command.c:285 register_command(): command 'esp stub_log' is already registered
Debug: 73 12 tcl.c:1307 handle_flash_bank_command(): 'esp32c6' driver usage field missing
Debug: 74 12 command.c:151 scrip
t_debug(): command - flash bank esp32c6.drom esp32c6 0x0 0 0 0 esp32c6
Debug: 75 12 command.c:285 register_command(): command 'esp' is already registered
Debug: 76 12 command.c:285 register_command(): command 'esp appimage_offset' is already registered
Debug: 77 12 command.c:285 register_command(): command 'esp compression' is already registered
Debug: 78 12 command.c:285 register_command(): command 'esp verify_bank_hash' is already registered
Debug: 79 12 command.c:285 register_command(): command 'esp flash_stub_clock_boost' is already registered
Debug: 80 12 command.c:285 register_command(): command 'esp encrypt_binary' is already registered
Debug: 81 12 command.c:285 register_command(): command 'esp stub_log' is already registered
Debug: 82 12 tcl.c:1307 handle_flash_bank_command(): 'esp32c6' driver usage field missing
Debug: 83 12 command.c:151 script_debug(): command - esp32c6 configure -event halted
global _ESP_WDT_DISABLE
$_ESP_WDT_DISABLE
esp halted_event_handler

Debug: 84 13 command.c:151 script_debug(): command - esp32c6 configure -event examine-end
# Need to enable to set 'semihosting_basedir'
arm semihosting enable
arm semihosting_resexit enable
if { [info exists _SEMIHOST_BASEDIR] } {
if { $_SEMIHOST_BASEDIR != "" } {
arm semihosting_basedir $_SEMIHOST_BASEDIR
}
}

Debug: 85 13 command.c:151 script_debug(): command - esp32c6 configure -event reset-assert-post
global _ESP_SOC_RESET
$_ESP_SOC_RESET

Debug: 86 13 command.c:151 script_debug(): command - esp32c6 configure -event gdb-attach
if { $_ESP_SMP_BREAK != 0 } {
$_TARGETNAME_0 xtensa smpbreak BreakIn BreakOut
}
# necessary to auto-probe flash bank when GDB is connected and generate proper memory map
halt 1000
if { [$_ESP_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
}

	if { $_ESP_ARCH == "riscv" } {
		# by default mask interrupts while stepping
		riscv set_maskisr steponly
	}

Debug: 87 14 command.c:151 script_debug(): command - esp32c6 configure -event gdb-detach
$_TARGETNAME_0 esp gdb_detach_handler

Debug: 88 14 command.c:151 script_debug(): command - riscv set_reset_timeout_sec 2
Debug: 89 14 command.c:151 script_debug(): command - riscv set_command_timeout_sec 5
Debug: 90 14 command.c:151 script_debug(): command - riscv set_mem_access sysbus progbuf abstract
Debug: 91 14 command.c:151 script_debug(): command - riscv set_ebreakm on
Debug: 92 14 command.c:151 script_debug(): command - riscv set_ebreaks on
Debug: 93 14 command.c:151 script_debug(): command - riscv set_ebreaku on
Debug: 94 14 command.c:151 script_debug(): command - esp32c6 riscv expose_csrs 2016=mpcer
Debug: 95 14 command.c:151 script_debug(): command - esp32c6 riscv expose_csrs 2017=mpcmr
Debug: 96 14 command.c:151 script_debug(): command - esp32c6 riscv expose_csrs 2018=mpccr
Debug: 97 14 command.c:151 script_debug(): command - esp32c6 riscv expose_csrs 2051=cpu_gpio_oen
Debug: 98 14 command.c:151 script_debug(): command - esp32c6 riscv expose_csrs 2052=cpu_gpio_in
Debug: 99 15 command.c:151 script_debug(): command - esp32c6 riscv expose_csrs 2053=cpu_gpio_out
Debug: 100 15 command.c:151 script_debug(): command - esp32c6 riscv expose_csrs 3008=pma_cfg0
Debug: 101 15 command.c:151 script_debug(): command - esp32c6 riscv expose_csrs 3009=pma_cfg1
Debug: 102 15 command.c:151 script_debug(): command - esp32c6 riscv expose_csrs 3010=pma_cfg2
Debug: 103 15 command.c:151 script_debug(): command - esp32c6 riscv expose_csrs 3011=pma_cfg3
Debug: 104 15 command.c:151 script_debug(): command - esp32c6 riscv expose_csrs 3012=pma_cfg4
Debug: 105 15 command.c:151 script_debug(): command - esp32c6 riscv expose_csrs 3013=pma_cfg5
Debug: 106 15 command.c:151 script_debug(): command - esp32c6 riscv expose_csrs 3014=pma_cfg6
Debug: 107 15 command.c:151 script_debug(): command - esp32c6 riscv expose_csrs 3015=pma_cfg7
Debug: 108 15 command.c:151 script_debug(): command - esp32c6 riscv expose_csrs 3016=pma_cfg8
Debug: 109 15 command.c:151 script_debug(): command - esp32c6 riscv expose_csrs 3017=pma_cfg9
Debug: 110 15 command.c:151 script_debug(): command - esp32c6 riscv expose_csrs 3018=pma_cfg10
Debug: 111 15 command.c:151 script_debug(): command - esp32c6 riscv expose_csrs 3019=pma_cfg11
Debug: 112 16 command.c:151 script_debug(): command - esp32c6 riscv expose_csrs 3020=pma_cfg12
Debug: 113 16 command.c:151 script_debug(): command - esp32c6 riscv expose_csrs 3021=pma_cfg13
Debug: 114 16 command.c:151 script_debug(): command - esp32c6 riscv expose_csrs 3022=pma_cfg14
Debug: 115 16 command.c:151 script_debug(): command - esp32c6 riscv expose_csrs 3023=pma_cfg15
Debug: 116 16 command.c:151 script_debug(): command - esp32c6 riscv expose_csrs 3024=pma_addr0
Debug: 117 16 command.c:151 script_debug(): command - esp32c6 riscv expose_csrs 3025=pma_addr1
Debug: 118 16 command.c:151 script_debug(): command - esp32c6 riscv expose_csrs 3026=pma_addr2
Debug: 119 16 command.c:151 script_debug(): command - esp32c6 riscv expose_csrs 3027=pma_addr3
Debug: 120 16 command.c:151 script_debug(): command - esp32c6 riscv expose_csrs 3028=pma_addr4
Debug: 121 16 command.c:151 script_debug(): command - esp32c6 riscv expose_csrs 3029=pma_addr5
Debug: 122 16 command.c:151 script_debug(): command - esp32c6 riscv expose_csrs 3030=pma_addr6
Debug: 123 16 command.c:151 script_debug(): command - esp32c6 riscv expose_csrs 3031=pma_addr7
Debug: 124 16 command.c:151 script_debug(): command - esp32c6 riscv expose_csrs 3032=pma_addr8
Debug: 125 17 command.c:151 script_debug(): command - esp32c6 riscv expose_csrs 3033=pma_addr9
Debug: 126 17 command.c:151 script_debug(): command - esp32c6 riscv expose_csrs 3034=pma_addr10
Debug: 127 17 command.c:151 script_debug(): command - esp32c6 riscv expose_csrs 3035=pma_addr11
Debug: 128 17 command.c:151 script_debug(): command - esp32c6 riscv expose_csrs 3036=pma_addr12
Debug: 129 17 command.c:151 script_debug(): command - esp32c6 riscv expose_csrs 3037=pma_addr13
Debug: 130 17 command.c:151 script_debug(): command - esp32c6 riscv expose_csrs 3038=pma_addr14
Debug: 131 17 command.c:151 script_debug(): command - esp32c6 riscv expose_csrs 3039=pma_addr15
Debug: 132 17 command.c:151 script_debug(): command - init
Debug: 133 17 command.c:151 script_debug(): command - target init
Debug: 134 17 command.c:151 script_debug(): command - target names
Debug: 135 17 command.c:151 script_debug(): command - esp32c6 cget -event gdb-flash-erase-start
Debug: 136 17 command.c:151 script_debug(): command - esp32c6 configure -event gdb-flash-erase-start reset init
Debug: 137 17 command.c:151 script_debug(): command - esp32c6 cget -event gdb-flash-write-end
Debug: 138 18 command.c:151 script_debug(): command - esp32c6 configure -event gdb-flash-write-end reset halt
Debug: 139 18 command.c:151 script_debug(): command - esp32c6 cget -event gdb-attach
Debug: 140 18 target.c:1624 handle_target_init_command(): Initializing targets...
Debug: 141 18 riscv.c:413 riscv_init_target(): [esp32c6] riscv_init_target()
Debug: 142 18 semihosting_common.c:105 semihosting_common_init():
Info : 143 27 esp_usb_jtag.c:661 esp_usb_jtag_init(): esp_usb_jtag: serial (40:4C:CA:46:C4:8C)
Debug: 144 27 libusb_helper.c:331 jtag_libusb_choose_interface(): usb ep out 02
Debug: 145 27 libusb_helper.c:331 jtag_libusb_choose_interface(): usb ep in 83
Debug: 146 28 libusb_helper.c:339 jtag_libusb_choose_interface(): Claiming interface 2
Info : 147 28 esp_usb_jtag.c:738 esp_usb_jtag_init(): esp_usb_jtag: Device found. Base speed 24000KHz, div range 1 to 255
Debug: 148 28 adapter.c:213 adapter_khz_to_speed(): convert khz to adapter specific speed value
Debug: 149 28 adapter.c:217 adapter_khz_to_speed(): have adapter set up
Debug: 150 28 esp_usb_jtag.c:798 esp_usb_jtag_khz(): Divisor for 40000 KHz with base clock of 24000 khz is 0
Debug: 151 28 esp_usb_jtag.c:814 esp_usb_jtag_speed(): esp_usb_jtag: setting divisor 1
Debug: 152 28 adapter.c:213 adapter_k
hz_to_speed(): convert khz to adapter specific speed value
Debug: 153 28 adapter.c:217 adapter_khz_to_speed(): have adapter set up
Debug: 154 28 esp_usb_jtag.c:798 esp_usb_jtag_khz(): Divisor for 40000 KHz with base clock of 24000 khz is 0
Info : 155 29 adapter.c:177 adapter_init(): clock speed 24000 kHz
Debug: 156 29 openocd.c:133 handle_init_command(): Debug Adapter init complete
Debug: 157 29 command.c:151 script_debug(): command - transport init
Debug: 158 29 transport.c:218 handle_transport_init(): handle_transport_init
Error: 159 6035 libusb_helper.c:247 jtag_libusb_bulk_write(): libusb_bulk_write error: LIBUSB_ERROR_TIMEOUT
Debug: 160 6035 esp_usb_jtag.c:447 esp_usb_jtag_send_buf(): esp_usb_jtag: usb sent only 0 out of 1 bytes.
Debug: 161 6040 libusb_helper.c:408 jtag_libusb_find_device(): USB dev found 303a:1001 @ 1:3-23
Debug: 162 6041 core.c:716 legacy_jtag_add_reset(): SRST line released
Debug: 163 6041 core.c:740 legacy_jtag_add_reset(): TRST line released
Debug: 164 6041 core.c:326 jtag_call_event_callbacks(): jtag event: TAP reset
Error: 165 12048 libusb_helper.c:247 jtag_libusb_bulk_write(): libusb_bulk_write error: LIBUSB_ERROR_TIMEOUT
Debug: 166 12048 esp_usb_jtag.c:447 esp_usb_jtag_send_buf(): esp_usb_jtag: usb sent only 0 out of 2 bytes.
Debug: 167 12053 libusb_helper.c:408 jtag_libusb_find_device(): USB dev found 303a:1001 @ 1:3-23
Debug: 168 12055 command.c:151 script_debug(): command - jtag arp_init
Debug: 169 12055 log.c:449 gdb_timeout_warning(): keep_alive() was not invoked in the 1000 ms timelimit (12055 ms). This may cause trouble with GDB connections.
Debug: 170 12055 core.c:1507 jtag_init_inner(): Init JTAG chain
Debug: 171 12055 core.c:326 jtag_call_event_callbacks(): jtag event: TAP reset
Error: 172 18072 libusb_helper.c:247 jtag_libusb_bulk_write(): libusb_bulk_write error: LIBUSB_ERROR_TIMEOUT
Debug: 173 18072 esp_usb_jtag.c:447 esp_usb_jtag_send_buf(): esp_usb_jtag: usb sent only 0 out of 4 bytes.
Debug: 174 18081 libusb_helper.c:408 jtag_libusb_find_device(): USB dev found 303a:1001 @ 1:3-23
Debug: 175 18083 core.c:1232 jtag_examine_chain(): DR scan interrogation for IDCODE/BYPASS
Debug: 176 18083 core.c:326 jtag_call_event_callbacks(): jtag event: TAP reset
Error: 177 24088 libusb_helper.c:247 jtag_libusb_bulk_write(): libusb_bulk_write error: LIBUSB_ERROR_TIMEOUT
Debug: 178 24088 esp_usb_jtag.c:447 esp_usb_jtag_send_buf(): esp_usb_jtag: usb sent only 0 out of 13 bytes.
Debug: 179 24097 libusb_helper.c:408 jtag_libusb_find_device(): USB dev found 303a:1001 @ 1:3-23
Error: 180 24099 bitq.c:274 bitq_execute_queue(): missing data from bitq interface
Error: 181 24099 core.c:1552 jtag_init_inner(): Trying to use configured scan chain anyway...
Debug: 182 24099 core.c:1362 jtag_validate_ircapture(): IR capture validation scan
Error: 183 30114 libusb_helper.c:247 jtag_libusb_bulk_write(): libusb_bulk_write error: LIBUSB_ERROR_TIMEOUT
Debug: 184 30114 esp_usb_jtag.c:447 esp_usb_jtag_send_buf(): esp_usb_jtag: usb sent only 0 out of 21 bytes.
Debug: 185 30124 libusb_helper.c:408 jtag_libusb_find_device(): USB dev found 303a:1001 @ 1:3-23
Error: 186 30125 bitq.c:274 bitq_execute_queue(): missing data from bitq interface
Debug: 187 30125 core.c:326 jtag_call_event_callbacks(): jtag event: TAP reset
Error: 188 36131 libusb_helper.c:247 jtag_libusb_bulk_write(): libusb_bulk_write error: LIBUSB_ERROR_TIMEOUT
Debug: 189 36131 esp_usb_jtag.c:447 esp_usb_jtag_send_buf(): esp_usb_jtag: usb sent only 0 out of 23 bytes.
Debug: 190 36140 libusb_helper.c:408 jtag_libusb_find_device(): USB dev found 303a:1001 @ 1:3-23
Warn : 191 36142 core.c:1575 jtag_init_inner(): Bypassing JTAG setup events due to errors
Debug: 192 36142 command.c:151 script_debug(): command - dap init
Debug: 193 36142 log.c:449 gdb_timeout_warning(): keep_alive() was not invoked in the 1000 ms timelimit (24087 ms). This may cause trouble with GDB connections.
Debug: 194 36142 arm_dap.c:94 dap_init_all(): Initializing all DAPs ...
Debug: 195 36142 openocd.c:150 handle_init_command(): Examining targets...
Debug: 196 36142 target.c:1812 target_call_event_callbacks(): target event 19 (examine-start) for core esp32c6
Debug: 197 36142 riscv.c:1507 riscv_examine(): [esp32c6] Starting examination
Error: 198 42145 libusb_helper.c:247 jtag_libusb_bulk_write(): libusb_bulk_write error: LIBUSB_ERROR_TIMEOUT
Debug: 199 42145 esp_usb_jtag.c:447 esp_usb_jtag_send_buf(): esp_usb_jtag: usb sent only 0 out of 42 bytes.
Debug: 200 42154 libusb_helper.c:408 jtag_libusb_find_device(): USB dev found 303a:1001 @ 1:3-23
Error: 201 42155 bitq.c:274 bitq_execute_queue(): missing data from bitq interface
Error: 202 42156 riscv.c:368 dtmcontrol_scan(): failed jtag scan: -104
Debug: 203 42156 riscv.c:1517 riscv_examine(): [esp32c6] dtmcontrol=0xffffff98
Debug: 204 42156 riscv.c:1519 riscv_examine(): [esp32c6] version=0x8
Error: 205 42156 riscv.c:393 get_target_type(): [esp32c6] Unsupported DTM version: 8
Debug: 206 42156 target.c:1812 target_call_event_callbacks(): target event 20 (examine-fail) for core esp32c6
Warn : 207 42156 target.c:769 target_examine(): target esp32c6 examination failed
Debug: 208 42156 openocd.c:152 handle_init_command(): target examination failed
Debug: 209 42156 command.c:151 script_debug(): command - flash init
Debug: 210 42156 log.c:449 gdb_timeout_warning(): keep_alive() was not invoked in the 1000 ms timelimit (6014 ms). This may cause trouble with GDB connections.
Debug: 211 42157 tcl.c:1364 handle_flash_init_command(): Initializing flash devices...
Debug: 212 42157 command.c:151 script_debug(): command - nand init
Debug: 213 42157 tcl.c:484 handle_nand_init_command(): Initializing NAND devices...
Debug: 214 42157 command.c:151 script_debug(): command - pld init
Debug: 215 42157 pld.c:250 handle_pld_init_command(): Initializing PLDs...
Debug: 216 42157 command.c:151 script_debug(): command - tpiu init
Info : 217 42157 gdb_server.c:3784 gdb_target_start(): starting gdb server for esp32c6 on 3333
Info : 218 42158 server.c:298 add_service(): Listening on port 3333 for gdb connections
Debug: 219 42158 command.c:151 script_debug(): command - halt
Debug: 220 42158 target.c:3273 handle_halt_command(): -
Error: 221 42158 target.c:557 target_halt(): Target not examined yet
Debug: 222 42158 command.c:541 run_command(): Command 'halt' failed with error code -4
User : 223 42159 command.c:612 command_run_line(): C:\Users\Vineetha.espressif\tools\openocd-esp32\v0.12.0-esp32-20230921\openocd-esp32\share\openocd\scripts/target/esp_common.cfg:9: Error:
at file "C:\Users\Vineetha.espressif\tools\openocd-esp32\v0.12.0-esp32-20230921\openocd-esp32\share\openocd\scripts/target/esp_common.cfg", line 9
Debug: 224 42159 riscv.c:463 riscv_deinit_target(): [esp32c6] riscv_deinit_target()
Error: 225 42159 riscv.c:393 get_target_type(): [esp32c6] Unsupported DTM version: 8
Debug: 226 42159 target.c:2166 target_free_all_working_areas_restore(): freeing all working areas


And most of the times I am getting error like "openocd timed out failed".

Thanks & Regards,
D. Vineetha.

@erhankur
Copy link
Collaborator

erhankur commented Feb 20, 2024

In summary, now you have 2 kinds of issues.
1 - Failed to get flash maps error.
2 - After changing the app_image offset you started to get openocd timed out failed

Looks strange. They are not related to me.

Error: esp32c6.CPU: IR capture error; saw 0x1f not 0x01 usually points to the jtag pins connection or cable problem. Might be also a driver issue. This is windows and drivers can be mixed up.
Failed to get flash maps error. can be seen after a successful connection when OpenOCD can not read app image details from the specified address.

Can you try the hello-world example without setting appimage_offset just to be sure your setup is OK?

@Vineetha1705
Copy link
Author

Vineetha1705 commented Feb 20, 2024

Thanks for the quick response,

How can I know if it is a driver issue?
When I tried using this simple code

#include <stdio.h>

void app_main(void)
{
printf("heloo");
}
I am getting errors like which are mentioned below


Info : accepting 'gdb' connection on tcp/3333
Warn : No symbols for FreeRTOS!
Warn : Prefer GDB command "target extended-remote :3333" instead of "target remote :3333"
Info : JTAG tap: esp32c6.c
pu tap/device found: 0x0000dc25 (mfg: 0x612 (Espressif Systems), part: 0x000d, ver: 0x0)
Info : [esp32c6] Reset cause (24) - (JTAG CPU reset)
Info : JTAG tap: esp32c6.cpu tap/device found: 0x0000dc25 (mfg: 0x612 (Espressif Systems), part: 0x000d, ver: 0x0)
Info : [esp32c6] Reset cause (24) - (JTAG CPU reset)
Info : Detected FreeRTOS version: (10.4.3)
Info : JTAG tap: esp32c6.cpu tap/device found: 0x0000dc25 (mfg: 0x612 (Espressif Systems), part: 0x000d, ver: 0x0)
Info : [esp32c6] Reset cause (24) - (JTAG CPU reset)
Info : Detected FreeRTOS version: (10.4.3)

Thread
1 "IDLE" received signal SIGINT, Interrupt.
Warn : [esp32c6] Could not set a trigger that will match a whole address range. As a fallback, this trigger (and maybe others) will only match against the first address of the range.
Error: [esp32c6] not halted (gdb fileio)
Warn : Target [esp32c6] not HALTED!
1 "IDLE" received signal SIGINT, Interrupt.
Info : Halt timed out, wake up GDB.
Error: [esp32c6] not halted (add breakpoint)
Error: can't add breakpoint: target running
Warning:
Cannot insert breakpoint 1.

Error: [esp32c6] not halted (add breakpoint)
Error: can't add breakpoint: target running
Warning:
Cannot insert breakpoint 1.
Cannot access memory at address 0x420065c6
Error: [esp32c6] not halted (add breakpoint)
Error: can't add breakpoint: target running


After changing the cable also getting same errors as below.


License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show configuration" for configuration details.
https://www.gnu.org/software/gdb/bugs/.
Info : accepting 'gdb' connection on tcp/3333
Warn : No symbols for FreeRTOS!
Error: Algorithm timed out after 40001 ms.
Info : [esp32c6] Halt cause (5) - (PMP Load access fault)
Error: ra = 0x40800d3c
Error: sp = 0x408046b0
Error: gp = 0x40809d70
Error: tp = 0x40807764
Error: t0 = 0x40027bd4
Error: t1 = 0xffffffe0
Error: t2 = 0x0
Error: s0 = 0x1
Error: s1 = 0xf8
Error: a0 = 0x40804710
Error: a1 = 0x42f88000
Error: a2 = 0x20
Error: a3 = 0x40804730
Error: a4 = 0x40804730
Error: a5 = 0x1
Error: a6 = 0x20
Error: a7 = 0x80000000
Error: s2 = 0x8000
Error: s3 = 0x20
Error: s4 = 0x42f90000
Error: s5 = 0x42f88000
Error: s6 = 0x0
Error: s7 = 0x60002000
Error: s8 = 0x10000
Error: s9 = 0x42f80000
Error: s10 = 0x40804144
Error: s11 = 0x1
Error: t3 = 0x0
Error: t4 = 0x0
Error: t5 = 0x0
Error: t6 = 0x0
Error: pc = 0x40800000
Error: mstatus = 0x1800
Error: mepc = 0x40800008
Error: mcause = 0x5
Error: Failed to wait algorithm (-302)!
Error: Algorithm run failed (-302)!
Error: Failed to run flasher stub (-302)!
Warn : Failed to get flash mappings (-302)!
Error: Target is already running an algorithm
Error: Failed to start algorithm (-4)!
Error: Failed to run flasher stub (-4)!
Info : Using flash bank 'esp32c6.irom' size 0 KB
Error: Target is already running an algorithm
Error: Failed to start algorithm
(-4)!
Error: Failed to run flasher stub (-4)!
Warn : Failed to get flash mappings (-4)!
Error: Target is already running an algorithm
Error: Failed to start algorithm (-4)!
Error: Failed to run flasher stub (-4)!
Info : Using flash bank 'esp32c6.drom' size 0 KB
Warn : negative reply, retrying
Warn : negative reply, retrying
Warn : Prefer GDB command "target extended-remote :3333" instead of "target remote :3333"
Info : JTAG tap: esp32c6.cpu tap/device found: 0x0000dc25 (mfg: 0x612 (Espressif Systems), part: 0x000d, ver: 0x0)
Info : [esp32c6] Reset cause (24) - (JTAG CPU reset)
Info : JTAG tap: esp32c6.cpu tap/device found: 0x0000dc25 (mfg: 0x6
12 (Espressif Systems), part: 0x000d, ver: 0x0)
Info : [esp32c6] Reset cause (24)

  • (JTAG CPU reset)
    Info : Detected FreeRTOS version: (10.4.3)
    [New Thread 1082184032]
    Info : JTAG tap: esp32c6.cpu tap/device found: 0x0000dc25 (mfg: 0x612 (Espressif Systems), part: 0x000d, ver: 0x0)
    Info : [esp32c6] Reset cause (24) - (JTAG CPU reset)

@erhankur
Copy link
Collaborator

@Vineetha1705 Can you set your flash size to 4MB and try again? From SDK configuration - Serial flasher config → Flash size

@Vineetha1705
Copy link
Author

Vineetha1705 commented Feb 21, 2024

Yes, Now esp32c6 is entering into the debug mode but sometimes it is not entering into the debug mode showing some errors which are mentioned below.


License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show configuration" for configuration details.
https://www.gnu.org/software/gdb/bugs/.
shutdown command invoked


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

Thanks & Regards,
D. Vineetha.

@erhankur
Copy link
Collaborator

I can reproduce the issue now. Will come up with a solution soon.

@erhankur
Copy link
Collaborator

I have added additional rom symbol file to the Debugger/Commands like below. You need to change esp-rom-elfs path according to your setup. Also, increasing remotetimeout can be helpful.

set mem inaccessible-by-default off
set remotetimeout 100
add-symbol-file C:\\Espressif\\tools\\esp-rom-elfs\\20230320\\esp32c6_rev0_rom.elf

Can you try and let us know the result?

cc @alirana01

@Vineetha1705
Copy link
Author

If I add this command "add-symbol-file C:\Espressif\tools\esp-rom-elfs\20230320\esp32c6_rev0_rom.elf" getting errors otherwise working fine. And why we need to set flash size 4MB ?

@erhankur
Copy link
Collaborator

And why we need to set flash size 4MB ?

OpenOCD stub flasher access to the flash through cache. It is related to cache configuration. Some settings like mmu_page_size change according to the flash size. Stub flasher configures the cache for the 4MB or bigger flash. It is not adaptive to the smaller flash yet. In my todo list.

So as I understand we can close this issue. Right?

@Vineetha1705
Copy link
Author

Vineetha1705 commented Feb 23, 2024 via email

@NirajSiroya
Copy link

Hello ,
@Vineetha1705 @erhankur can you please look on my issue too.

I'm using esp-idf plugin with Eclipse Ide & ESP32-C6 vboard.

After updating master version to 5.3 debugging is going to failed.
while using debug mode using ESP_IDF GDB OpenOCD Debugging i'm getting some issues that is listed below,

Info : accepting 'gdb' connection on tcp/3333
Error: no watchpoint at address 0x40825740 found
Error: timed out while waiting for target halted
Error executing event gdb-attach on target esp32c6:
C:\Users\user-id.espressif\tools\openocd-esp32\v0.12.0-esp32-20230921\openocd-esp32\share\openocd\scripts/target/esp_common.cfg:9: Error:
at file "C:\Users\user-id.espressif\tools\openocd-esp32\v0.12.0-esp32-20230921\openocd-esp32\share\openocd\scripts/target/esp_common.cfg", line 9
Error: Target not halted
Error: auto_probe failed
Error: 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: attempted 'gdb' connection rejected
shutdown command invoked

And same thing it was working with previous version 5.2.

And i tried the same thing after incresing that launch timeout.
you can find that snapshot below.

image

@Vineetha1705
Copy link
Author

Vineetha1705 commented Mar 14, 2024 via email

@NirajSiroya
Copy link

Thanks for the information .
As im using same only as 4MB.

this issue arrising after updating of version to 5.3

@Vineetha1705
Copy link
Author

Vineetha1705 commented Mar 14, 2024 via email

@NirajSiroya
Copy link

NirajSiroya commented Mar 14, 2024

please find my debugger config below.

image

@Vineetha1705
Copy link
Author

Vineetha1705 commented Mar 14, 2024 via email

@NirajSiroya
Copy link

No , im having 5.2 version in another system there it is working without path .

@Vineetha1705
Copy link
Author

Vineetha1705 commented Mar 14, 2024 via email

@NirajSiroya
Copy link

I tried with Executable path.
after that im getting another error.
Error in services launch sequence

Launching command [F:\esp_work\dout_interrupt\build\Firmware.elf -c gdb_port 3333 -c telnet_port 4444 -c tcl_port 6666 -s C:\Users\niraj.siroya.espressif\tools\openocd-esp32\v0.12.0-esp32-20230921\openocd-esp32\bin/share/openocd/scripts -c set ESP32_FLASH_VOLTAGE 1.8 -f board/esp32c6-bridge.cfg -c program_esp_bins F:/esp_work/dout_interrupt/build flasher_args.json verify reset -c echo "Started by GNU MCU Eclipse"] failed.
Launching command [F:\esp_work\dout_interrupt\build\Firmware.elf -c gdb_port 3333 -c telnet_port 4444 -c tcl_port 6666 -s C:\Users\niraj.siroya.espressif\tools\openocd-esp32\v0.12.0-esp32-20230921\openocd-esp32\bin/share/openocd/scripts -c set ESP32_FLASH_VOLTAGE 1.8 -f board/esp32c6-bridge.cfg -c program_esp_bins F:/esp_work/dout_interrupt/build flasher_args.json verify reset -c echo "Started by GNU MCU Eclipse"] failed.
Cannot run program "F:\esp_work\dout_interrupt\build\Firmware.elf": Launching failed

@Vineetha1705
Copy link
Author

Vineetha1705 commented Mar 14, 2024 via email

@NirajSiroya
Copy link

NirajSiroya commented Mar 14, 2024

this is my debug configuration.
image

after changing to this one im getting below errors.
Error in final launch sequence
Failed to execute MI command:
-target-select remote localhost:3333
Error message from debugger back end:
localhost:3333: Connection timed out.
Failed to execute MI command:
-target-select remote localhost:3333
Error message from debugger back end:
localhost:3333: Connection timed out.
localhost:3333: Connection timed out.

@Vineetha1705
Copy link
Author

Vineetha1705 commented Mar 14, 2024 via email

@NirajSiroya
Copy link

NirajSiroya commented Mar 14, 2024

yes , i'm using ESP_IDF usb only

@Vineetha1705
Copy link
Author

Vineetha1705 commented Mar 14, 2024 via email

@erhankur
Copy link
Collaborator

@NirajSiroya Please make sure that you are using onboard usb port to start debugging or bridge board as a debug probe from here. https://github.com/espressif/esp-usb-bridge

For the on board usb_serial_jtag you must select C6 chip (via builtin USB-JTAG) For the latter, C6 chip (via ESP USB Bridge)

And you don't need to set flash voltage as 1.8v. This parameter is only for the esp32 chips to set flash voltage via TDI pin during boot.

Please select enable verbose output from debugger config in the startup section and share the openocd logs.

@NirajSiroya
Copy link

This is the errors , what i'm getting after enabling verbose output in debug configuration.

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

@erhankur
Copy link
Collaborator

I suggest you to run debugging from the command line first. "idf.py openocd" and "idf.py gdb" commands are pretty helpful and for us it will be easier to understand what is going on.

Then, you can be sure your env is working and switch to the IDE again.

@NirajSiroya
Copy link

@erhankur Yes , Its working with command line . But as i'm not using command line tool So i wanted it works with eclipse ide also

@cmsd2
Copy link

cmsd2 commented Aug 12, 2024

was this error specific to the c6? i'm getting something similar on the h2:

Info : accepting 'gdb' connection on tcp/50000
Info : [esp32h2] Target halted, PC=0x40800400, debug_reason=00000008
Info : [esp32h2] Halt cause (5) - (PMP Load access fault)
Error: [esp32h2] Algorithm timed out after 3001 ms.
Info : [esp32h2] Target halted, PC=0x40800400, debug_reason=00000000
Info : [esp32h2] Halt cause (7) - (PMP Store access fault)

using openocd v0.12.0-esp32-20240726

@erhankur
Copy link
Collaborator

@cmsd2 can you give a detail about the steps to reproduce the issue?

@mnigbor
Copy link

mnigbor commented Feb 16, 2025

EDIT: It turns out this was all a red herring the ESP32-C3 works find and doesn't have this issue. The real issue was leaving the D8 (GPIO8) pin floating, which was causing inconsistent behavior. Pulling it high made everything work.

In my case, things just happened to work after I changed Flash Size.

I posted this comment just in case someone searching for OpenOCD connection issues finds this.

Before reading on, be sure you're past basic connection issues.

  • OpenOCD should not abort after you launch it. If it does, it likely means it wasn't able to establish communications with your JTAG and you need to fix that first.
  • When you launch gdb, it will connect with OpenOCD. The OpenOCD screen should show output telling you it's communicating with the on-chip JTAG. Things like chip architecture and number of cores should display.
  • You shouldn't be getting timeouts. There's a fix for that documented above.

All these are issues need to be resolved before the fix described below is relevant.

As of 16-Feb-2025, the flash memory size issue seems to still be an issue. I believe it affects C3's, S3's and probably other ESP32's with on-chip JTAGl. The issue prevents OpenOCD from finding debug symbols (or presumably reading anything useful) in the binary. This causes OpenOCD to reject the gdb connection.

In my case, I was having trouble getting gdb to connect to my ESP32-C3 using the built-in JTAG and the ESP-IDF command-line. It's about a year later, so I'm using IDF 5.4 and OpenOCD 12.0. When I ran gdb, the OpenOCD server would reject the connection after warning that it could not find FreeRTOS symbols (and other error messages similar to the ones above).

Changing the flash memory size from 2M to 4M in menuconfig fixed the issue. I tried this fix because @erhankur said fixing memory sizes less than 4MB was on his to-do list and my config was set to 2MB. I'm guessing the fix is still on his to-do list.

@erhankur
Copy link
Collaborator

@mnigbor Flash size issue was related to ESP32-C6 and H2 and it is fixed at this release

loaders/esp: Fixed dynamic mmu page size issue. With the 2MB flash config, the stub flasher could not properly configure the Cache MMU, so mapping and flash breakpoints were not working.

I am not aware that we have the same issue on ESP32-C3 and ESP32-S3. Please create a new issue with the OpenOCD logs and details of your hardware and application config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants