OPENOCD error

What is this error??
I am getting this error often after running my code via OpenOCD launch.

But my HiFive board is connected and working fine.
When i hit the reset button on the board it runs the previous code and displays the output in the Terminal.

@bruce @jackckang @castelloDev @erasmussen1 please answer me.

What error?

Open On-Chip Debugger 0.10.0+dev (SiFive OpenOCD 0.10.0-2019.08.2)
Licensed under GNU GPL v2
For bug reports:


debug_level: 0
adapter speed: 10000 kHz
Error: Timed out waiting for debug int to clear.Increase timeout with riscv set_command_timeout_sec.
Error: Debug interrupt didn’t clear.
Error: Debug RAM 0x0: 0xfff04493
Error: Debug RAM 0x1: 0x01f4d493
Error: Debug RAM 0x2: 0x40902023
Error: Debug RAM 0x3: 0x01f4d493
Error: Debug RAM 0x4: 0x40902223
Error: Debug RAM 0x5: 0x3f00006f
Error: Debug RAM 0x6: 0x060c1218
Error: Debug RAM 0x7: 0xf5dffff3
Error: Debug RAM 0x8: 0x00000000
Error: Debug RAM 0x9: 0x00000000
Error: Debug RAM 0xa: 0x00000000
Error: Debug RAM 0xb: 0x00000000
Error: Debug RAM 0xc: 0x00000000
Error: Debug RAM 0xd: 0x00000000
Error: Debug RAM 0xe: 0x00000000
Error: Debug RAM 0xf: 0x00000000
Error: Failed to discover xlen; word0=0xfff04493, word1=0x1f4d493, exception=0x60c1218
Error: Debug RAM 0x0: 0xfff04493
Error: Debug RAM 0x1: 0x01f4d493
Error: Debug RAM 0x2: 0x40902023
Error: Debug RAM 0x3: 0x01f4d493
Error: Debug RAM 0x4: 0x40902223
Error: Debug RAM 0x5: 0x3f00006f
Error: Debug RAM 0x6: 0x060c1218
Error: Debug RAM 0x7: 0xf5dffff3
Error: Debug RAM 0x8: 0x00000000
Error: Debug RAM 0x9: 0x00000000
Error: Debug RAM 0xa: 0x00000000
Error: Debug RAM 0xb: 0x00000000
Error: Debug RAM 0xc: 0x00000000
Error: Debug RAM 0xd: 0x00000000
Error: Debug RAM 0xe: 0x00000000
Error: Debug RAM 0xf: 0x00000000
Error: Target not examined yet

This is the error can u please resolve it.

The board is connected to the computer and when i reset the board it gives the previous code output in the terminal.

Can you run OpenOCD with -d, collect the full output, and attach it here? It sounds like a connectivity issue, although the error message you pasted doesn’t really give me enough information to tell for sure.

This is the error I am getting:

Open On-Chip Debugger 0.10.0+dev (SiFive OpenOCD 0.10.0-2019.08.2)
Licensed under GNU GPL v2
For bug reports:
https://github.com/sifive/freedom-tools/issues
debug_level: 0
adapter speed: 10000 kHz
Error: Timed out waiting for debug int to clear.Increase timeout with riscv set_command_timeout_sec.
Error: Debug interrupt didn’t clear.
Error: Debug RAM 0x0: 0xfff04493
Error: Debug RAM 0x1: 0x01f4d493
Error: Debug RAM 0x2: 0x40902023
Error: Debug RAM 0x3: 0x01f4d493
Error: Debug RAM 0x4: 0x40902223
Error: Debug RAM 0x5: 0x3f00006f
Error: Debug RAM 0x6: 0x060c1218
Error: Debug RAM 0x7: 0xf5dffff3
Error: Debug RAM 0x8: 0x00000000
Error: Debug RAM 0x9: 0x00000000
Error: Debug RAM 0xa: 0x00000000
Error: Debug RAM 0xb: 0x00000000
Error: Debug RAM 0xc: 0x00000000
Error: Debug RAM 0xd: 0x00000000
Error: Debug RAM 0xe: 0x00000000
Error: Debug RAM 0xf: 0x00000000
Error: Failed to discover xlen; word0=0xfff04493, word1=0x1f4d493, exception=0x60c1218
Error: Debug RAM 0x0: 0xfff04493
Error: Debug RAM 0x1: 0x01f4d493
Error: Debug RAM 0x2: 0x40902023
Error: Debug RAM 0x3: 0x01f4d493
Error: Debug RAM 0x4: 0x40902223
Error: Debug RAM 0x5: 0x3f00006f
Error: Debug RAM 0x6: 0x060c1218
Error: Debug RAM 0x7: 0xf5dffff3
Error: Debug RAM 0x8: 0x00000000
Error: Debug RAM 0x9: 0x00000000
Error: Debug RAM 0xa: 0x00000000
Error: Debug RAM 0xb: 0x00000000
Error: Debug RAM 0xc: 0x00000000
Error: Debug RAM 0xd: 0x00000000
Error: Debug RAM 0xe: 0x00000000
Error: Debug RAM 0xf: 0x00000000
Error: Target not examined yet

for this program:

/* Copyright 2019 SiFive, Inc /
/
SPDX-License-Identifier: Apache-2.0 */
#include <stdio.h>
int main() {
printf(“Hello, World!\n”);
return 22;
}

I have attached the screen shot for your reference, below

The Terminal displays the previous flashed code (example of SPI), the program stops after printing the first line.

Even though i give return 0 instead of return 22 i get the same error

I tried this code with the same cable and same board HiFive1 but with arduino IDE
I get the following error

Arduino: 1.8.10 (Windows 10), Board: “HiFive 1, Default, ~320 MHz HFROSC+PLL”

Sketch uses 5260 bytes (0%) of program storage space. Maximum is 8388608 bytes.
Open On-Chip Debugger 0.10.0+dev-gdd0dd7f64e03-dirty (2018-01-09-17:24)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
debug_level: 0
adapter speed: 10000 kHz
Error: Timed out waiting for debug int to clear.Increase timeout with riscv set_command_timeout_sec.
Error: Debug interrupt didn’t clear.
Error: Debug interrupt didn’t clear.

Error: Debug RAM 0x0: 0xfff04493
Error: Debug RAM 0x1: 0x01f4d493
Error: Debug RAM 0x2: 0x40902023
Error: Debug RAM 0x3: 0x01f4d493
Error: Debug RAM 0x4: 0x40902223
Error: Debug RAM 0x5: 0x3f00006f
Error: Debug RAM 0x6: 0x060c1218
Error: Debug RAM 0x7: 0xf5dffff3
Error: Debug RAM 0x8: 0x00000000
Error: Debug RAM 0x9: 0x00000000
Error: Debug RAM 0xa: 0x00000000
Error: Debug RAM 0xb: 0x00000000
Error: Debug RAM 0xc: 0x00000000
Error: Debug RAM 0xd: 0x00000000
Error: Debug RAM 0xe: 0x00000000
Error: Debug RAM 0xf: 0x00000000
Error: Failed to discover xlen; word0=0xfff04493, word1=0x1f4d493, exception=0x60c1218
Error: Debug RAM 0x0: 0xfff04493
Error: Debug RAM 0x1: 0x01f4d493
Error: Debug RAM 0x2: 0x40902023
Error: Debug RAM 0x3: 0x01f4d493
Error: Debug RAM 0x4: 0x40902223
Error: Debug RAM 0x5: 0x3f00006f
Error: Debug RAM 0x6: 0x060c1218
Error: Debug RAM 0x7: 0xf5dffff3
Error: Debug RAM 0x8: 0x00000000
Error: Debug RAM 0x9: 0x00000000
Error: Debug RAM 0xa: 0x00000000
Error: Debug RAM 0xb: 0x00000000
Error: Debug RAM 0xc: 0x00000000
Error: Debug RAM 0xd: 0x00000000
Error: Debug RAM 0xe: 0x00000000
Error: Debug RAM 0xf: 0x00000000
Error: Target not examined yet

This report would have more information with
“Show verbose output during compilation”
option enabled in File -> Preferences.

The code i used is in picture i attached as follows,

When i upload the example code RGB led Blink,
I get the following error

Arduino: 1.8.10 (Windows 10), Board: “HiFive 1, Default, ~320 MHz HFROSC+PLL”

Sketch uses 3886 bytes (0%) of program storage space. Maximum is 8388608 bytes.
Open On-Chip Debugger 0.10.0+dev-gdd0dd7f64e03-dirty (2018-01-09-17:24)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
debug_level: 0
adapter speed: 10000 kHz
Error: Timed out waiting for debug int to clear.Increase timeout with riscv set_command_timeout_sec.
Error: Debug interrupt didn’t clear.
Error: Debug RAM 0x0: 0xfff04493
Error: Debug RAM 0x1: 0x01f4d493
Error: Debug RAM 0x2: 0x40902023
Error: Debug RAM 0x3: 0x01f4d493
Error: Debug RAM 0x4: 0x40902223
Error: Debug RAM 0x5: 0x3f00006f
Error: Debug RAM 0x6: 0x060c1218
Error: Debug RAM 0x7: 0xf5dffff3
Error: Debug RAM 0x8: 0x00000000
Error: Debug RAM 0x9: 0x00000000
Error: Debug RAM 0xa: 0x00000000
Error: Debug RAM 0xb: 0x00000000
Error: Debug RAM 0xc: 0x00000000
Error: Debug RAM 0xd: 0x00000000
Error: Debug RAM 0xe: 0x00000000
Error: Debug RAM 0xf: 0x00000000
Error: Timed out waiting for debug int to clear.Increase timeout with riscv set_command_timeout_sec.
Error: Debug interrupt didn’t clear.
Error: Debug interrupt didn’t clear.

Error: Debug RAM 0x0: 0xfff04493
Error: Debug RAM 0x1: 0x01f4d493
Error: Debug RAM 0x2: 0x40902023
Error: Debug RAM 0x3: 0x01f4d493
Error: Debug RAM 0x4: 0x40902223
Error: Debug RAM 0x5: 0x3f00006f
Error: Debug RAM 0x6: 0x060c1218
Error: Debug RAM 0x7: 0xf5dffff3
Error: Debug RAM 0x8: 0x00000000
Error: Debug RAM 0x9: 0x00000000
Error: Debug RAM 0xa: 0x00000000
Error: Debug RAM 0xb: 0x00000000
Error: Debug RAM 0xc: 0x00000000
Error: Debug RAM 0xd: 0x00000000
Error: Debug RAM 0xe: 0x00000000
Error: Debug RAM 0xf: 0x00000000
Error: Failed to discover xlen; word0=0xfff04493, word1=0x1f4d493, exception=0x60c1218
Error: Debug RAM 0x0: 0xfff04493
Error: Debug RAM 0x1: 0x01f4d493
Error: Debug RAM 0x2: 0x40902023
Error: Debug RAM 0x3: 0x01f4d493
Error: Debug RAM 0x4: 0x40902223
Error: Debug RAM 0x5: 0x3f00006f
Error: Debug RAM 0x6: 0x060c1218
Error: Debug RAM 0x7: 0xf5dffff3
Error: Debug RAM 0x8: 0x00000000
Error: Debug RAM 0x9: 0x00000000
Error: Debug RAM 0xa: 0x00000000
Error: Debug RAM 0xb: 0x00000000
Error: Debug RAM 0xc: 0x00000000
Error: Debug RAM 0xd: 0x00000000
Error: Debug RAM 0xe: 0x00000000
Error: Debug RAM 0xf: 0x00000000
Error: Target not examined yet

This report would have more information with
“Show verbose output during compilation”
option enabled in File -> Preferences.

The code i used is

/*
Example of the HiFive1 builtin RGB LED blinking with RGBL library.

On HiFive1 the RGB LED is connected to the following GPIOs:
Red - GPIO6
Green - GPIO3
Blue - GPIO5

This example code is in the public domain.

By Michael Zaidman michael.zaidman@wdc.com, 2018
*/

#include <RGBL.h>

RGBL led;

void setup() {
led.offAll();
}

void loop() {
led.blink(RED, 1000);
led.blink(GREEN, 1000);
led.blink(BLUE, 1000);
}

Nobody found the problem ?
I get the same errors on my HiFive1 Rev A01.
I flashed «hello_world» zephyr program successfully first :

$ west init ~/zephyrhifive
$ cd ~/zephyrhifive
$ west update
$ cd ~/zephyrhifive/zephyr
$ west build -b hifive1 samples/hello_world

Flashed with following command :

$ west flash
 -- west flash: rebuilding
 ninja: no work to do.
 -- west flash: using runner hifive1
 Open On-Chip Debugger 0.10.0+dev-01508-gf79c90268-dirty (2021-03-26-16:13)
 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 '.
 Info : ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling"
 Info : clock speed 10000 kHz
 Info : JTAG tap: riscv.cpu tap/device found: 0x10e31913 (mfg: 0x489 (SiFive, Inc.), part: 0x0e31, ver: 0x1)
 Info : Examined RISCV core; XLEN=32, misa=0x40001105
 Info : starting gdb server for riscv.cpu on 3333
 Info : Listening on port 3333 for gdb connections
 Info : [0] Found 2 triggers
 halted at 0x2040019c due to debug interrupt
 Info : Found flash device 'issi is25lp128d' (ID 0x0018609d)
 Info : Listening on port 6666 for tcl connections
 Info : Listening on port 4444 for telnet connections
 Info : accepting 'gdb' connection on tcp/3333
 Info : JTAG tap: riscv.cpu tap/device found: 0x10e31913 (mfg: 0x489 (SiFive, Inc.), part: 0x0e31, ver: 0x1)
 halted at 0x2040019c due to debug interrupt
 force hard breakpoints
 0x2040019c in skip_callee_saved_reg () at /home/fabien/zephyrhifive/zephyr/arch/riscv/core/isr.S:886
 886        LOAD_CALLER_SAVED(t1)
 Info : JTAG tap: riscv.cpu tap/device found: 0x10e31913 (mfg: 0x489 (SiFive, Inc.), part: 0x0e31, ver: 0x1)
 halted at 0x2040019c due to debug interrupt
 Loading section vector, size 0x10 lma 0x20400000
 Loading section exceptions, size 0x2b8 lma 0x20400010
 Loading section text, size 0x3fdc lma 0x204002c8
 Loading section initlevel, size 0x50 lma 0x204042a4
 Loading section sw_isr_table, size 0x200 lma 0x204042f4
 Loading section device_handles, size 0x36 lma 0x204044f4
 Loading section rodata, size 0x338 lma 0x2040452c
 Loading section datas, size 0xc0 lma 0x20404864
 Loading section devices, size 0x90 lma 0x20404924
 Info : Padding image section 0 at 0x2040452a with 2 bytes
 Info : Retrying memory read starting from 0x80000000 with more delays
 Info : Retrying memory read starting from 0x800010d8 with more delays
 halted at 0x80000004 due to software breakpoint
 halted at 0x80000004 due to software breakpoint
 halted at 0x80000004 due to software breakpoint
 Info : JTAG tap: riscv.cpu tap/device found: 0x10e31913 (mfg: 0x489 (SiFive, Inc.), part: 0x0e31, ver: 0x1)
 halted at 0x80000004 due to software breakpoint
 Start address 0x20400000, load size 18866
 Transfer rate: 42 KB/sec, 1886 bytes/write.
 A debugging session is active.
 
Inferior 1 [Remote target] will be detached.

 Quit anyway? (y or n) [answered Y; input not from terminal]
 [Inferior 1 (Remote target) detached]
 shutdown command invoked
 Info : dropped 'gdb' connection

But now I can’t flash again any program and I got the same error than Balaji :

$ west flash
-- west flash: rebuilding
ninja: no work to do.
-- west flash: using runner hifive1
Open On-Chip Debugger 0.10.0+dev-01508-gf79c90268-dirty (2021-03-26-16:13)
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 : ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling"
Info : clock speed 10000 kHz
Info : JTAG tap: riscv.cpu tap/device found: 0x10e31913 (mfg: 0x489 (SiFive, Inc.), part: 0x0e31, ver: 0x1)
Error: Timed out waiting for debug int to clear.Increase timeout with riscv set_command_timeout_sec.
Error: Debug interrupt didn't clear.
Error: Debug RAM 0x0: 0xfff04493
Error: Debug RAM 0x1: 0x01f4d493
Error: Debug RAM 0x2: 0x40902023
Error: Debug RAM 0x3: 0x01f4d493
Error: Debug RAM 0x4: 0x40902223
Error: Debug RAM 0x5: 0x3f00006f
Error: Debug RAM 0x6: 0x060c1218
Error: Debug RAM 0x7: 0xfb5dfffe
Error: Debug RAM 0x8: 0x00000000
Error: Debug RAM 0x9: 0x00000000
Error: Debug RAM 0xa: 0x00000000
Error: Debug RAM 0xb: 0x00000000
Error: Debug RAM 0xc: 0x00000000
Error: Debug RAM 0xd: 0x00000000
Error: Debug RAM 0xe: 0x00000000
Error: Debug RAM 0xf: 0x00000000
Error: Failed to discover xlen; word0=0xfff04493, word1=0x1f4d493, exception=0x60c1218
Error: Debug RAM 0x0: 0xfff04493
Error: Debug RAM 0x1: 0x01f4d493
Error: Debug RAM 0x2: 0x40902023
Error: Debug RAM 0x3: 0x01f4d493
Error: Debug RAM 0x4: 0x40902223
Error: Debug RAM 0x5: 0x3f00006f
Error: Debug RAM 0x6: 0x060c1218
Error: Debug RAM 0x7: 0xfb5dfffe
Error: Debug RAM 0x8: 0x00000000
Error: Debug RAM 0x9: 0x00000000
Error: Debug RAM 0xa: 0x00000000
Error: Debug RAM 0xb: 0x00000000
Error: Debug RAM 0xc: 0x00000000
Error: Debug RAM 0xd: 0x00000000
Error: Debug RAM 0xe: 0x00000000
Error: Debug RAM 0xf: 0x00000000
Warn : target riscv.cpu examination failed
Info : starting gdb server for riscv.cpu on 3333
Info : Listening on port 3333 for gdb connections
Error: Target not examined yet

localhost:3333: Connection timed out.
You can't do that when your target is `exec'

I found the problem thanks to dvc.
It seems that hello_world zephyr program goes to wake after printing his hello world message. Then, openocd can’t access flash once sleeping.
To solve it I pushed reset THEN wake button and lauched

west flash

.
\o/