Debug Freedom SoC Running on Digilent Genesys with OpenOCD

My team and I are attempting to try and get OpenOCD working with a Freedom u500 SoC running on it. We currently can get the bitstream on the FPGA and it can even boot up Linux and drop us into a shell. However we did not have debug functionality for the endeavor and were hoping to try and get OpenOCD to work so we can use GDB to debug.

We tried breaking out the JTAG connections that you guys have on your Debug Core (TDI, TDO, TMS, TCK, Vcc, GND) out to GPIO’s on the board, so that we could use a debugger to interface with the pins. The debugger that we are using, currently the only one available to us, is an Altera USB-Blaster 2. The configuration file for the USB-Blaster 2 already exists in the RISCV fork of OpenOCD so there was no need to write a config for that. However since we are using a slightly modified Freedom SoC for the bitstream, I made a new configuration for the target. It is based on the configurations that were present for the Arty and Hifive1 boards.

When I try running OpenOCD, I use the command:
openocd -f interface/altera-usb-blaster2.cfg -f custom_freedom.cfg

The command runs, but it seems like OpenOCD only reads in the interface configuration file, and gets stuck trying to find the debug target. I’ve tried, running the command without the target configuration and it produces the same output, so I’m sure that the target configuration isn’t being read.

I was wondering how you guys go about using OpenOCD with the Arty? What connections do you break out? What is the mapping for it? I know you guys use an Olimex arm debugger to physically interact with the pins, but I was hoping to get some hints on how we could try and get OpenOCD to work with our board.

If you run openocd with the -d flag and give us a bit more info, we may be able to help figure out what’s wrong. Everything you said so far seems pretty reasonable, though as you’ve said we’ve never tried it with the Altera USB-Blaster 2 so no idea if that would work. Also, what is in your custom_freedom.cfg?

So we used the Quartus tools to scan the JTAG chain to see if we can see anything on it. We found a device, it came up unknown since Quartus has no knowledge of the RISCV target. So I’m confident that the connection is there.

We stopped using the USB Blaster2 to interface with the exported JTAG connections, and instead are using an FTDI Mini Module, it uses the FT2232C chip.

I run the command:
sudo openocd -f interface/ftdi/minimodule.cfg -f custom_freedom.cfg

That produces the following output, with the -d flag.
Open On-Chip Debugger 0.10.0+dev-00112-g3c1c6e0 (2018-02-21-18:01)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
User : 13 3 command.c:544 command_print(): debug_level: 3
Debug: 14 3 options.c:184 add_default_dirs(): bindir=/usr/local/bin
Debug: 15 3 options.c:185 add_default_dirs(): pkgdatadir=/usr/local/share/openocd
Debug: 16 3 options.c:186 add_default_dirs(): exepath=/usr/local/bin
Debug: 17 3 options.c:187 add_default_dirs(): bin2data=…/share/openocd
Debug: 18 3 configuration.c:42 add_script_search_dir(): adding /home/sgutierrez/.openocd
Debug: 19 3 configuration.c:42 add_script_search_dir(): adding /usr/local/bin/…/share/openocd/site
Debug: 20 3 configuration.c:42 add_script_search_dir(): adding /usr/local/bin/…/share/openocd/scripts
Debug: 21 3 configuration.c:82 find_file(): found /usr/local/bin/…/share/openocd/scripts/interface/ftdi/minimodule.cfg
Debug: 22 3 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_interface ftdi
Debug: 23 3 command.c:143 script_debug(): command - interface ocd_interface ftdi
Debug: 25 3 command.c:364 register_command_handler(): registering ‘ocd_ftdi_device_desc’…
Debug: 26 4 command.c:364 register_command_handler(): registering ‘ocd_ftdi_serial’…
Debug: 27 4 command.c:364 register_command_handler(): registering ‘ocd_ftdi_location’…
Debug: 28 4 command.c:364 register_command_handler(): registering ‘ocd_ftdi_channel’…
Debug: 29 4 command.c:364 register_command_handler(): registering ‘ocd_ftdi_layout_init’…
Debug: 30 4 command.c:364 register_command_handler(): registering ‘ocd_ftdi_layout_signal’…
Debug: 31 4 command.c:364 register_command_handler(): registering ‘ocd_ftdi_set_signal’…
Debug: 32 4 command.c:364 register_command_handler(): registering ‘ocd_ftdi_get_signal’…
Debug: 33 4 command.c:364 register_command_handler(): registering ‘ocd_ftdi_vid_pid’…
Debug: 34 4 command.c:364 register_command_handler(): registering ‘ocd_ftdi_tdo_sample_edge’…
Debug: 35 4 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_ftdi_device_desc FT2232H MiniModule
Debug: 36 4 command.c:143 script_debug(): command - ftdi_device_desc ocd_ftdi_device_desc FT2232H MiniModule
Debug: 38 4 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_ftdi_vid_pid 0x0403 0x6010
Debug: 39 4 command.c:143 script_debug(): command - ftdi_vid_pid ocd_ftdi_vid_pid 0x0403 0x6010
Debug: 41 4 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_ftdi_layout_init 0x0008 0x000b
Debug: 42 4 command.c:143 script_debug(): command - ftdi_layout_init ocd_ftdi_layout_init 0x0008 0x000b
Debug: 44 4 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_ftdi_layout_signal nSRST -data 0x0020 -oe 0x0020
Debug: 45 4 command.c:143 script_debug(): command - ftdi_layout_signal ocd_ftdi_layout_signal nSRST -data 0x0020 -oe 0x0020
Debug: 47 4 configuration.c:82 find_file(): found viarocket_board.cfg
Debug: 48 4 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_adapter_khz 10000
Debug: 49 4 command.c:143 script_debug(): command - adapter_khz ocd_adapter_khz 10000
Debug: 51 4 core.c:1693 jtag_config_khz(): handle jtag khz
Debug: 52 4 core.c:1660 adapter_khz_to_speed(): convert khz to interface specific speed value
Debug: 53 4 core.c:1660 adapter_khz_to_speed(): convert khz to interface specific speed value
User : 54 4 command.c:544 command_print(): adapter speed: 10000 kHz
Debug: 55 4 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_transport select
Debug: 56 4 command.c:143 script_debug(): command - ocd_transport ocd_transport select
Info : 57 4 transport.c:286 jim_transport_select(): auto-selecting first available session transport “jtag”. To override use 'transport select '.
Debug: 58 4 command.c:364 register_command_handler(): registering ‘ocd_jtag_flush_queue_sleep’…
Debug: 59 4 command.c:364 register_command_handler(): registering ‘ocd_jtag_rclk’…
Debug: 60 4 command.c:364 register_command_handler(): registering ‘ocd_jtag_ntrst_delay’…
Debug: 61 4 command.c:364 register_command_handler(): registering ‘ocd_jtag_ntrst_assert_width’…
Debug: 62 4 command.c:364 register_command_handler(): registering ‘ocd_scan_chain’…
Debug: 63 4 command.c:364 register_command_handler(): registering ‘ocd_jtag_reset’…
Debug: 64 4 command.c:364 register_command_handler(): registering ‘ocd_runtest’…
Debug: 65 4 command.c:364 register_command_handler(): registering ‘ocd_irscan’…
Debug: 66 4 command.c:364 register_command_handler(): registering ‘ocd_verify_ircapture’…
Debug: 67 4 command.c:364 register_command_handler(): registering ‘ocd_verify_jtag’…
Debug: 68 4 command.c:364 register_command_handler(): registering ‘ocd_tms_sequence’…
Debug: 69 5 command.c:364 register_command_handler(): registering ‘ocd_wait_srst_deassert’…
Debug: 70 5 command.c:364 register_command_handler(): registering ‘ocd_jtag’…
Debug: 71 5 command.c:364 register_command_handler(): registering ‘ocd_jtag’…
Debug: 72 5 command.c:364 register_command_handler(): registering ‘ocd_jtag’…
Debug: 73 5 command.c:364 register_command_handler(): registering ‘ocd_jtag’…
Debug: 74 5 command.c:364 register_command_handler(): registering ‘ocd_jtag’…
Debug: 75 5 command.c:364 register_command_handler(): registering ‘ocd_jtag’…
Debug: 76 5 command.c:364 register_command_handler(): registering ‘ocd_jtag’…
Debug: 77 5 command.c:364 register_command_handler(): registering ‘ocd_jtag’…
Debug: 78 5 command.c:364 register_command_handler(): registering ‘ocd_jtag’…
Debug: 79 5 command.c:364 register_command_handler(): registering ‘ocd_jtag’…
Debug: 80 5 command.c:364 register_command_handler(): registering ‘ocd_jtag’…
Debug: 81 5 command.c:364 register_command_handler(): registering ‘ocd_jtag’…
Debug: 82 5 command.c:364 register_command_handler(): registering ‘ocd_jtag’…
Debug: 83 5 command.c:364 register_command_handler(): registering ‘ocd_svf’…
Debug: 84 5 command.c:364 register_command_handler(): registering ‘ocd_xsvf’…
Debug: 85 5 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_transport select
Debug: 86 5 command.c:143 script_debug(): command - ocd_transport ocd_transport select
Debug: 87 5 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_jtag newtap riscv cpu -irlen 5
Debug: 88 5 command.c:143 script_debug(): command - ocd_jtag ocd_jtag newtap riscv cpu -irlen 5
Debug: 89 5 tcl.c:549 jim_newtap_cmd(): Creating New Tap, Chip: riscv, Tap: cpu, Dotted: riscv.cpu, 2 params
Debug: 90 5 tcl.c:573 jim_newtap_cmd(): Processing option: -irlen
Debug: 91 5 core.c:1366 jtag_tap_init(): Created Tap: riscv.cpu @ abs position 0, irlen 5, capture: 0x1 mask: 0x3
Debug: 92 5 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_target create riscv.cpu riscv -chain-position riscv.cpu
Debug: 93 5 command.c:143 script_debug(): command - ocd_target ocd_target create riscv.cpu riscv -chain-position riscv.cpu
Debug: 94 5 target.c:1905 target_free_all_working_areas_restore(): freeing all working areas
Debug: 95 5 command.c:364 register_command_handler(): registering ‘ocd_riscv’…
Debug: 96 5 command.c:364 register_command_handler(): registering ‘ocd_riscv’…
Debug: 97 5 command.c:364 register_command_handler(): registering ‘ocd_riscv’…
Debug: 98 5 command.c:364 register_command_handler(): registering ‘ocd_riscv’…
Debug: 99 5 command.c:364 register_command_handler(): registering ‘ocd_riscv.cpu’…
Debug: 100 5 command.c:364 register_command_handler(): registering ‘ocd_riscv.cpu’…
Debug: 101 5 command.c:364 register_command_handler(): registering ‘ocd_riscv.cpu’…
Debug: 102 5 command.c:364 register_command_handler(): registering ‘ocd_riscv.cpu’…
Debug: 103 5 command.c:364 register_command_handler(): registering ‘ocd_riscv.cpu’…
Debug: 104 5 command.c:364 register_command_handler(): registering ‘ocd_riscv.cpu’…
Debug: 105 5 command.c:364 register_command_handler(): registering ‘ocd_riscv.cpu’…
Debug: 106 5 command.c:364 register_command_handler(): registering ‘ocd_riscv.cpu’…
Debug: 107 5 command.c:364 register_command_handler(): registering ‘ocd_riscv.cpu’…
Debug: 108 5 command.c:364 register_command_handler(): registering ‘ocd_riscv.cpu’…
Debug: 109 5 command.c:364 register_command_handler(): registering ‘ocd_riscv.cpu’…
Debug: 110 5 command.c:364 register_command_handler(): registering ‘ocd_riscv.cpu’…
Debug: 111 5 command.c:364 register_command_handler(): registering ‘ocd_riscv.cpu’…
Debug: 112 5 command.c:364 register_command_handler(): registering ‘ocd_riscv.cpu’…
Debug: 113 5 command.c:364 register_command_handler(): registering ‘ocd_riscv.cpu’…
Debug: 114 5 command.c:364 register_command_handler(): registering ‘ocd_riscv.cpu’…
Debug: 115 5 command.c:364 register_command_handler(): registering ‘ocd_riscv.cpu’…
Debug: 116 5 command.c:364 register_command_handler(): registering ‘ocd_riscv.cpu’…
Debug: 117 5 command.c:364 register_command_handler(): registering ‘ocd_riscv.cpu’…
Debug: 118 5 command.c:364 register_command_handler(): registering ‘ocd_riscv.cpu’…
Debug: 119 5 command.c:364 register_command_handler(): registering ‘ocd_riscv.cpu’…
Debug: 120 5 command.c:364 register_command_handler(): registering ‘ocd_riscv.cpu’…
Debug: 121 5 command.c:364 register_command_handler(): registering ‘ocd_riscv.cpu’…
Debug: 122 5 command.c:364 register_command_handler(): registering ‘ocd_riscv.cpu’…
Debug: 123 5 command.c:364 register_command_handler(): registering ‘ocd_riscv.cpu’…
Debug: 124 5 command.c:364 register_command_handler(): registering ‘ocd_riscv.cpu’…
Debug: 125 5 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_riscv set_reset_timeout_sec 120
Debug: 126 6 command.c:143 script_debug(): command - ocd_riscv ocd_riscv set_reset_timeout_sec 120
Debug: 128 6 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_riscv set_command_timeout_sec 120
Debug: 129 6 command.c:143 script_debug(): command - ocd_riscv ocd_riscv set_command_timeout_sec 120
Debug: 131 6 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_echo Ready for Remote Connections…
Debug: 132 6 command.c:143 script_debug(): command - echo ocd_echo Ready for Remote Connections…
User : 134 6 command.c:762 jim_echo(): Ready for Remote Connections…
Info : 135 6 server.c:308 add_service(): Listening on port 6666 for tcl connections
Info : 136 6 server.c:308 add_service(): Listening on port 4444 for telnet connections
Debug: 137 6 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_init
Debug: 138 6 command.c:143 script_debug(): command - init ocd_init
Debug: 140 6 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_target init
Debug: 141 6 command.c:143 script_debug(): command - ocd_target ocd_target init
Debug: 143 6 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_target names
Debug: 144 6 command.c:143 script_debug(): command - ocd_target ocd_target names
Debug: 145 6 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_riscv.cpu cget -event gdb-flash-erase-start
Debug: 146 6 command.c:143 script_debug(): command - ocd_riscv.cpu ocd_riscv.cpu cget -event gdb-flash-erase-start
Debug: 147 6 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_riscv.cpu configure -event gdb-flash-erase-start reset init
Debug: 148 6 command.c:143 script_debug(): command - ocd_riscv.cpu ocd_riscv.cpu configure -event gdb-flash-erase-start reset init
Debug: 149 6 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_riscv.cpu cget -event gdb-flash-write-end
Debug: 150 6 command.c:143 script_debug(): command - ocd_riscv.cpu ocd_riscv.cpu cget -event gdb-flash-write-end
Debug: 151 6 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_riscv.cpu configure -event gdb-flash-write-end reset halt
Debug: 152 6 command.c:143 script_debug(): command - ocd_riscv.cpu ocd_riscv.cpu configure -event gdb-flash-write-end reset halt
Debug: 153 6 target.c:1329 handle_target_init_command(): Initializing targets…
Debug: 154 6 riscv.c:247 riscv_init_target(): riscv_init_target()
Debug: 155 8 command.c:364 register_command_handler(): registering ‘ocd_target_request’…
Debug: 156 8 command.c:364 register_command_handler(): registering ‘ocd_trace’…
Debug: 157 8 command.c:364 register_command_handler(): registering ‘ocd_trace’…
Debug: 158 8 command.c:364 register_command_handler(): registering ‘ocd_fast_load_image’…
Debug: 159 8 command.c:364 register_command_handler(): registering ‘ocd_fast_load’…
Debug: 160 8 command.c:364 register_command_handler(): registering ‘ocd_profile’…
Debug: 161 9 command.c:364 register_command_handler(): registering ‘ocd_virt2phys’…
Debug: 162 9 command.c:364 register_command_handler(): registering ‘ocd_reg’…
Debug: 163 9 command.c:364 register_command_handler(): registering ‘ocd_poll’…
Debug: 164 9 command.c:364 register_command_handler(): registering ‘ocd_wait_halt’…
Debug: 165 9 command.c:364 register_command_handler(): registering ‘ocd_halt’…
Debug: 166 9 command.c:364 register_command_handler(): registering ‘ocd_resume’…
Debug: 167 9 command.c:364 register_command_handler(): registering ‘ocd_reset’…
Debug: 168 9 command.c:364 register_command_handler(): registering ‘ocd_soft_reset_halt’…
Debug: 169 9 command.c:364 register_command_handler(): registering ‘ocd_step’…
Debug: 170 9 command.c:364 register_command_handler(): registering ‘ocd_mdd’…
Debug: 171 9 command.c:364 register_command_handler(): registering ‘ocd_mdw’…
Debug: 172 9 command.c:364 register_command_handler(): registering ‘ocd_mdh’…
Debug: 173 9 command.c:364 register_command_handler(): registering ‘ocd_mdb’…
Debug: 174 9 command.c:364 register_command_handler(): registering ‘ocd_mwd’…
Debug: 175 9 command.c:364 register_command_handler(): registering ‘ocd_mww’…
Debug: 176 9 command.c:364 register_command_handler(): registering ‘ocd_mwh’…
Debug: 177 9 command.c:364 register_command_handler(): registering ‘ocd_mwb’…
Debug: 178 9 command.c:364 register_command_handler(): registering ‘ocd_bp’…
Debug: 179 9 command.c:364 register_command_handler(): registering ‘ocd_rbp’…
Debug: 180 9 command.c:364 register_command_handler(): registering ‘ocd_wp’…
Debug: 181 9 command.c:364 register_command_handler(): registering ‘ocd_rwp’…
Debug: 182 9 command.c:364 register_command_handler(): registering ‘ocd_load_image’…
Debug: 183 9 command.c:364 register_command_handler(): registering ‘ocd_dump_image’…
Debug: 184 9 command.c:364 register_command_handler(): registering ‘ocd_verify_image_checksum’…
Debug: 185 9 command.c:364 register_command_handler(): registering ‘ocd_verify_image’…
Debug: 186 9 command.c:364 register_command_handler(): registering ‘ocd_test_image’…
Debug: 187 9 command.c:364 register_command_handler(): registering ‘ocd_reset_nag’…
Debug: 188 9 command.c:364 register_command_handler(): registering ‘ocd_ps’…
Debug: 189 9 command.c:364 register_command_handler(): registering ‘ocd_test_mem_access’…
Debug: 190 9 ftdi.c:657 ftdi_initialize(): ftdi interface using shortest path jtag state transitions
Debug: 191 20 mpsse.c:422 mpsse_purge(): -
Debug: 192 22 mpsse.c:703 mpsse_loopback_config(): off
Debug: 193 22 mpsse.c:748 mpsse_set_frequency(): target 10000000 Hz
Debug: 194 22 mpsse.c:740 mpsse_rtck_config(): off
Debug: 195 22 mpsse.c:729 mpsse_divide_by_5_config(): off
Debug: 196 22 mpsse.c:709 mpsse_set_divisor(): 2
Debug: 197 22 mpsse.c:772 mpsse_set_frequency(): actually 10000000 Hz
Debug: 198 22 core.c:1660 adapter_khz_to_speed(): convert khz to interface specific speed value
Debug: 199 22 core.c:1663 adapter_khz_to_speed(): have interface set up
Debug: 200 22 mpsse.c:748 mpsse_set_frequency(): target 10000000 Hz
Debug: 201 22 mpsse.c:740 mpsse_rtck_config(): off
Debug: 202 22 mpsse.c:729 mpsse_divide_by_5_config(): off
Debug: 203 22 mpsse.c:709 mpsse_set_divisor(): 2
Debug: 204 22 mpsse.c:772 mpsse_set_frequency(): actually 10000000 Hz
Info : 205 22 ftdi.c:291 ftdi_speed(): ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling"
Debug: 206 22 core.c:1660 adapter_khz_to_speed(): convert khz to interface specific speed value
Debug: 207 22 core.c:1663 adapter_khz_to_speed(): have interface set up
Info : 208 22 core.c:1448 adapter_init(): clock speed 10000 kHz
Debug: 209 22 openocd.c:140 handle_init_command(): Debug Adapter init complete
Debug: 210 22 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_transport init
Debug: 211 22 command.c:143 script_debug(): command - ocd_transport ocd_transport init
Debug: 213 22 transport.c:239 handle_transport_init(): handle_transport_init
Debug: 214 23 core.c:729 jtag_add_reset(): SRST line released
Debug: 215 23 core.c:753 jtag_add_reset(): TRST line released
Debug: 216 23 core.c:327 jtag_call_event_callbacks(): jtag event: TAP reset
Debug: 217 23 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_jtag arp_init
Debug: 218 23 command.c:143 script_debug(): command - ocd_jtag ocd_jtag arp_init
Debug: 219 23 core.c:1461 jtag_init_inner(): Init JTAG chain
Debug: 220 23 core.c:327 jtag_call_event_callbacks(): jtag event: TAP reset
Debug: 221 23 core.c:1121 jtag_examine_chain(): DR scan interrogation for IDCODE/BYPASS
Debug: 222 23 core.c:327 jtag_call_event_callbacks(): jtag event: TAP reset

The ‘sudo’ is because there is a permission error on the USB device, and I wanted to test it out before writing a .rules file for the usb device. It seems to be doing the same thing as when Using the USB Blaster. It can’t seem to find the TAP and spawn a GDB server. I haven’t tried connecting to the telnet server so I will attempt that and see if I can get some interactivity from there. The following is what is inside the freedom_custom.cfg file, I based it off of the Arty and Hifive configurations, removing what I don’t think I need and keeping most else.

adapter_khz 10000

set _CHIPNAME riscv
jtag newtap $_CHIPNAME cpu -irlen 5

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

riscv set_reset_timeout_sec 120
riscv set_command_timeout_sec 120

echo "Ready for Remote Connections.."

And nothing happens after the jtag event: TAP reset? I don’t know why OpenOCD would do nothing with your second -f command. Maybe you should try putting it all in one file?

Yeah, nothing happens after that last line. This is the output without the debug flag.

Open On-Chip Debugger 0.10.0+dev-00112-g3c1c6e0 (2018-02-21-18:01)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
adapter speed: 10000 kHz
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
Ready for Remote Connections..
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling"
Info : clock speed 10000 kHz

I hit CTRL-C when it hangs and it spits out this:

Error: libusb_handle_events() failed with LIBUSB_ERROR_INTERRUPTED
Segmentation fault (core dumped)

Might be hanging on that function?

I’ve tried connecting to the Telnet server and I get no response from it. I’ll try your suggestion and edit this reply with the results.

Got OpenOCD to find the target and start a GDB server. The problem was we were using usbip to interact with devices from a different system than the one physically connected to the device.

Tried using bot riscv64-unknown-elf-gdb and riscv64-unknown-linux-gdb to try and connect to it but the connection is closed by OpenOCD and it prints this out:

undefined debug reason 7 - target needs reset
openocd: src/target/riscv/riscv-011.c:422: dbus_scan: Assertion `info->addrbits != 0' failed.

We don’t have the TRST of the Mini module connected to the core, so I think that might be why its failing now.

What version of OpenOCD are you using? There were some recent bugfixes that may be useful to you.

I cloned and built the latest riscv-openocd just this morning.

Ah, also, why is it using riscv-011.c. That seems wrong. Can you run with -d again and share the output?

So this is the output after trying to connect to the GDB Server from a GDB client using the “target remote” command. The GDB client is on a different computer on the same network.

Info : 267 27 server.c:307 add_service(): Listening on port 3333 for gdb connections #starts server

#After "target remote" command on GDB client
Info : 268 8315 server.c:96 add_connection(): accepting 'gdb' connection on tcp/3333
Debug: 269 8315 breakpoints.c:357 breakpoint_clear_target_internal(): Delete all breakpoints for target: riscv.cpu
Debug: 270 8315 breakpoints.c:497 watchpoint_clear_target(): Delete all watchpoints for target: riscv.cpu
Debug: 271 8315 target.c:1515 target_call_event_callbacks(): target event 19 (gdb-attach)
Debug: 272 8315 gdb_server.c:995 gdb_new_connection(): New GDB Connection: 1, Target riscv.cpu, state: unknown
Debug: 273 8316 gdb_server.c:2850 gdb_input_inner(): received packet: 'qSupported:multiprocess+;swbreak+;hwbreak+;qRelocInsn+;fork-events+;vfork-events+;exec-events+;vContSupported+;QThreadEvents+;no-resumed+'
Debug: 274 8316 riscv.c:770 riscv_get_gdb_reg_list(): reg_class=0
Debug: 275 8316 riscv.c:771 riscv_get_gdb_reg_list(): rtos_hartid=0 current_hartid=0
Debug: 276 8316 gdb_server.c:2850 gdb_input_inner(): received packet: 'vMustReplyEmpty'
Debug: 277 8317 gdb_server.c:2850 gdb_input_inner(): received packet: 'QStartNoAckMode'
Debug: 278 8318 gdb_server.c:632 gdb_get_packet_inner(): Received first acknowledgment after entering noack mode. Ignoring it.
Debug: 279 8318 gdb_server.c:2850 gdb_input_inner(): received packet: 'Hg0'
Debug: 280 8318 gdb_server.c:2850 gdb_input_inner(): received packet: 'qXfer:features:read:target.xml:0,fff'
Debug: 281 8318 riscv.c:770 riscv_get_gdb_reg_list(): reg_class=0
Debug: 282 8318 riscv.c:771 riscv_get_gdb_reg_list(): rtos_hartid=0 current_hartid=0
Debug: 283 8320 gdb_server.c:2850 gdb_input_inner(): received packet: 'qXfer:features:read:target.xml:fff,1000'
Debug: 284 8322 gdb_server.c:2850 gdb_input_inner(): received packet: 'qXfer:features:read:target.xml:1fff,2000'
Debug: 285 8325 gdb_server.c:2850 gdb_input_inner(): received packet: 'qXfer:features:read:target.xml:3fff,3ffa'
Debug: 286 8327 gdb_server.c:2850 gdb_input_inner(): received packet: 'qTStatus'
Debug: 287 8327 gdb_server.c:2850 gdb_input_inner(): received packet: '?'
User : 288 8327 gdb_server.c:153 gdb_last_signal(): undefined debug reason 7 - target needs reset
Debug: 289 8327 gdb_server.c:2850 gdb_input_inner(): received packet: 'qXfer:threads:read::0,fff'
Debug: 290 8328 gdb_server.c:2850 gdb_input_inner(): received packet: 'Hc-1'
Debug: 291 8328 gdb_server.c:2850 gdb_input_inner(): received packet: 'qC'
Debug: 292 8328 gdb_server.c:2850 gdb_input_inner(): received packet: 'qAttached'
Debug: 293 8328 gdb_server.c:2850 gdb_input_inner(): received packet: 'g'
Debug: 294 8329 riscv.c:770 riscv_get_gdb_reg_list(): reg_class=1
Debug: 295 8329 riscv.c:771 riscv_get_gdb_reg_list(): rtos_hartid=0 current_hartid=0
Debug: 296 8329 riscv-011.c:1029 write_csr(): csr 0x7a0 <- 0x0
Debug: 297 8329 riscv-011.c:745 cache_set32(): cache[0x0] = 0x41002403: DASM(0x41002403)
Debug: 298 8329 riscv-011.c:745 cache_set32(): cache[0x1] = 0x7a041073: DASM(0x7a041073)
Debug: 299 8329 riscv-011.c:745 cache_set32(): cache[0x2] = 0x3fc0006f: DASM(0x3fc0006f)
Debug: 300 8329 riscv-011.c:745 cache_set32(): cache[0x4] = 0x00000000: DASM(0x0)
Debug: 301 8329 riscv-011.c:834 cache_write(): enter
openocd: src/target/riscv/riscv-011.c:422: dbus_scan: Assertion `info->addrbits != 0' failed.
Aborted (core dumped)

Does your HW use v11 debug implementation? And you are only showing the result after you try to connect with GDB. The target should have already determined a lot of information before you attempt to connect with GDB. It is that part of the OpenOCD log that I am interested in.

Open On-Chip Debugger 0.10.0+dev-00129-gfd9de02 (2018-03-09-11:38)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
User : 13 3 command.c:544 command_print(): debug_level: 3
Debug: 14 3 options.c:184 add_default_dirs(): bindir=/usr/local/bin
Debug: 15 3 options.c:185 add_default_dirs(): pkgdatadir=/usr/local/share/openocd
Debug: 16 3 options.c:186 add_default_dirs(): exepath=/usr/local/bin
Debug: 17 3 options.c:187 add_default_dirs(): bin2data=../share/openocd
Debug: 18 3 configuration.c:42 add_script_search_dir(): adding /home/sgutierrez/.openocd
Debug: 19 3 configuration.c:42 add_script_search_dir(): adding /usr/local/bin/../share/openocd/site
Debug: 20 3 configuration.c:42 add_script_search_dir(): adding /usr/local/bin/../share/openocd/scripts
Debug: 21 3 configuration.c:82 find_file(): found /usr/local/bin/../share/openocd/scripts/interface/ftdi/minimodule.cfg
Debug: 22 4 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_interface ftdi
Debug: 23 4 command.c:143 script_debug(): command - interface ocd_interface ftdi
Debug: 25 4 command.c:364 register_command_handler(): registering 'ocd_ftdi_device_desc'...
Debug: 26 4 command.c:364 register_command_handler(): registering 'ocd_ftdi_serial'...
Debug: 27 4 command.c:364 register_command_handler(): registering 'ocd_ftdi_location'...
Debug: 28 4 command.c:364 register_command_handler(): registering 'ocd_ftdi_channel'...
Debug: 29 4 command.c:364 register_command_handler(): registering 'ocd_ftdi_layout_init'...
Debug: 30 4 command.c:364 register_command_handler(): registering 'ocd_ftdi_layout_signal'...
Debug: 31 4 command.c:364 register_command_handler(): registering 'ocd_ftdi_set_signal'...
Debug: 32 4 command.c:364 register_command_handler(): registering 'ocd_ftdi_get_signal'...
Debug: 33 4 command.c:364 register_command_handler(): registering 'ocd_ftdi_vid_pid'...
Debug: 34 4 command.c:364 register_command_handler(): registering 'ocd_ftdi_tdo_sample_edge'...
Debug: 35 4 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_ftdi_device_desc FT2232H MiniModule
Debug: 36 4 command.c:143 script_debug(): command - ftdi_device_desc ocd_ftdi_device_desc FT2232H MiniModule
Debug: 38 4 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_ftdi_vid_pid 0x0403 0x6010
Debug: 39 4 command.c:143 script_debug(): command - ftdi_vid_pid ocd_ftdi_vid_pid 0x0403 0x6010
Debug: 41 4 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_ftdi_layout_init 0x0008 0x000b
Debug: 42 4 command.c:143 script_debug(): command - ftdi_layout_init ocd_ftdi_layout_init 0x0008 0x000b
Debug: 44 4 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_ftdi_layout_signal nSRST -data 0x0020 -oe 0x0020
Debug: 45 4 command.c:143 script_debug(): command - ftdi_layout_signal ocd_ftdi_layout_signal nSRST -data 0x0020 -oe 0x0020
Debug: 47 4 configuration.c:82 find_file(): found viarocket_board.cfg
Debug: 48 4 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_adapter_khz 10000
Debug: 49 4 command.c:143 script_debug(): command - adapter_khz ocd_adapter_khz 10000
Debug: 51 4 core.c:1693 jtag_config_khz(): handle jtag khz
Debug: 52 4 core.c:1660 adapter_khz_to_speed(): convert khz to interface specific speed value
Debug: 53 4 core.c:1660 adapter_khz_to_speed(): convert khz to interface specific speed value
User : 54 4 command.c:544 command_print(): adapter speed: 10000 kHz
Debug: 55 4 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_transport select
Debug: 56 5 command.c:143 script_debug(): command - ocd_transport ocd_transport select
Info : 57 5 transport.c:286 jim_transport_select(): auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
Debug: 58 5 command.c:364 register_command_handler(): registering 'ocd_jtag_flush_queue_sleep'...
Debug: 59 5 command.c:364 register_command_handler(): registering 'ocd_jtag_rclk'...
Debug: 60 5 command.c:364 register_command_handler(): registering 'ocd_jtag_ntrst_delay'...
Debug: 61 5 command.c:364 register_command_handler(): registering 'ocd_jtag_ntrst_assert_width'...
Debug: 62 5 command.c:364 register_command_handler(): registering 'ocd_scan_chain'...
Debug: 63 5 command.c:364 register_command_handler(): registering 'ocd_jtag_reset'...
Debug: 64 5 command.c:364 register_command_handler(): registering 'ocd_runtest'...
Debug: 65 5 command.c:364 register_command_handler(): registering 'ocd_irscan'...
Debug: 66 5 command.c:364 register_command_handler(): registering 'ocd_verify_ircapture'...
Debug: 67 5 command.c:364 register_command_handler(): registering 'ocd_verify_jtag'...
Debug: 68 5 command.c:364 register_command_handler(): registering 'ocd_tms_sequence'...
Debug: 69 5 command.c:364 register_command_handler(): registering 'ocd_wait_srst_deassert'...
Debug: 70 5 command.c:364 register_command_handler(): registering 'ocd_jtag'...
Debug: 71 5 command.c:364 register_command_handler(): registering 'ocd_jtag'...
Debug: 72 5 command.c:364 register_command_handler(): registering 'ocd_jtag'...
Debug: 73 5 command.c:364 register_command_handler(): registering 'ocd_jtag'...
Debug: 74 5 command.c:364 register_command_handler(): registering 'ocd_jtag'...
Debug: 75 5 command.c:364 register_command_handler(): registering 'ocd_jtag'...
Debug: 76 5 command.c:364 register_command_handler(): registering 'ocd_jtag'...
Debug: 77 5 command.c:364 register_command_handler(): registering 'ocd_jtag'...
Debug: 78 5 command.c:364 register_command_handler(): registering 'ocd_jtag'...
Debug: 79 5 command.c:364 register_command_handler(): registering 'ocd_jtag'...
Debug: 80 5 command.c:364 register_command_handler(): registering 'ocd_jtag'...
Debug: 81 5 command.c:364 register_command_handler(): registering 'ocd_jtag'...
Debug: 82 5 command.c:364 register_command_handler(): registering 'ocd_jtag'...
Debug: 83 5 command.c:364 register_command_handler(): registering 'ocd_svf'...
Debug: 84 5 command.c:364 register_command_handler(): registering 'ocd_xsvf'...
Debug: 85 5 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_transport select
Debug: 86 5 command.c:143 script_debug(): command - ocd_transport ocd_transport select
Debug: 87 5 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_jtag newtap riscv cpu -irlen 5
Debug: 88 5 command.c:143 script_debug(): command - ocd_jtag ocd_jtag newtap riscv cpu -irlen 5
Debug: 89 5 tcl.c:549 jim_newtap_cmd(): Creating New Tap, Chip: riscv, Tap: cpu, Dotted: riscv.cpu, 2 params
Debug: 90 5 tcl.c:573 jim_newtap_cmd(): Processing option: -irlen
Debug: 91 5 core.c:1366 jtag_tap_init(): Created Tap: riscv.cpu @ abs position 0, irlen 5, capture: 0x1 mask: 0x3
Debug: 92 6 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_target create riscv.cpu riscv -chain-position riscv.cpu
Debug: 93 6 command.c:143 script_debug(): command - ocd_target ocd_target create riscv.cpu riscv -chain-position riscv.cpu
Debug: 94 6 target.c:1905 target_free_all_working_areas_restore(): freeing all working areas
Debug: 95 6 command.c:364 register_command_handler(): registering 'ocd_riscv'...
Debug: 96 6 command.c:364 register_command_handler(): registering 'ocd_riscv'...
Debug: 97 6 command.c:364 register_command_handler(): registering 'ocd_riscv'...
Debug: 98 6 command.c:364 register_command_handler(): registering 'ocd_riscv'...
Debug: 99 6 command.c:364 register_command_handler(): registering 'ocd_riscv'...
Debug: 100 6 command.c:364 register_command_handler(): registering 'ocd_riscv'...
Debug: 101 6 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 102 6 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 103 6 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 104 6 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 105 6 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 106 6 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 107 6 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 108 6 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 109 6 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 110 6 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 111 6 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 112 6 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 113 6 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 114 6 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 115 6 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 116 6 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 117 6 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 118 6 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 119 6 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 120 6 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 121 6 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 122 6 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 123 6 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 124 6 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 125 6 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 126 6 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 127 6 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 128 6 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 129 6 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_riscv set_reset_timeout_sec 120
Debug: 130 6 command.c:143 script_debug(): command - ocd_riscv ocd_riscv set_reset_timeout_sec 120
Debug: 132 6 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_riscv set_command_timeout_sec 120
Debug: 133 7 command.c:143 script_debug(): command - ocd_riscv ocd_riscv set_command_timeout_sec 120
Debug: 135 7 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_echo Ready for Remote Connections..
Debug: 136 7 command.c:143 script_debug(): command - echo ocd_echo Ready for Remote Connections..
User : 138 7 command.c:762 jim_echo(): Ready for Remote Connections..
Info : 139 7 server.c:307 add_service(): Listening on port 6666 for tcl connections
Info : 140 7 server.c:307 add_service(): Listening on port 4444 for telnet connections
Debug: 141 7 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_init
Debug: 142 7 command.c:143 script_debug(): command - init ocd_init
Debug: 144 7 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_target init
Debug: 145 7 command.c:143 script_debug(): command - ocd_target ocd_target init
Debug: 147 7 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_target names
Debug: 148 7 command.c:143 script_debug(): command - ocd_target ocd_target names
Debug: 149 7 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_riscv.cpu cget -event gdb-flash-erase-start
Debug: 150 7 command.c:143 script_debug(): command - ocd_riscv.cpu ocd_riscv.cpu cget -event gdb-flash-erase-start
Debug: 151 7 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_riscv.cpu configure -event gdb-flash-erase-start reset init
Debug: 152 7 command.c:143 script_debug(): command - ocd_riscv.cpu ocd_riscv.cpu configure -event gdb-flash-erase-start reset init
Debug: 153 7 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_riscv.cpu cget -event gdb-flash-write-end
Debug: 154 7 command.c:143 script_debug(): command - ocd_riscv.cpu ocd_riscv.cpu cget -event gdb-flash-write-end
Debug: 155 7 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_riscv.cpu configure -event gdb-flash-write-end reset halt
Debug: 156 7 command.c:143 script_debug(): command - ocd_riscv.cpu ocd_riscv.cpu configure -event gdb-flash-write-end reset halt
Debug: 157 7 target.c:1329 handle_target_init_command(): Initializing targets...
Debug: 158 7 riscv.c:247 riscv_init_target(): riscv_init_target()
Debug: 159 9 command.c:364 register_command_handler(): registering 'ocd_target_request'...
Debug: 160 9 command.c:364 register_command_handler(): registering 'ocd_trace'...
Debug: 161 9 command.c:364 register_command_handler(): registering 'ocd_trace'...
Debug: 162 9 command.c:364 register_command_handler(): registering 'ocd_fast_load_image'...
Debug: 163 9 command.c:364 register_command_handler(): registering 'ocd_fast_load'...
Debug: 164 9 command.c:364 register_command_handler(): registering 'ocd_profile'...
Debug: 165 9 command.c:364 register_command_handler(): registering 'ocd_virt2phys'...
Debug: 166 9 command.c:364 register_command_handler(): registering 'ocd_reg'...
Debug: 167 9 command.c:364 register_command_handler(): registering 'ocd_poll'...
Debug: 168 9 command.c:364 register_command_handler(): registering 'ocd_wait_halt'...
Debug: 169 9 command.c:364 register_command_handler(): registering 'ocd_halt'...
Debug: 170 9 command.c:364 register_command_handler(): registering 'ocd_resume'...
Debug: 171 9 command.c:364 register_command_handler(): registering 'ocd_reset'...
Debug: 172 9 command.c:364 register_command_handler(): registering 'ocd_soft_reset_halt'...
Debug: 173 9 command.c:364 register_command_handler(): registering 'ocd_step'...
Debug: 174 9 command.c:364 register_command_handler(): registering 'ocd_mdd'...
Debug: 175 9 command.c:364 register_command_handler(): registering 'ocd_mdw'...
Debug: 176 9 command.c:364 register_command_handler(): registering 'ocd_mdh'...
Debug: 177 10 command.c:364 register_command_handler(): registering 'ocd_mdb'...
Debug: 178 10 command.c:364 register_command_handler(): registering 'ocd_mwd'...
Debug: 179 10 command.c:364 register_command_handler(): registering 'ocd_mww'...
Debug: 180 10 command.c:364 register_command_handler(): registering 'ocd_mwh'...
Debug: 181 10 command.c:364 register_command_handler(): registering 'ocd_mwb'...
Debug: 182 10 command.c:364 register_command_handler(): registering 'ocd_bp'...
Debug: 183 10 command.c:364 register_command_handler(): registering 'ocd_rbp'...
Debug: 184 10 command.c:364 register_command_handler(): registering 'ocd_wp'...
Debug: 185 10 command.c:364 register_command_handler(): registering 'ocd_rwp'...
Debug: 186 10 command.c:364 register_command_handler(): registering 'ocd_load_image'...
Debug: 187 10 command.c:364 register_command_handler(): registering 'ocd_dump_image'...
Debug: 188 10 command.c:364 register_command_handler(): registering 'ocd_verify_image_checksum'...
Debug: 189 10 command.c:364 register_command_handler(): registering 'ocd_verify_image'...
Debug: 190 10 command.c:364 register_command_handler(): registering 'ocd_test_image'...
Debug: 191 10 command.c:364 register_command_handler(): registering 'ocd_reset_nag'...
Debug: 192 10 command.c:364 register_command_handler(): registering 'ocd_ps'...
Debug: 193 10 command.c:364 register_command_handler(): registering 'ocd_test_mem_access'...
Debug: 194 10 ftdi.c:657 ftdi_initialize(): ftdi interface using shortest path jtag state transitions
Error: 195 19 mpsse.c:193 open_matching_device(): libusb_open() failed with LIBUSB_ERROR_ACCESS
Debug: 196 22 mpsse.c:422 mpsse_purge(): -
Debug: 197 23 mpsse.c:703 mpsse_loopback_config(): off
Debug: 198 23 mpsse.c:748 mpsse_set_frequency(): target 10000000 Hz
Debug: 199 23 mpsse.c:740 mpsse_rtck_config(): off
Debug: 200 23 mpsse.c:729 mpsse_divide_by_5_config(): off
Debug: 201 23 mpsse.c:709 mpsse_set_divisor(): 2
Debug: 202 23 mpsse.c:772 mpsse_set_frequency(): actually 10000000 Hz
Debug: 203 23 core.c:1660 adapter_khz_to_speed(): convert khz to interface specific speed value
Debug: 204 23 core.c:1663 adapter_khz_to_speed(): have interface set up
Debug: 205 23 mpsse.c:748 mpsse_set_frequency(): target 10000000 Hz
Debug: 206 23 mpsse.c:740 mpsse_rtck_config(): off
Debug: 207 23 mpsse.c:729 mpsse_divide_by_5_config(): off
Debug: 208 23 mpsse.c:709 mpsse_set_divisor(): 2
Debug: 209 23 mpsse.c:772 mpsse_set_frequency(): actually 10000000 Hz
Info : 210 23 ftdi.c:291 ftdi_speed(): ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling"
Debug: 211 23 core.c:1660 adapter_khz_to_speed(): convert khz to interface specific speed value
Debug: 212 23 core.c:1663 adapter_khz_to_speed(): have interface set up
Info : 213 23 core.c:1448 adapter_init(): clock speed 10000 kHz
Debug: 214 23 openocd.c:140 handle_init_command(): Debug Adapter init complete
Debug: 215 23 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_transport init
Debug: 216 23 command.c:143 script_debug(): command - ocd_transport ocd_transport init
Debug: 218 23 transport.c:239 handle_transport_init(): handle_transport_init
Debug: 219 23 core.c:729 jtag_add_reset(): SRST line released
Debug: 220 23 core.c:753 jtag_add_reset(): TRST line released
Debug: 221 24 core.c:327 jtag_call_event_callbacks(): jtag event: TAP reset
Debug: 222 24 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_jtag arp_init
Debug: 223 24 command.c:143 script_debug(): command - ocd_jtag ocd_jtag arp_init
Debug: 224 24 core.c:1461 jtag_init_inner(): Init JTAG chain
Debug: 225 24 core.c:327 jtag_call_event_callbacks(): jtag event: TAP reset
Debug: 226 24 core.c:1121 jtag_examine_chain(): DR scan interrogation for IDCODE/BYPASS
Debug: 227 24 core.c:327 jtag_call_event_callbacks(): jtag event: TAP reset
Debug: 228 25 jep106.c:33 jep106_manufacturer(): BUG: Caller passed out-of-range JEP106 ID!
Info : 229 25 core.c:1020 jtag_examine_chain_display(): JTAG tap: riscv.cpu tap/device found: 0xffffffff (mfg: 0x7ff (<invalid>), part: 0xffff, ver: 0xf)
Warn : 230 25 core.c:1058 jtag_examine_chain_end(): Unexpected idcode after end of chain: 640 0x7fffffff
Error: 231 25 core.c:1197 jtag_examine_chain(): double-check your JTAG setup (interface, speed, ...)
Error: 232 25 core.c:1506 jtag_init_inner(): Trying to use configured scan chain anyway...
Debug: 233 25 core.c:1252 jtag_validate_ircapture(): IR capture validation scan
Error: 234 25 core.c:1304 jtag_validate_ircapture(): riscv.cpu: IR capture error; saw 0x1f not 0x01
Debug: 235 25 core.c:327 jtag_call_event_callbacks(): jtag event: TAP reset
Warn : 236 25 core.c:1529 jtag_init_inner(): Bypassing JTAG setup events due to errors
Debug: 237 25 openocd.c:153 handle_init_command(): Examining targets...
Debug: 238 25 target.c:1515 target_call_event_callbacks(): target event 17 (examine-start)
Debug: 239 25 riscv.c:654 riscv_examine(): riscv_examine()
Debug: 240 25 riscv.c:224 dtmcontrol_scan(): DTMCONTROL: 0x0 -> 0x0
Debug: 241 25 riscv.c:664 riscv_examine(): dtmcontrol=0x0
Debug: 242 25 riscv.c:666 riscv_examine():   version=0x0
Debug: 243 25 riscv-011.c:1380 init_target(): init
Debug: 244 27 riscv-011.c:303 dtmcontrol_scan(): DTMCONTROL: 0x0 -> 0x0
Debug: 245 27 riscv-011.c:1476 examine(): dtmcontrol=0x0
Debug: 246 27 riscv-011.c:1477 examine():   addrbits=0
Debug: 247 27 riscv-011.c:1478 examine():   version=0
Debug: 248 27 riscv-011.c:1479 examine():   idle=0
Error: 249 27 riscv-011.c:1481 examine(): dtmcontrol is 0. Check JTAG connectivity/board power.
Debug: 250 27 openocd.c:155 handle_init_command(): target examination failed
Debug: 251 27 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_flash init
Debug: 252 27 command.c:143 script_debug(): command - ocd_flash ocd_flash init
Debug: 254 27 tcl.c:1166 handle_flash_init_command(): Initializing flash devices...
Debug: 255 27 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_mflash init
Debug: 256 27 command.c:143 script_debug(): command - ocd_mflash ocd_mflash init
Debug: 258 27 mflash.c:1377 handle_mflash_init_command(): Initializing mflash devices...
Debug: 259 27 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_nand init
Debug: 260 27 command.c:143 script_debug(): command - ocd_nand ocd_nand init
Debug: 262 27 tcl.c:497 handle_nand_init_command(): Initializing NAND devices...
Debug: 263 27 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_pld init
Debug: 264 27 command.c:143 script_debug(): command - ocd_pld ocd_pld init
Debug: 266 27 pld.c:205 handle_pld_init_command(): Initializing PLDs...
Info : 267 27 server.c:307 add_service(): Listening on port 3333 for gdb connections

That is the output I get from the OpenOCD initialization. I’m not sure what version we are using for the debug implementation. Out HW designer forked from master in December I believe, and if there haven’t been any big updates on mainline, I doubt were severely behind.

As you can see, the target wasn’t successfully examined, so everything after this (including the GDB connection) is unlikely to succeed. It looks like your DTM is improperly reporting 0 for DTM control, so you’re failing at a very early stage. You should check your DTM JTAG state machine and figure out why it is returning 0s on TDO.

There have been many bug fixes to OpenOCD since December (assuming that’s what you’re talking about forking, vs the HW), though unlikely to affect this failure mode.

So I disconnected and reconnected the FTDI MiniModule from the computer and tried to run OpenOCD again. This is the regular output I got:

Open On-Chip Debugger 0.10.0+dev-00129-gfd9de02 (2018-03-09-11:38)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
adapter speed: 10000 kHz
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
Ready for Remote Connections..
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Error: libusb_open() failed with LIBUSB_ERROR_ACCESS
Info : ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling"
Info : clock speed 10000 kHz
Error: JTAG scan chain interrogation failed: all ones
Error: Check JTAG interface, timings, target power, etc.
Error: Trying to use configured scan chain anyway...
Error: riscv.cpu: IR capture error; saw 0x1f not 0x01
Warn : Bypassing JTAG setup events due to errors
Error: Unsupported DTM version: 15
Info : Listening on port 3333 for gdb connections

And this is the same command with the -d flag set:

Open On-Chip Debugger 0.10.0+dev-00129-gfd9de02 (2018-03-09-11:38)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
User : 13 4 command.c:544 command_print(): debug_level: 3
Debug: 14 4 options.c:184 add_default_dirs(): bindir=/usr/local/bin
Debug: 15 4 options.c:185 add_default_dirs(): pkgdatadir=/usr/local/share/openocd
Debug: 16 4 options.c:186 add_default_dirs(): exepath=/usr/local/bin
Debug: 17 4 options.c:187 add_default_dirs(): bin2data=../share/openocd
Debug: 18 4 configuration.c:42 add_script_search_dir(): adding /home/sgutierrez/.openocd
Debug: 19 4 configuration.c:42 add_script_search_dir(): adding /usr/local/bin/../share/openocd/site
Debug: 20 4 configuration.c:42 add_script_search_dir(): adding /usr/local/bin/../share/openocd/scripts
Debug: 21 4 configuration.c:82 find_file(): found /usr/local/bin/../share/openocd/scripts/interface/ftdi/minimodule.cfg
Debug: 22 4 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_interface ftdi
Debug: 23 4 command.c:143 script_debug(): command - interface ocd_interface ftdi
Debug: 25 4 command.c:364 register_command_handler(): registering 'ocd_ftdi_device_desc'...
Debug: 26 4 command.c:364 register_command_handler(): registering 'ocd_ftdi_serial'...
Debug: 27 4 command.c:364 register_command_handler(): registering 'ocd_ftdi_location'...
Debug: 28 4 command.c:364 register_command_handler(): registering 'ocd_ftdi_channel'...
Debug: 29 4 command.c:364 register_command_handler(): registering 'ocd_ftdi_layout_init'...
Debug: 30 4 command.c:364 register_command_handler(): registering 'ocd_ftdi_layout_signal'...
Debug: 31 4 command.c:364 register_command_handler(): registering 'ocd_ftdi_set_signal'...
Debug: 32 4 command.c:364 register_command_handler(): registering 'ocd_ftdi_get_signal'...
Debug: 33 4 command.c:364 register_command_handler(): registering 'ocd_ftdi_vid_pid'...
Debug: 34 4 command.c:364 register_command_handler(): registering 'ocd_ftdi_tdo_sample_edge'...
Debug: 35 4 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_ftdi_device_desc FT2232H MiniModule
Debug: 36 4 command.c:143 script_debug(): command - ftdi_device_desc ocd_ftdi_device_desc FT2232H MiniModule
Debug: 38 4 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_ftdi_vid_pid 0x0403 0x6010
Debug: 39 5 command.c:143 script_debug(): command - ftdi_vid_pid ocd_ftdi_vid_pid 0x0403 0x6010
Debug: 41 5 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_ftdi_layout_init 0x0008 0x000b
Debug: 42 5 command.c:143 script_debug(): command - ftdi_layout_init ocd_ftdi_layout_init 0x0008 0x000b
Debug: 44 5 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_ftdi_layout_signal nSRST -data 0x0020 -oe 0x0020
Debug: 45 5 command.c:143 script_debug(): command - ftdi_layout_signal ocd_ftdi_layout_signal nSRST -data 0x0020 -oe 0x0020
Debug: 47 5 configuration.c:82 find_file(): found viarocket_board.cfg
Debug: 48 5 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_adapter_khz 10000
Debug: 49 5 command.c:143 script_debug(): command - adapter_khz ocd_adapter_khz 10000
Debug: 51 5 core.c:1693 jtag_config_khz(): handle jtag khz
Debug: 52 5 core.c:1660 adapter_khz_to_speed(): convert khz to interface specific speed value
Debug: 53 5 core.c:1660 adapter_khz_to_speed(): convert khz to interface specific speed value
User : 54 5 command.c:544 command_print(): adapter speed: 10000 kHz
Debug: 55 5 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_transport select
Debug: 56 5 command.c:143 script_debug(): command - ocd_transport ocd_transport select
Info : 57 5 transport.c:286 jim_transport_select(): auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
Debug: 58 5 command.c:364 register_command_handler(): registering 'ocd_jtag_flush_queue_sleep'...
Debug: 59 5 command.c:364 register_command_handler(): registering 'ocd_jtag_rclk'...
Debug: 60 5 command.c:364 register_command_handler(): registering 'ocd_jtag_ntrst_delay'...
Debug: 61 5 command.c:364 register_command_handler(): registering 'ocd_jtag_ntrst_assert_width'...
Debug: 62 5 command.c:364 register_command_handler(): registering 'ocd_scan_chain'...
Debug: 63 5 command.c:364 register_command_handler(): registering 'ocd_jtag_reset'...
Debug: 64 5 command.c:364 register_command_handler(): registering 'ocd_runtest'...
Debug: 65 5 command.c:364 register_command_handler(): registering 'ocd_irscan'...
Debug: 66 5 command.c:364 register_command_handler(): registering 'ocd_verify_ircapture'...
Debug: 67 5 command.c:364 register_command_handler(): registering 'ocd_verify_jtag'...
Debug: 68 5 command.c:364 register_command_handler(): registering 'ocd_tms_sequence'...
Debug: 69 5 command.c:364 register_command_handler(): registering 'ocd_wait_srst_deassert'...
Debug: 70 5 command.c:364 register_command_handler(): registering 'ocd_jtag'...
Debug: 71 5 command.c:364 register_command_handler(): registering 'ocd_jtag'...
Debug: 72 5 command.c:364 register_command_handler(): registering 'ocd_jtag'...
Debug: 73 5 command.c:364 register_command_handler(): registering 'ocd_jtag'...
Debug: 74 5 command.c:364 register_command_handler(): registering 'ocd_jtag'...
Debug: 75 5 command.c:364 register_command_handler(): registering 'ocd_jtag'...
Debug: 76 6 command.c:364 register_command_handler(): registering 'ocd_jtag'...
Debug: 77 6 command.c:364 register_command_handler(): registering 'ocd_jtag'...
Debug: 78 6 command.c:364 register_command_handler(): registering 'ocd_jtag'...
Debug: 79 6 command.c:364 register_command_handler(): registering 'ocd_jtag'...
Debug: 80 6 command.c:364 register_command_handler(): registering 'ocd_jtag'...
Debug: 81 6 command.c:364 register_command_handler(): registering 'ocd_jtag'...
Debug: 82 6 command.c:364 register_command_handler(): registering 'ocd_jtag'...
Debug: 83 6 command.c:364 register_command_handler(): registering 'ocd_svf'...
Debug: 84 6 command.c:364 register_command_handler(): registering 'ocd_xsvf'...
Debug: 85 6 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_transport select
Debug: 86 6 command.c:143 script_debug(): command - ocd_transport ocd_transport select
Debug: 87 6 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_jtag newtap riscv cpu -irlen 5
Debug: 88 6 command.c:143 script_debug(): command - ocd_jtag ocd_jtag newtap riscv cpu -irlen 5
Debug: 89 6 tcl.c:549 jim_newtap_cmd(): Creating New Tap, Chip: riscv, Tap: cpu, Dotted: riscv.cpu, 2 params
Debug: 90 6 tcl.c:573 jim_newtap_cmd(): Processing option: -irlen
Debug: 91 6 core.c:1366 jtag_tap_init(): Created Tap: riscv.cpu @ abs position 0, irlen 5, capture: 0x1 mask: 0x3
Debug: 92 6 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_target create riscv.cpu riscv -chain-position riscv.cpu
Debug: 93 6 command.c:143 script_debug(): command - ocd_target ocd_target create riscv.cpu riscv -chain-position riscv.cpu
Debug: 94 6 target.c:1905 target_free_all_working_areas_restore(): freeing all working areas
Debug: 95 6 command.c:364 register_command_handler(): registering 'ocd_riscv'...
Debug: 96 6 command.c:364 register_command_handler(): registering 'ocd_riscv'...
Debug: 97 6 command.c:364 register_command_handler(): registering 'ocd_riscv'...
Debug: 98 6 command.c:364 register_command_handler(): registering 'ocd_riscv'...
Debug: 99 6 command.c:364 register_command_handler(): registering 'ocd_riscv'...
Debug: 100 6 command.c:364 register_command_handler(): registering 'ocd_riscv'...
Debug: 101 6 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 102 6 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 103 6 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 104 6 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 105 6 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 106 6 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 107 6 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 108 6 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 109 6 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 110 6 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 111 6 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 112 7 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 113 7 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 114 7 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 115 7 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 116 7 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 117 7 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 118 7 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 119 7 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 120 7 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 121 7 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 122 7 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 123 7 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 124 7 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 125 7 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 126 7 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 127 7 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 128 7 command.c:364 register_command_handler(): registering 'ocd_riscv.cpu'...
Debug: 129 7 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_riscv set_reset_timeout_sec 120
Debug: 130 7 command.c:143 script_debug(): command - ocd_riscv ocd_riscv set_reset_timeout_sec 120
Debug: 132 7 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_riscv set_command_timeout_sec 120
Debug: 133 7 command.c:143 script_debug(): command - ocd_riscv ocd_riscv set_command_timeout_sec 120
Debug: 135 7 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_echo Ready for Remote Connections..
Debug: 136 7 command.c:143 script_debug(): command - echo ocd_echo Ready for Remote Connections..
User : 138 7 command.c:762 jim_echo(): Ready for Remote Connections..
Info : 139 7 server.c:307 add_service(): Listening on port 6666 for tcl connections
Info : 140 7 server.c:307 add_service(): Listening on port 4444 for telnet connections
Debug: 141 7 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_init
Debug: 142 7 command.c:143 script_debug(): command - init ocd_init
Debug: 144 7 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_target init
Debug: 145 7 command.c:143 script_debug(): command - ocd_target ocd_target init
Debug: 147 7 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_target names
Debug: 148 8 command.c:143 script_debug(): command - ocd_target ocd_target names
Debug: 149 8 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_riscv.cpu cget -event gdb-flash-erase-start
Debug: 150 8 command.c:143 script_debug(): command - ocd_riscv.cpu ocd_riscv.cpu cget -event gdb-flash-erase-start
Debug: 151 8 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_riscv.cpu configure -event gdb-flash-erase-start reset init
Debug: 152 8 command.c:143 script_debug(): command - ocd_riscv.cpu ocd_riscv.cpu configure -event gdb-flash-erase-start reset init
Debug: 153 8 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_riscv.cpu cget -event gdb-flash-write-end
Debug: 154 8 command.c:143 script_debug(): command - ocd_riscv.cpu ocd_riscv.cpu cget -event gdb-flash-write-end
Debug: 155 8 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_riscv.cpu configure -event gdb-flash-write-end reset halt
Debug: 156 8 command.c:143 script_debug(): command - ocd_riscv.cpu ocd_riscv.cpu configure -event gdb-flash-write-end reset halt
Debug: 157 8 target.c:1329 handle_target_init_command(): Initializing targets...
Debug: 158 8 riscv.c:247 riscv_init_target(): riscv_init_target()
Debug: 159 10 command.c:364 register_command_handler(): registering 'ocd_target_request'...
Debug: 160 10 command.c:364 register_command_handler(): registering 'ocd_trace'...
Debug: 161 10 command.c:364 register_command_handler(): registering 'ocd_trace'...
Debug: 162 10 command.c:364 register_command_handler(): registering 'ocd_fast_load_image'...
Debug: 163 10 command.c:364 register_command_handler(): registering 'ocd_fast_load'...
Debug: 164 10 command.c:364 register_command_handler(): registering 'ocd_profile'...
Debug: 165 10 command.c:364 register_command_handler(): registering 'ocd_virt2phys'...
Debug: 166 10 command.c:364 register_command_handler(): registering 'ocd_reg'...
Debug: 167 10 command.c:364 register_command_handler(): registering 'ocd_poll'...
Debug: 168 10 command.c:364 register_command_handler(): registering 'ocd_wait_halt'...
Debug: 169 10 command.c:364 register_command_handler(): registering 'ocd_halt'...
Debug: 170 10 command.c:364 register_command_handler(): registering 'ocd_resume'...
Debug: 171 10 command.c:364 register_command_handler(): registering 'ocd_reset'...
Debug: 172 10 command.c:364 register_command_handler(): registering 'ocd_soft_reset_halt'...
Debug: 173 10 command.c:364 register_command_handler(): registering 'ocd_step'...
Debug: 174 10 command.c:364 register_command_handler(): registering 'ocd_mdd'...
Debug: 175 10 command.c:364 register_command_handler(): registering 'ocd_mdw'...
Debug: 176 10 command.c:364 register_command_handler(): registering 'ocd_mdh'...
Debug: 177 10 command.c:364 register_command_handler(): registering 'ocd_mdb'...
Debug: 178 10 command.c:364 register_command_handler(): registering 'ocd_mwd'...
Debug: 179 10 command.c:364 register_command_handler(): registering 'ocd_mww'...
Debug: 180 10 command.c:364 register_command_handler(): registering 'ocd_mwh'...
Debug: 181 10 command.c:364 register_command_handler(): registering 'ocd_mwb'...
Debug: 182 10 command.c:364 register_command_handler(): registering 'ocd_bp'...
Debug: 183 10 command.c:364 register_command_handler(): registering 'ocd_rbp'...
Debug: 184 10 command.c:364 register_command_handler(): registering 'ocd_wp'...
Debug: 185 10 command.c:364 register_command_handler(): registering 'ocd_rwp'...
Debug: 186 10 command.c:364 register_command_handler(): registering 'ocd_load_image'...
Debug: 187 10 command.c:364 register_command_handler(): registering 'ocd_dump_image'...
Debug: 188 10 command.c:364 register_command_handler(): registering 'ocd_verify_image_checksum'...
Debug: 189 10 command.c:364 register_command_handler(): registering 'ocd_verify_image'...
Debug: 190 10 command.c:364 register_command_handler(): registering 'ocd_test_image'...
Debug: 191 10 command.c:364 register_command_handler(): registering 'ocd_reset_nag'...
Debug: 192 10 command.c:364 register_command_handler(): registering 'ocd_ps'...
Debug: 193 10 command.c:364 register_command_handler(): registering 'ocd_test_mem_access'...
Debug: 194 10 ftdi.c:657 ftdi_initialize(): ftdi interface using shortest path jtag state transitions
Error: 195 21 mpsse.c:193 open_matching_device(): libusb_open() failed with LIBUSB_ERROR_ACCESS
Debug: 196 24 mpsse.c:422 mpsse_purge(): -
Debug: 197 24 mpsse.c:703 mpsse_loopback_config(): off
Debug: 198 24 mpsse.c:748 mpsse_set_frequency(): target 10000000 Hz
Debug: 199 24 mpsse.c:740 mpsse_rtck_config(): off
Debug: 200 24 mpsse.c:729 mpsse_divide_by_5_config(): off
Debug: 201 24 mpsse.c:709 mpsse_set_divisor(): 2
Debug: 202 24 mpsse.c:772 mpsse_set_frequency(): actually 10000000 Hz
Debug: 203 25 core.c:1660 adapter_khz_to_speed(): convert khz to interface specific speed value
Debug: 204 25 core.c:1663 adapter_khz_to_speed(): have interface set up
Debug: 205 25 mpsse.c:748 mpsse_set_frequency(): target 10000000 Hz
Debug: 206 25 mpsse.c:740 mpsse_rtck_config(): off
Debug: 207 25 mpsse.c:729 mpsse_divide_by_5_config(): off
Debug: 208 25 mpsse.c:709 mpsse_set_divisor(): 2
Debug: 209 25 mpsse.c:772 mpsse_set_frequency(): actually 10000000 Hz
Info : 210 25 ftdi.c:291 ftdi_speed(): ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling"
Debug: 211 25 core.c:1660 adapter_khz_to_speed(): convert khz to interface specific speed value
Debug: 212 25 core.c:1663 adapter_khz_to_speed(): have interface set up
Info : 213 25 core.c:1448 adapter_init(): clock speed 10000 kHz
Debug: 214 25 openocd.c:140 handle_init_command(): Debug Adapter init complete
Debug: 215 25 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_transport init
Debug: 216 25 command.c:143 script_debug(): command - ocd_transport ocd_transport init
Debug: 218 25 transport.c:239 handle_transport_init(): handle_transport_init
Debug: 219 25 core.c:729 jtag_add_reset(): SRST line released
Debug: 220 25 core.c:753 jtag_add_reset(): TRST line released
Debug: 221 25 core.c:327 jtag_call_event_callbacks(): jtag event: TAP reset
Debug: 222 25 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_jtag arp_init
Debug: 223 25 command.c:143 script_debug(): command - ocd_jtag ocd_jtag arp_init
Debug: 224 25 core.c:1461 jtag_init_inner(): Init JTAG chain
Debug: 225 25 core.c:327 jtag_call_event_callbacks(): jtag event: TAP reset
Debug: 226 25 core.c:1121 jtag_examine_chain(): DR scan interrogation for IDCODE/BYPASS
Debug: 227 25 core.c:327 jtag_call_event_callbacks(): jtag event: TAP reset
Error: 228 26 core.c:1010 jtag_examine_chain_check(): JTAG scan chain interrogation failed: all ones
Error: 229 26 core.c:1011 jtag_examine_chain_check(): Check JTAG interface, timings, target power, etc.
Error: 230 26 core.c:1506 jtag_init_inner(): Trying to use configured scan chain anyway...
Debug: 231 26 core.c:1252 jtag_validate_ircapture(): IR capture validation scan
Error: 232 26 core.c:1304 jtag_validate_ircapture(): riscv.cpu: IR capture error; saw 0x1f not 0x01
Debug: 233 26 core.c:327 jtag_call_event_callbacks(): jtag event: TAP reset
Warn : 234 26 core.c:1529 jtag_init_inner(): Bypassing JTAG setup events due to errors
Debug: 235 26 openocd.c:153 handle_init_command(): Examining targets...
Debug: 236 26 target.c:1515 target_call_event_callbacks(): target event 17 (examine-start)
Debug: 237 26 riscv.c:654 riscv_examine(): riscv_examine()
Debug: 238 26 riscv.c:224 dtmcontrol_scan(): DTMCONTROL: 0x0 -> 0xffffffff
Debug: 239 26 riscv.c:664 riscv_examine(): dtmcontrol=0xffffffff
Debug: 240 26 riscv.c:666 riscv_examine():   version=0xf
Error: 241 26 riscv.c:239 get_target_type(): Unsupported DTM version: 15
Debug: 242 26 openocd.c:155 handle_init_command(): target examination failed
Debug: 243 26 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_flash init
Debug: 244 26 command.c:143 script_debug(): command - ocd_flash ocd_flash init
Debug: 246 26 tcl.c:1166 handle_flash_init_command(): Initializing flash devices...
Debug: 247 26 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_mflash init
Debug: 248 26 command.c:143 script_debug(): command - ocd_mflash ocd_mflash init
Debug: 250 26 mflash.c:1377 handle_mflash_init_command(): Initializing mflash devices...
Debug: 251 26 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_nand init
Debug: 252 26 command.c:143 script_debug(): command - ocd_nand ocd_nand init
Debug: 254 26 tcl.c:497 handle_nand_init_command(): Initializing NAND devices...
Debug: 255 26 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_pld init
Debug: 256 27 command.c:143 script_debug(): command - ocd_pld ocd_pld init
Debug: 258 27 pld.c:205 handle_pld_init_command(): Initializing PLDs...
Info : 259 27 server.c:307 add_service(): Listening on port 3333 for gdb connections

I’m a bit confused as to how to proceed from here. I can see that it is complaining about the DTM but there are also other errors before then. Would you say this is an issue with OpenOCD or the Hardware design running on the FPGA?

So I got OpenOCD to start without the errors.

Open On-Chip Debugger 0.10.0+dev-00129-gfd9de02 (2018-03-12-14:20)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
adapter speed: 1000 kHz
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
Ready for Remote Connections..
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Error: libusb_open() failed with LIBUSB_ERROR_ACCESS
Info : clock speed 1000 kHz
Info : JTAG tap: riscv.cpu tap/device found: 0x000001c7 (mfg: 0x0e3 (MGV Memory), part: 0x0000, ver: 0x0)
Info : datacount=2 progbufsize=16
Info : Disabling abstract command reads from CSRs.
Info : Disabling abstract command writes to CSRs.
Info : [0] Found 1 triggers
Info : Examined RISC-V core; found 1 harts
Info :  hart 0: XLEN=64, 1 triggers
Info : Listening on port 3333 for gdb connections

Problem now is that it still doesn’t keep the GDB connection alive. This is what OpenOCD prints out when trying to connect.

Info : accepting 'gdb' connection on tcp/3333
undefined debug reason 7 - target needs reset
Info : dropped 'gdb' connection

And this is what gets printed out on the GDB client.

warning: Target-supplied registers are not supported by the current architecture
warning: No executable has been specified and target does not support
determining executable automatically.  Try using the "file" command.
Remote failure reply: E0E

Perhaps I don’t have the latest version of the RISCV GDB client?
EDIT: When run with the -d flag set, I can see that OpenOCD keeps doing these commands over and over again:

Debug: 7292 46491 riscv.c:990 riscv_openocd_poll(): polling all harts
Debug: 7293 46491 riscv.c:1602 riscv_set_current_hartid(): setting hartid to 0, was 0
Debug: 7294 46491 riscv-013.c:359 scan(): 41b r 00000000 @10 -> + 00000000 @00
Debug: 7295 46491 riscv-013.c:359 scan(): 41b - 00000000 @10 -> + 00000001 @10
Debug: 7296 46491 riscv-013.c:370 scan():  ->  dmactive
Debug: 7297 46491 riscv-013.c:359 scan(): 41b w 00000001 @10 -> + 00000000 @00
Debug: 7298 46491 riscv-013.c:370 scan():  dmactive ->
Debug: 7299 46492 riscv-013.c:359 scan(): 41b - 00000000 @10 -> + 00000001 @10
Debug: 7300 46492 riscv-013.c:370 scan():  ->  dmactive
Debug: 7301 46492 riscv.c:974 riscv_poll_hart(): polling hart 0, target->state=1 (TARGET_HALTED=2)
Debug: 7302 46492 riscv-013.c:359 scan(): 41b r 00000000 @11 -> + 00000000 @00
Debug: 7303 46492 riscv-013.c:359 scan(): 41b - 00000000 @11 -> + 000f0c82 @11
Debug: 7304 46492 riscv-013.c:370 scan():  ->  allresumeack anyresumeack allrunning anyrunning authenticated version=2

EDIT 2: Got it working, when OpenOCD connects to the target it doesn’t reset it, so the processor keeps running. Need to reset it using the OpenOCD Telnet server before connecting with GDB.

Hi Santi,

I know it’s been a while since you posted your last reply, but I’m trying to connect to a Pulpino core (RISC-V) loaded on an FPGA, using OpenOCD though a digilent HS2 cable and I’m running into the same issue you had, at least I get the same error:
"dtmcontrol is 0. Check JTAG connectivity/board power"
and then I can’t reset the target without OpenOCD quitting with “dmi_scan: Assertion `info->abits != 0’ failed.”

Do you by any chance remember how you got OpenOCD to start without errors?

I really hope you can help me, I’ve been scratching my head on this one for days.