riscv-collab / riscv-openocd

Fork of OpenOCD that has RISC-V support
Other
452 stars 328 forks source link

examine(): Debug Module did not become active. dmcontrol=0x0 #1042

Closed l1onog closed 6 months ago

l1onog commented 6 months ago

I implemented RISCV SoC on a Zcu102 fpga. I am trying to use openOCD and jtag-hs2 to download code to the board as instructed in the README. I have checked the physical connection and make sure it be correctly connected to the Zcu102. Does anyone know what could potentially cause this error and ways to fix it? @en-sc I would really appreciate it.

here is the error I got:

Open On-Chip Debugger 0.10.0+dev-00830-ga88cc98a0-dirty (2024-04-09-21:46)
Licensed under GNU GPL v2
For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
Info : clock speed 1000 kHz
Info : JTAG tap: riscv.unknown0 tap/device found: 0x10102001 (mfg: 0x000 (<invalid>), part: 0x0102, ver: 0x1)
Info : JTAG tap: riscv.cpu tap/device found: 0x249511c3 (mfg: 0x0e1 (Wintec Industries), part: 0x4951, ver: 0x2)
Error: Debug Module did not become active. dmcontrol=0x0
Info : Listening on port 3333 for gdb connections
Error: Target not examined yet

Here is what it shows when I run with -d3 flag

Open On-Chip Debugger 0.10.0+dev-00830-ga88cc98a0-dirty (2024-04-09-21:46)
Licensed under GNU GPL v2
For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
User : 13 3 options.c:60 configuration_output_handler(): debug_level: 3
User : 14 3 options.c:60 configuration_output_handler(): 
Debug: 15 3 options.c:184 add_default_dirs(): bindir=/usr/local/bin
Debug: 16 3 options.c:185 add_default_dirs(): pkgdatadir=/usr/local/share/openocd
Debug: 17 3 options.c:186 add_default_dirs(): exepath=/usr/local/bin
Debug: 18 3 options.c:187 add_default_dirs(): bin2data=../share/openocd
Debug: 19 3 configuration.c:42 add_script_search_dir(): adding /home/fpga/.openocd
Debug: 20 3 configuration.c:42 add_script_search_dir(): adding /usr/local/bin/../share/openocd/site
Debug: 21 3 configuration.c:42 add_script_search_dir(): adding /usr/local/bin/../share/openocd/scripts
Debug: 22 3 configuration.c:97 find_file(): found /opt/riscv/pulp/fpga/pulp-zcu102/openocd-zcu102-digilent-jtag-hs2.cfg
Debug: 23 3 command.c:143 script_debug(): command - adapter_khz adapter_khz 1000
Debug: 25 3 core.c:1636 jtag_config_khz(): handle jtag khz
Debug: 26 3 core.c:1599 adapter_khz_to_speed(): convert khz to interface specific speed value
Debug: 27 3 core.c:1599 adapter_khz_to_speed(): convert khz to interface specific speed value
Debug: 28 3 command.c:143 script_debug(): command - interface interface ftdi
Debug: 30 3 command.c:355 register_command_handler(): registering 'ftdi_device_desc'...
Debug: 31 3 command.c:355 register_command_handler(): registering 'ftdi_serial'...
Debug: 32 3 command.c:355 register_command_handler(): registering 'ftdi_channel'...
Debug: 33 3 command.c:355 register_command_handler(): registering 'ftdi_layout_init'...
Debug: 34 3 command.c:355 register_command_handler(): registering 'ftdi_layout_signal'...
Debug: 35 3 command.c:355 register_command_handler(): registering 'ftdi_set_signal'...
Debug: 36 3 command.c:355 register_command_handler(): registering 'ftdi_get_signal'...
Debug: 37 3 command.c:355 register_command_handler(): registering 'ftdi_vid_pid'...
Debug: 38 3 command.c:355 register_command_handler(): registering 'ftdi_tdo_sample_edge'...
Debug: 39 3 command.c:355 register_command_handler(): registering 'ftdi_oscan1_mode'...
Debug: 40 3 command.c:143 script_debug(): command - ftdi_vid_pid ftdi_vid_pid 0x0403 0x6014
Debug: 42 4 command.c:143 script_debug(): command - ftdi_channel ftdi_channel 0
Debug: 44 4 command.c:143 script_debug(): command - ftdi_layout_init ftdi_layout_init 0x00e8 0x60eb
Debug: 46 4 command.c:143 script_debug(): command - transport transport select
Info : 47 4 transport.c:285 jim_transport_select(): auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
Debug: 48 4 command.c:355 register_command_handler(): registering 'jtag_flush_queue_sleep'...
Debug: 49 4 command.c:355 register_command_handler(): registering 'jtag_rclk'...
Debug: 50 4 command.c:355 register_command_handler(): registering 'jtag_ntrst_delay'...
Debug: 51 4 command.c:355 register_command_handler(): registering 'jtag_ntrst_assert_width'...
Debug: 52 4 command.c:355 register_command_handler(): registering 'scan_chain'...
Debug: 53 4 command.c:355 register_command_handler(): registering 'jtag_reset'...
Debug: 54 4 command.c:355 register_command_handler(): registering 'runtest'...
Debug: 55 4 command.c:355 register_command_handler(): registering 'irscan'...
Debug: 56 4 command.c:355 register_command_handler(): registering 'verify_ircapture'...
Debug: 57 4 command.c:355 register_command_handler(): registering 'verify_jtag'...
Debug: 58 4 command.c:355 register_command_handler(): registering 'tms_sequence'...
Debug: 59 4 command.c:355 register_command_handler(): registering 'wait_srst_deassert'...
Debug: 60 4 command.c:355 register_command_handler(): registering 'jtag'...
Debug: 61 4 command.c:355 register_command_handler(): registering 'jtag'...
Debug: 62 4 command.c:355 register_command_handler(): registering 'jtag'...
Debug: 63 4 command.c:355 register_command_handler(): registering 'jtag'...
Debug: 64 4 command.c:355 register_command_handler(): registering 'jtag'...
Debug: 65 4 command.c:355 register_command_handler(): registering 'jtag'...
Debug: 66 4 command.c:355 register_command_handler(): registering 'jtag'...
Debug: 67 4 command.c:355 register_command_handler(): registering 'jtag'...
Debug: 68 4 command.c:355 register_command_handler(): registering 'jtag'...
Debug: 69 4 command.c:355 register_command_handler(): registering 'jtag'...
Debug: 70 4 command.c:355 register_command_handler(): registering 'jtag'...
Debug: 71 4 command.c:355 register_command_handler(): registering 'jtag'...
Debug: 72 4 command.c:355 register_command_handler(): registering 'jtag'...
Debug: 73 4 command.c:355 register_command_handler(): registering 'svf'...
Debug: 74 4 command.c:355 register_command_handler(): registering 'xsvf'...
Debug: 75 4 command.c:143 script_debug(): command - transport transport select
Debug: 76 4 command.c:143 script_debug(): command - jtag jtag newtap riscv unknown0 -irlen 5 -expected-id 0x10102001
Debug: 77 4 tcl.c:566 jim_newtap_cmd(): Creating New Tap, Chip: riscv, Tap: unknown0, Dotted: riscv.unknown0, 4 params
Debug: 78 4 tcl.c:591 jim_newtap_cmd(): Processing option: -irlen
Debug: 79 4 tcl.c:591 jim_newtap_cmd(): Processing option: -expected-id
Debug: 80 4 core.c:1300 jtag_tap_init(): Created Tap: riscv.unknown0 @ abs position 0, irlen 5, capture: 0x1 mask: 0x3
Debug: 81 4 command.c:143 script_debug(): command - jtag jtag newtap riscv cpu -irlen 5 -expected-id 0x249511c3
Debug: 82 4 tcl.c:566 jim_newtap_cmd(): Creating New Tap, Chip: riscv, Tap: cpu, Dotted: riscv.cpu, 4 params
Debug: 83 4 tcl.c:591 jim_newtap_cmd(): Processing option: -irlen
Debug: 84 4 tcl.c:591 jim_newtap_cmd(): Processing option: -expected-id
Debug: 85 4 core.c:1300 jtag_tap_init(): Created Tap: riscv.cpu @ abs position 1, irlen 5, capture: 0x1 mask: 0x3
Debug: 86 4 command.c:143 script_debug(): command - target target create riscv.cpu riscv -chain-position riscv.cpu -coreid 0x3e0
Debug: 87 4 target.c:1966 target_free_all_working_areas_restore(): freeing all working areas
Debug: 88 4 command.c:355 register_command_handler(): registering 'riscv'...
Debug: 89 4 command.c:355 register_command_handler(): registering 'riscv'...
Debug: 90 4 command.c:355 register_command_handler(): registering 'riscv'...
Debug: 91 4 command.c:355 register_command_handler(): registering 'riscv'...
Debug: 92 4 command.c:355 register_command_handler(): registering 'riscv'...
Debug: 93 4 command.c:355 register_command_handler(): registering 'riscv'...
Debug: 94 4 command.c:355 register_command_handler(): registering 'riscv'...
Debug: 95 4 command.c:355 register_command_handler(): registering 'riscv'...
Debug: 96 4 command.c:355 register_command_handler(): registering 'riscv'...
Debug: 97 4 command.c:355 register_command_handler(): registering 'riscv'...
Debug: 98 4 command.c:355 register_command_handler(): registering 'riscv'...
Debug: 99 4 command.c:355 register_command_handler(): registering 'riscv'...
Debug: 100 4 command.c:355 register_command_handler(): registering 'riscv'...
Debug: 101 4 command.c:355 register_command_handler(): registering 'riscv'...
Debug: 102 4 command.c:355 register_command_handler(): registering 'riscv'...
Debug: 103 4 command.c:355 register_command_handler(): registering 'riscv'...
Debug: 104 4 command.c:355 register_command_handler(): registering 'arm'...
Debug: 105 4 command.c:355 register_command_handler(): registering 'arm'...
Debug: 106 4 command.c:355 register_command_handler(): registering 'arm'...
Debug: 107 4 command.c:355 register_command_handler(): registering 'arm'...
Debug: 108 4 command.c:355 register_command_handler(): registering 'riscv.cpu'...
Debug: 109 4 command.c:355 register_command_handler(): registering 'riscv.cpu'...
Debug: 110 4 command.c:355 register_command_handler(): registering 'riscv.cpu'...
Debug: 111 4 command.c:355 register_command_handler(): registering 'riscv.cpu'...
Debug: 112 4 command.c:355 register_command_handler(): registering 'riscv.cpu'...
Debug: 113 4 command.c:355 register_command_handler(): registering 'riscv.cpu'...
Debug: 114 4 command.c:355 register_command_handler(): registering 'riscv.cpu'...
Debug: 115 4 command.c:355 register_command_handler(): registering 'riscv.cpu'...
Debug: 116 4 command.c:355 register_command_handler(): registering 'riscv.cpu'...
Debug: 117 4 command.c:355 register_command_handler(): registering 'riscv.cpu'...
Debug: 118 4 command.c:355 register_command_handler(): registering 'riscv.cpu'...
Debug: 119 4 command.c:355 register_command_handler(): registering 'riscv.cpu'...
Debug: 120 4 command.c:355 register_command_handler(): registering 'riscv.cpu'...
Debug: 121 4 command.c:355 register_command_handler(): registering 'riscv.cpu'...
Debug: 122 4 command.c:355 register_command_handler(): registering 'riscv.cpu'...
Debug: 123 4 command.c:355 register_command_handler(): registering 'riscv.cpu'...
Debug: 124 4 command.c:355 register_command_handler(): registering 'riscv.cpu'...
Debug: 125 4 command.c:355 register_command_handler(): registering 'riscv.cpu'...
Debug: 126 4 command.c:355 register_command_handler(): registering 'riscv.cpu'...
Debug: 127 4 command.c:355 register_command_handler(): registering 'riscv.cpu'...
Debug: 128 4 command.c:355 register_command_handler(): registering 'riscv.cpu'...
Debug: 129 4 command.c:355 register_command_handler(): registering 'riscv.cpu'...
Debug: 130 4 command.c:355 register_command_handler(): registering 'riscv.cpu'...
Debug: 131 4 command.c:355 register_command_handler(): registering 'riscv.cpu'...
Debug: 132 4 command.c:355 register_command_handler(): registering 'riscv.cpu'...
Debug: 133 4 command.c:355 register_command_handler(): registering 'riscv.cpu'...
Debug: 134 4 command.c:355 register_command_handler(): registering 'riscv.cpu'...
Debug: 135 4 command.c:355 register_command_handler(): registering 'riscv.cpu'...
Debug: 136 4 command.c:355 register_command_handler(): registering 'riscv.cpu'...
Debug: 137 4 command.c:355 register_command_handler(): registering 'riscv.cpu'...
Debug: 138 4 command.c:355 register_command_handler(): registering 'riscv.cpu'...
Debug: 139 4 command.c:355 register_command_handler(): registering 'riscv.cpu'...
Debug: 140 4 command.c:355 register_command_handler(): registering 'riscv.cpu'...
Debug: 141 4 command.c:355 register_command_handler(): registering 'riscv.cpu'...
Debug: 142 4 command.c:355 register_command_handler(): registering 'riscv.cpu'...
Debug: 143 4 command.c:355 register_command_handler(): registering 'riscv.cpu'...
Debug: 144 4 command.c:355 register_command_handler(): registering 'riscv.cpu'...
Debug: 145 4 command.c:355 register_command_handler(): registering 'riscv.cpu'...
Debug: 146 4 command.c:355 register_command_handler(): registering 'riscv.cpu'...
Debug: 147 4 command.c:355 register_command_handler(): registering 'riscv.cpu'...
Debug: 148 4 command.c:355 register_command_handler(): registering 'riscv.cpu'...
Debug: 149 4 command.c:355 register_command_handler(): registering 'riscv.cpu'...
Debug: 150 4 command.c:355 register_command_handler(): registering 'riscv.cpu'...
Debug: 151 4 command.c:355 register_command_handler(): registering 'riscv.cpu'...
Debug: 152 4 command.c:355 register_command_handler(): registering 'riscv.cpu'...
Debug: 153 4 command.c:143 script_debug(): command - gdb_report_data_abort gdb_report_data_abort enable
Debug: 155 4 command.c:143 script_debug(): command - gdb_report_register_access_error gdb_report_register_access_error enable
Debug: 157 4 command.c:143 script_debug(): command - riscv riscv set_reset_timeout_sec 120
Debug: 159 4 command.c:143 script_debug(): command - riscv riscv set_command_timeout_sec 120
Debug: 161 4 command.c:143 script_debug(): command - riscv riscv set_prefer_sba on
Debug: 163 4 command.c:143 script_debug(): command - scan_chain scan_chain
Debug: 165 4 command.c:143 script_debug(): command - init init
Debug: 167 4 command.c:143 script_debug(): command - target target init
Debug: 169 4 command.c:143 script_debug(): command - target target names
Debug: 170 4 command.c:143 script_debug(): command - riscv.cpu riscv.cpu cget -event gdb-flash-erase-start
Debug: 171 4 command.c:143 script_debug(): command - riscv.cpu riscv.cpu configure -event gdb-flash-erase-start reset init
Debug: 172 4 command.c:143 script_debug(): command - riscv.cpu riscv.cpu cget -event gdb-flash-write-end
Debug: 173 4 command.c:143 script_debug(): command - riscv.cpu riscv.cpu configure -event gdb-flash-write-end reset halt
Debug: 174 4 command.c:143 script_debug(): command - riscv.cpu riscv.cpu cget -event gdb-attach
Debug: 175 4 command.c:143 script_debug(): command - riscv.cpu riscv.cpu configure -event gdb-attach halt
Debug: 176 4 target.c:1428 handle_target_init_command(): Initializing targets...
Debug: 177 4 riscv.c:430 riscv_init_target(): riscv_init_target()
Debug: 178 16 semihosting_common.c:97 semihosting_common_init():  
Debug: 179 16 command.c:355 register_command_handler(): registering 'target_request'...
Debug: 180 16 command.c:355 register_command_handler(): registering 'trace'...
Debug: 181 16 command.c:355 register_command_handler(): registering 'trace'...
Debug: 182 16 command.c:355 register_command_handler(): registering 'fast_load_image'...
Debug: 183 16 command.c:355 register_command_handler(): registering 'fast_load'...
Debug: 184 16 command.c:355 register_command_handler(): registering 'profile'...
Debug: 185 16 command.c:355 register_command_handler(): registering 'virt2phys'...
Debug: 186 16 command.c:355 register_command_handler(): registering 'reg'...
Debug: 187 16 command.c:355 register_command_handler(): registering 'poll'...
Debug: 188 16 command.c:355 register_command_handler(): registering 'wait_halt'...
Debug: 189 16 command.c:355 register_command_handler(): registering 'halt'...
Debug: 190 16 command.c:355 register_command_handler(): registering 'resume'...
Debug: 191 16 command.c:355 register_command_handler(): registering 'reset'...
Debug: 192 16 command.c:355 register_command_handler(): registering 'soft_reset_halt'...
Debug: 193 16 command.c:355 register_command_handler(): registering 'step'...
Debug: 194 16 command.c:355 register_command_handler(): registering 'mdd'...
Debug: 195 16 command.c:355 register_command_handler(): registering 'mdw'...
Debug: 196 16 command.c:355 register_command_handler(): registering 'mdh'...
Debug: 197 16 command.c:355 register_command_handler(): registering 'mdb'...
Debug: 198 16 command.c:355 register_command_handler(): registering 'mwd'...
Debug: 199 16 command.c:355 register_command_handler(): registering 'mww'...
Debug: 200 16 command.c:355 register_command_handler(): registering 'mwh'...
Debug: 201 16 command.c:355 register_command_handler(): registering 'mwb'...
Debug: 202 16 command.c:355 register_command_handler(): registering 'bp'...
Debug: 203 16 command.c:355 register_command_handler(): registering 'rbp'...
Debug: 204 16 command.c:355 register_command_handler(): registering 'wp'...
Debug: 205 16 command.c:355 register_command_handler(): registering 'rwp'...
Debug: 206 16 command.c:355 register_command_handler(): registering 'load_image'...
Debug: 207 16 command.c:355 register_command_handler(): registering 'dump_image'...
Debug: 208 16 command.c:355 register_command_handler(): registering 'verify_image_checksum'...
Debug: 209 16 command.c:355 register_command_handler(): registering 'verify_image'...
Debug: 210 16 command.c:355 register_command_handler(): registering 'test_image'...
Debug: 211 16 command.c:355 register_command_handler(): registering 'reset_nag'...
Debug: 212 16 command.c:355 register_command_handler(): registering 'ps'...
Debug: 213 16 command.c:355 register_command_handler(): registering 'test_mem_access'...
Debug: 214 16 ftdi.c:728 ftdi_initialize(): ftdi interface using shortest path jtag state transitions
Debug: 215 17 mpsse.c:425 mpsse_purge(): -
Debug: 216 17 mpsse.c:706 mpsse_loopback_config(): off
Debug: 217 17 mpsse.c:751 mpsse_set_frequency(): target 1000000 Hz
Debug: 218 17 mpsse.c:743 mpsse_rtck_config(): off
Debug: 219 17 mpsse.c:732 mpsse_divide_by_5_config(): off
Debug: 220 17 mpsse.c:712 mpsse_set_divisor(): 29
Debug: 221 17 mpsse.c:775 mpsse_set_frequency(): actually 1000000 Hz
Debug: 222 17 core.c:1599 adapter_khz_to_speed(): convert khz to interface specific speed value
Debug: 223 17 core.c:1603 adapter_khz_to_speed(): have interface set up
Debug: 224 17 mpsse.c:751 mpsse_set_frequency(): target 1000000 Hz
Debug: 225 17 mpsse.c:743 mpsse_rtck_config(): off
Debug: 226 17 mpsse.c:732 mpsse_divide_by_5_config(): off
Debug: 227 17 mpsse.c:712 mpsse_set_divisor(): 29
Debug: 228 17 mpsse.c:775 mpsse_set_frequency(): actually 1000000 Hz
Debug: 229 17 core.c:1599 adapter_khz_to_speed(): convert khz to interface specific speed value
Debug: 230 17 core.c:1603 adapter_khz_to_speed(): have interface set up
Info : 231 17 core.c:1381 adapter_init(): clock speed 1000 kHz
Debug: 232 17 openocd.c:141 handle_init_command(): Debug Adapter init complete
Debug: 233 17 command.c:143 script_debug(): command - transport transport init
Debug: 235 17 transport.c:239 handle_transport_init(): handle_transport_init
Debug: 236 17 core.c:729 jtag_add_reset(): SRST line released
Debug: 237 17 core.c:753 jtag_add_reset(): TRST line released
Debug: 238 17 core.c:327 jtag_call_event_callbacks(): jtag event: TAP reset
Debug: 239 17 command.c:143 script_debug(): command - jtag jtag arp_init
Debug: 240 17 core.c:1394 jtag_init_inner(): Init JTAG chain
Debug: 241 17 core.c:327 jtag_call_event_callbacks(): jtag event: TAP reset
Debug: 242 17 core.c:1060 jtag_examine_chain(): DR scan interrogation for IDCODE/BYPASS
Debug: 243 17 core.c:327 jtag_call_event_callbacks(): jtag event: TAP reset
Debug: 244 18 jep106.c:33 jep106_manufacturer(): BUG: Caller passed out-of-range JEP106 ID!
Info : 245 18 core.c:959 jtag_examine_chain_display(): JTAG tap: riscv.unknown0 tap/device found: 0x10102001 (mfg: 0x000 (<invalid>), part: 0x0102, ver: 0x1)
Info : 246 18 core.c:959 jtag_examine_chain_display(): JTAG tap: riscv.cpu tap/device found: 0x249511c3 (mfg: 0x0e1 (Wintec Industries), part: 0x4951, ver: 0x2)
Debug: 247 18 core.c:1190 jtag_validate_ircapture(): IR capture validation scan
Debug: 248 18 core.c:1247 jtag_validate_ircapture(): riscv.unknown0: IR capture 0x05
Debug: 249 18 core.c:1247 jtag_validate_ircapture(): riscv.cpu: IR capture 0x05
Debug: 250 18 command.c:143 script_debug(): command - dap dap init
Debug: 252 18 arm_dap.c:105 dap_init_all(): Initializing all DAPs ...
Debug: 253 18 openocd.c:158 handle_init_command(): Examining targets...
Debug: 254 18 target.c:1614 target_call_event_callbacks(): target event 17 (examine-start) for core riscv.cpu
Debug: 255 18 riscv.c:972 riscv_examine(): riscv_examine()
Debug: 256 18 riscv.c:402 dtmcontrol_scan(): DTMCONTROL: 0x0 -> 0x1c71
Debug: 257 18 riscv.c:982 riscv_examine(): dtmcontrol=0x1c71
Debug: 258 18 riscv.c:984 riscv_examine():   version=0x1
Debug: 259 18 riscv-013.c:1756 init_target(): init
Debug: 260 18 riscv-013.c:452 dtmcontrol_scan(): DTMCS: 0x0 -> 0x1c71
Debug: 261 18 riscv-013.c:1472 examine(): dtmcontrol=0x1c71
Debug: 262 18 riscv-013.c:1473 examine():   dmireset=0
Debug: 263 18 riscv-013.c:1474 examine():   idle=1
Debug: 264 18 riscv-013.c:1475 examine():   dmistat=3
Debug: 265 18 riscv-013.c:1476 examine():   abits=7
Debug: 266 18 riscv-013.c:1477 examine():   version=1
Debug: 267 18 riscv-013.c:263 get_dm(): [992] Allocating new DM
Debug: 268 18 riscv-013.c:397 scan(): 41b 0i w 00000000 @10 -> b 00000000 @10
Debug: 269 18 riscv-013.c:461 increase_dmi_busy_delay(): dtmcs_idle=1, dmi_busy_delay=1, ac_busy_delay=0
Debug: 270 19 riscv-013.c:452 dtmcontrol_scan(): DTMCS: 0x10000 -> 0x1c71
Debug: 271 19 riscv-013.c:397 scan(): 41b 1i w 00000000 @10 -> + 00000000 @10
Debug: 272 19 riscv-013.c:397 scan(): 41b 1i - 00000000 @10 -> b 00000000 @10
Debug: 273 19 riscv-013.c:461 increase_dmi_busy_delay(): dtmcs_idle=1, dmi_busy_delay=2, ac_busy_delay=0
Debug: 274 19 riscv-013.c:452 dtmcontrol_scan(): DTMCS: 0x10000 -> 0x1c71
Debug: 275 19 riscv-013.c:397 scan(): 41b 2i - 00000000 @10 -> + 00000000 @10
Debug: 276 19 riscv-013.c:397 scan(): 41b 2i w 00000001 @10 -> b 00000000 @10
Debug: 277 19 riscv-013.c:408 scan():  dmactive -> 
Debug: 278 19 riscv-013.c:461 increase_dmi_busy_delay(): dtmcs_idle=1, dmi_busy_delay=3, ac_busy_delay=0
Debug: 279 19 riscv-013.c:452 dtmcontrol_scan(): DTMCS: 0x10000 -> 0x1c71
Debug: 280 19 riscv-013.c:397 scan(): 41b 3i w 00000001 @10 -> + 00000000 @10
Debug: 281 19 riscv-013.c:408 scan():  dmactive -> 
Debug: 282 20 riscv-013.c:397 scan(): 41b 3i - 00000000 @10 -> b 00000000 @10
Debug: 283 20 riscv-013.c:461 increase_dmi_busy_delay(): dtmcs_idle=1, dmi_busy_delay=4, ac_busy_delay=0
Debug: 284 20 riscv-013.c:452 dtmcontrol_scan(): DTMCS: 0x10000 -> 0x1c71
Debug: 285 20 riscv-013.c:397 scan(): 41b 4i - 00000000 @10 -> + 00000000 @10
Debug: 286 20 riscv-013.c:397 scan(): 41b 4i w 07ffffc1 @10 -> b 00000000 @10
Debug: 287 20 riscv-013.c:408 scan():  hasel hartselhi=1023 hartsello=1023 dmactive -> 
Debug: 288 20 riscv-013.c:461 increase_dmi_busy_delay(): dtmcs_idle=1, dmi_busy_delay=5, ac_busy_delay=0
Debug: 289 20 riscv-013.c:452 dtmcontrol_scan(): DTMCS: 0x10000 -> 0x1c71
Debug: 290 20 riscv-013.c:397 scan(): 41b 5i w 07ffffc1 @10 -> + 00000000 @10
Debug: 291 20 riscv-013.c:408 scan():  hasel hartselhi=1023 hartsello=1023 dmactive -> 
Debug: 292 20 riscv-013.c:397 scan(): 41b 5i - 00000000 @10 -> b 00000000 @10
Debug: 293 20 riscv-013.c:461 increase_dmi_busy_delay(): dtmcs_idle=1, dmi_busy_delay=6, ac_busy_delay=0
Debug: 294 20 riscv-013.c:452 dtmcontrol_scan(): DTMCS: 0x10000 -> 0x1c71
Debug: 295 20 riscv-013.c:397 scan(): 41b 6i - 00000000 @10 -> + 00000000 @10
Debug: 296 21 riscv-013.c:397 scan(): 41b 6i r 00000000 @10 -> b 00000000 @10
Debug: 297 21 riscv-013.c:461 increase_dmi_busy_delay(): dtmcs_idle=1, dmi_busy_delay=7, ac_busy_delay=0
Debug: 298 21 riscv-013.c:452 dtmcontrol_scan(): DTMCS: 0x10000 -> 0x1c71
Debug: 299 21 riscv-013.c:397 scan(): 41b 7i r 00000000 @10 -> + 00000000 @10
Debug: 300 21 riscv-013.c:397 scan(): 41b 7i - 00000000 @10 -> b 00000000 @10
Debug: 301 21 riscv-013.c:461 increase_dmi_busy_delay(): dtmcs_idle=1, dmi_busy_delay=8, ac_busy_delay=0
Debug: 302 21 riscv-013.c:452 dtmcontrol_scan(): DTMCS: 0x10000 -> 0x1c71
Debug: 303 21 riscv-013.c:397 scan(): 41b 8i - 00000000 @10 -> + 00000000 @10
Error: 304 21 riscv-013.c:1510 examine(): Debug Module did not become active. dmcontrol=0x0
Debug: 305 21 openocd.c:160 handle_init_command(): target examination failed
Debug: 306 21 command.c:143 script_debug(): command - flash flash init
Debug: 308 21 tcl.c:1222 handle_flash_init_command(): Initializing flash devices...
Debug: 309 21 command.c:143 script_debug(): command - nand nand init
Debug: 311 21 tcl.c:498 handle_nand_init_command(): Initializing NAND devices...
Debug: 312 21 command.c:143 script_debug(): command - pld pld init
Debug: 314 21 pld.c:206 handle_pld_init_command(): Initializing PLDs...
Debug: 315 21 gdb_server.c:3490 gdb_target_start(): starting gdb server for riscv.cpu on 3333
Info : 316 21 server.c:310 add_service(): Listening on port 3333 for gdb connections
Debug: 317 21 command.c:143 script_debug(): command - halt halt
Debug: 319 21 target.c:3070 handle_halt_command(): -
Error: 320 21 target.c:567 target_halt(): Target not examined yet
Debug: 321 21 command.c:629 run_command(): Command 'halt' failed with error code -4
User : 322 21 command.c:695 command_run_line(): 
Debug: 323 21 riscv.c:476 riscv_deinit_target(): riscv_deinit_target()
Debug: 324 21 riscv-013.c:1448 deinit_target(): riscv_deinit_target()
Debug: 325 23 target.c:1966 target_free_all_working_areas_restore(): freeing all working areas
TommyMurphyTM1234 commented 6 months ago
Open On-Chip Debugger 0.10.0+dev-00830-ga88cc98a0-dirty (2024-04-09-21:46)

You're using a very out of date version of OpenOCD. There have been a lot of changes/enhancements since that version that could impact behaviour in this context. You should try again with a more up to date version - ideally a build of the latest 0.12.0+dev using the sources from this repository.

l1onog commented 6 months ago

When I use the latest version, I get the following results

Open On-Chip Debugger 0.12.0+dev-03744-g3991492cc (2024-04-15-21:35)
Licensed under GNU GPL v2
For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
DEPRECATED! use 'adapter speed' not 'adapter_khz'
DEPRECATED! use 'adapter driver' not 'interface'
DEPRECATED! use 'ftdi vid_pid' not 'ftdi_vid_pid'
DEPRECATED! use 'ftdi channel' not 'ftdi_channel'
DEPRECATED! use 'ftdi layout_init' not 'ftdi_layout_init'
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
riscv
  riscv authdata_read [index]
  riscv authdata_write [index] value
  riscv dm_read reg_address
  riscv dm_write reg_address value
  riscv dmi_read address
  riscv dmi_write address value
  riscv dump_sample_buf [base64]
  riscv etrigger set [vs] [vu] [m] [s] [u] <exception_codes>|clear
  riscv exec_progbuf instr1 [instr2 [... instr16]]
  riscv expose_csrs n0[-m0|=name0][,n1[-m1|=name1]]...
  riscv expose_custom n0[-m0|=name0][,n1[-m1|=name1]]...
  riscv hide_csrs {n0|n-m0}[,n1|n-m1]......
  riscv icount set [vs] [vu] [m] [s] [u] [pending] <count>|clear
  riscv info
  riscv itrigger set [vs] [vu] [nmi] [m] [s] [u] <mie_bits>|clear
  riscv memory_sample bucket address|clear [size=4]
  riscv repeat_read count address [size=4]
  riscv reset_delays [wait]
  riscv resume_order normal|reversed
  riscv set_bscan_tunnel_ir value
  riscv set_command_timeout_sec [sec]
  riscv set_ebreakm [on|off]
  riscv set_ebreaks [on|off]
  riscv set_ebreaku [on|off]
  riscv set_enable_trigger_feature [('eq'|'napot'|'ge_lt'|'all')
            ('wp'|'none')]
  riscv set_enable_virt2phys on|off
  riscv set_enable_virtual on|off
  riscv set_ir [idcode|dtmcs|dmi] value
  riscv set_maskisr ['off'|'steponly']
  riscv set_mem_access method1 [method2] [method3]
  riscv set_reset_timeout_sec [sec]
  riscv use_bscan_tunnel value [type]
riscv.cpu
  riscv.cpu arm
    riscv.cpu arm semihosting ['enable'|'disable']
    riscv.cpu arm semihosting_basedir [dir]
    riscv.cpu arm semihosting_cmdline arguments
    riscv.cpu arm semihosting_fileio ['enable'|'disable']
    riscv.cpu arm semihosting_read_user_param
    riscv.cpu arm semihosting_redirect (disable | tcp <port>
              ['debug'|'stdio'|'all'])
    riscv.cpu arm semihosting_resexit ['enable'|'disable']
  riscv.cpu arp_examine ['allow-defer']
  riscv.cpu arp_halt
  riscv.cpu arp_halt_gdb
  riscv.cpu arp_poll
  riscv.cpu arp_reset 'assert'|'deassert' halt
  riscv.cpu arp_waitstate statename timeoutmsecs
  riscv.cpu cget target_attribute
  riscv.cpu configure [target_attribute ...]
  riscv.cpu curstate
  riscv.cpu debug_reason
  riscv.cpu eventlist
  riscv.cpu examine_deferred
  riscv.cpu get_reg list
  riscv.cpu invoke-event event_name
  riscv.cpu mdb address [count]
  riscv.cpu mdd address [count]
  riscv.cpu mdh address [count]
  riscv.cpu mdw address [count]
  riscv.cpu mwb address data [count]
  riscv.cpu mwd address data [count]
  riscv.cpu mwh address data [count]
  riscv.cpu mww address data [count]
  riscv.cpu read_memory address width count ['phys']
  riscv.cpu riscv
    riscv.cpu riscv authdata_read [index]
    riscv.cpu riscv authdata_write [index] value
    riscv.cpu riscv dm_read reg_address
    riscv.cpu riscv dm_write reg_address value
    riscv.cpu riscv dmi_read address
    riscv.cpu riscv dmi_write address value
    riscv.cpu riscv dump_sample_buf [base64]
    riscv.cpu riscv etrigger set [vs] [vu] [m] [s] [u]
              <exception_codes>|clear
    riscv.cpu riscv exec_progbuf instr1 [instr2 [... instr16]]
    riscv.cpu riscv expose_csrs n0[-m0|=name0][,n1[-m1|=name1]]...
    riscv.cpu riscv expose_custom n0[-m0|=name0][,n1[-m1|=name1]]...
    riscv.cpu riscv hide_csrs {n0|n-m0}[,n1|n-m1]......
    riscv.cpu riscv icount set [vs] [vu] [m] [s] [u] [pending]
              <count>|clear
    riscv.cpu riscv info
    riscv.cpu riscv itrigger set [vs] [vu] [nmi] [m] [s] [u]
              <mie_bits>|clear
    riscv.cpu riscv memory_sample bucket address|clear [size=4]
    riscv.cpu riscv repeat_read count address [size=4]
    riscv.cpu riscv reset_delays [wait]
    riscv.cpu riscv resume_order normal|reversed
    riscv.cpu riscv set_bscan_tunnel_ir value
    riscv.cpu riscv set_command_timeout_sec [sec]
    riscv.cpu riscv set_ebreakm [on|off]
    riscv.cpu riscv set_ebreaks [on|off]
    riscv.cpu riscv set_ebreaku [on|off]
    riscv.cpu riscv set_enable_trigger_feature
              [('eq'|'napot'|'ge_lt'|'all') ('wp'|'none')]
    riscv.cpu riscv set_enable_virt2phys on|off
    riscv.cpu riscv set_enable_virtual on|off
    riscv.cpu riscv set_ir [idcode|dtmcs|dmi] value
    riscv.cpu riscv set_maskisr ['off'|'steponly']
    riscv.cpu riscv set_mem_access method1 [method2] [method3]
    riscv.cpu riscv set_reset_timeout_sec [sec]
    riscv.cpu riscv use_bscan_tunnel value [type]
  riscv.cpu set_reg dict
  riscv.cpu smp [on|off]
  riscv.cpu smp_gdb
  riscv.cpu was_examined
  riscv.cpu write_memory address width data ['phys']
/opt/riscv/pulp/fpga/pulp-zcu102/openocd-zcu102-digilent-jtag-hs2.cfg:24: Error: 
in procedure 'script' 
at file "embedded:startup.tcl", line 28
at file "/opt/riscv/pulp/fpga/pulp-zcu102/openocd-zcu102-digilent-jtag-hs2.cfg", line 24
Error: [riscv.cpu] Unsupported DTM version: -1
Error: [riscv.cpu] Could not identify target type.

Also, the contents of my cfg file

adapter_khz     1000

# Digilent JTAG-HS2
interface ftdi
ftdi_vid_pid 0x0403 0x6014
ftdi_channel 0
ftdi_layout_init 0x00e8 0x60eb

set _CHIPNAME riscv

jtag newtap $_CHIPNAME unknown0 -irlen 5 -expected-id 0x10102001
jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x249511c3

set _TARGETNAME $_CHIPNAME.cpu
target create $_TARGETNAME riscv -chain-position $_TARGETNAME -coreid 0x3e0

gdb_report_data_abort enable
gdb_report_register_access_error enable

riscv set_reset_timeout_sec 120
riscv set_command_timeout_sec 120

# prefer to use sba for system bus access
riscv set_prefer_sba on

# dump jtag chain
scan_chain

init
halt
echo "Ready for Remote Connections"

So, it looks like my hardware connection is all good. Could the issue be with openocd or the cfg file? How should I tweak it? Thanks a ton for all your help!

TommyMurphyTM1234 commented 6 months ago

You need to update/fix your OpenOCD debug script due to changes to some commands between 0.10.0 and 0.12.0. If you're not clear on what to do then refer to the latest OpenOCD documentation.

l1onog commented 6 months ago

If the version of opoencd corresponds to the version of the debug script, can we ignore the specific version issue, and how can we solve the 'examine(): Debug Module did not become active. dmcontrol=0x0' problem?

TommyMurphyTM1234 commented 6 months ago

If the version of opoencd corresponds to the version of the debug script, can we ignore the specific version issue

No. Because, as I said, there have been many changes, enhancements and fixes between 0.10.0 and the latest 0.12.0 development version and these make it effectively pointless to report and analyse issues with the old version. You need to get things working with the latest 0.12.0 and see if the problem persists with that. It's not that difficult to update your script and I've given you the documentation link to assist with this.

l1onog commented 6 months ago

Thanks, I will try it as you pointed out.

TommyMurphyTM1234 commented 6 months ago

@l1onog can you clarify what happened please? Did it work ok with a build of the latest OpenOCD once your OpenOCD script was updated to work with that?