openocd_riscv icon indicating copy to clipboard operation
openocd_riscv copied to clipboard

Error: target 'fpga_spinal.cpu0' init failed

Open ottotto335 opened this issue 1 year ago • 16 comments

Open On-Chip Debugger 0.11.0+dev-04033-g058dfa50d (2023-02-20-09:48) Licensed under GNU GPL v2 For bug reports, read http://openocd.org/doc/doxygen/bugs.html /home/wjc/Desktop/VexRiscv_old/cpu0.yaml DEPRECATED! use 'adapter driver' not 'interface' Info : only one transport option; autoselect 'jtag' DEPRECATED! use 'adapter speed' not 'adapter_khz' DEPRECATED! use 'adapter srst delay' not 'adapter_nsrst_delay' Info : set servers polling period to 50ms Error: target 'fpga_spinal.cpu0' init failed

I try to use eclipse to debug the project "Vexriscv.demo.GenFull" , and set the configuration like https://drive.google.com/open?id=1c46tyEV0xLwOsk76b0y2qqs8CYy7Zq3f, what's wrong with it?

ottotto335 avatar Mar 28 '23 12:03 ottotto335

Hi, what command are you using to run openocd ? which SoC are you targeting, on real hardware ?

Dolu1990 avatar Mar 28 '23 12:03 Dolu1990

-c "set VEXRISCV_YAML /home/vexriscv/Desktop/VexRiscv_old/cpu0.yaml" -f /home/vexriscv/Desktop/openocd_riscv/tcl/target/vexriscv_sim.cfg i want to use verilator,what should I do?

ottotto335 avatar Mar 28 '23 12:03 ottotto335

Are you targeting a simulation ? or real hardware via usb jtag ?

Dolu1990 avatar Mar 29 '23 13:03 Dolu1990

yes i'm targeting a simulation

ottotto335 avatar Apr 04 '23 13:04 ottotto335

Ahhh ok, which simulation testbench are you running exactly ?

Dolu1990 avatar Apr 04 '23 13:04 Dolu1990

#In the VexRiscv repository, to run the simulation on which one OpenOCD can connect itself => sbt "runMain vexriscv.demo.GenFull" cd src/test/cpp/regression make run DEBUG_PLUGIN_EXTERNAL=yes

#In the openocd git, after building it => src/openocd -c "set VEXRISCV_YAML PATH_TO_THE_GENERATED_CPU0_YAML_FILE" -f tcl/target/vexriscv_sim.cfg

#Run a GDB session with an elf RISCV executable (GenFull CPU) YourRiscvToolsPath/bin/riscv32-unknown-elf-gdb VexRiscvRepo/src/test/resources/elf/uart.elf target remote localhost:3333 monitor reset halt load continue

I just follow this example in eclipse, using sbt in terminal to make the "cpu0.yaml" , then set up the configuration in eclipse with the rest of these commands

ottotto335 avatar Apr 05 '23 12:04 ottotto335

Hmm, did you used a absolute path for the """PATH_TO_THE_GENERATED_CPU0_YAML_FILE""" ?

Dolu1990 avatar Apr 05 '23 12:04 Dolu1990

yes I replace it with the path on my pc, it's /home/591867/Desktop/VexRiscv/cpu0.yaml

ottotto335 avatar Apr 05 '23 12:04 ottotto335

So, i just tried on my side using your commands, and it seems fine. Here is the openocd logs when i run it :

Open On-Chip Debugger 0.11.0+dev-02583-g9d50e3c2f-dirty (2022-10-27-11:30)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
....VexRiscv/cpu0.yaml
DEPRECATED! use 'adapter driver' not 'interface'
Info : only one transport option; autoselect 'jtag'
DEPRECATED! use 'adapter speed' not 'adapter_khz'
DEPRECATED! use 'adapter srst delay' not 'adapter_nsrst_delay'
Info : set servers polling period to 50ms
Info : clock speed 4000 kHz
Info : TAP fpga_spinal.bridge does not have valid IDCODE (idcode=0x0)
Info : TAP auto0.tap does not have valid IDCODE (idcode=0x80000000)
Info : TAP auto1.tap does not have valid IDCODE (idcode=0xc0000000)
Info : TAP auto2.tap does not have valid IDCODE (idcode=0xe0000000)
Info : TAP auto3.tap does not have valid IDCODE (idcode=0xf0000000)
Info : TAP auto4.tap does not have valid IDCODE (idcode=0xf8000000)
Info : TAP auto5.tap does not have valid IDCODE (idcode=0xfc000000)
Info : TAP auto6.tap does not have valid IDCODE (idcode=0xfe000000)
Info : TAP auto7.tap does not have valid IDCODE (idcode=0xff000000)
Info : TAP auto8.tap does not have valid IDCODE (idcode=0xff800000)
Info : TAP auto9.tap does not have valid IDCODE (idcode=0xffc00000)
Info : TAP auto10.tap does not have valid IDCODE (idcode=0xffe00000)
Info : TAP auto11.tap does not have valid IDCODE (idcode=0xfff00000)
Info : TAP auto12.tap does not have valid IDCODE (idcode=0xfff80000)
Info : TAP auto13.tap does not have valid IDCODE (idcode=0xfffc0000)
Info : TAP auto14.tap does not have valid IDCODE (idcode=0xfffe0000)
Info : TAP auto15.tap does not have valid IDCODE (idcode=0xffff0000)
Info : TAP auto16.tap does not have valid IDCODE (idcode=0xffff8000)
Info : TAP auto17.tap does not have valid IDCODE (idcode=0xffffc000)
Info : TAP auto18.tap does not have valid IDCODE (idcode=0xffffe000)
Info : TAP auto19.tap does not have valid IDCODE (idcode=0xfffff000)
Warn : Unexpected idcode after end of chain: 21 0xfffff800
Error: double-check your JTAG setup (interface, speed, ...)
Error: Trying to use configured scan chain anyway...
Error: fpga_spinal.bridge: IR capture error; saw 0x0f not 0x01
Warn : Bypassing JTAG setup events due to errors
[fpga_spinal.cpu0] Target successfully examined.
Info : starting gdb server for fpga_spinal.cpu0 on 3333
Info : Listening on port 3333 for gdb connections
requesting target halt and executing a soft reset
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : accepting 'telnet' connection on tcp/4444

I can then connect via telnet on it and do stuff.

You keept the "make run DEBUG_PLUGIN_EXTERNAL=yes" command runnig while you run openocd in another terminal ? (for now, don't add eclipse in the mix ^^)

Dolu1990 avatar Apr 05 '23 12:04 Dolu1990

emmm I can also do this in terminal on my pc, but I'm asked to debug the project with eclipse . so actually I'm following this part ->"Using Eclipse to run and debug the software", and it isn't that clear, so could you please tell me how to set the configuartion in eclipse to run it?

ottotto335 avatar Apr 05 '23 13:04 ottotto335

Ahhh nice, that's already a good step. So if you get

Open On-Chip Debugger 0.11.0+dev-04033-g058dfa50d (2023-02-20-09:48)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
/home/wjc/Desktop/VexRiscv_old/cpu0.yaml
DEPRECATED! use 'adapter driver' not 'interface'
Info : only one transport option; autoselect 'jtag'
DEPRECATED! use 'adapter speed' not 'adapter_khz'
DEPRECATED! use 'adapter srst delay' not 'adapter_nsrst_delay'
Info : set servers polling period to 50ms
Error: target 'fpga_spinal.cpu0' init failed

It it maybe because you ran openocd twice ? once in the background, once with eclipse itself ? Personnaly, i'm not using eclipse to run openocd, i just let openocd run in the backgroud

Dolu1990 avatar Apr 05 '23 16:04 Dolu1990

so I should let openocd run in the backgroud,and just use eclipse to run gdb? Then where should I print this command "make run DEBUG_PLUGIN_EXTERNAL=yes"? In another terminal or builder setting in eclipse?

ottotto335 avatar Apr 06 '23 00:04 ottotto335

so I should let openocd run in the backgroud,and just use eclipse to run gdb?

That's the way i'm doing it yes.

Then where should I print this command "make run DEBUG_PLUGIN_EXTERNAL=yes"? In another terminal or builder setting in eclipse?

Another terminal ^^

Dolu1990 avatar Apr 06 '23 05:04 Dolu1990

oh I see, thanks a lot!^^ one last question,when I run gdb in eclipse, where should I print the path of .elf file in this command -> YourRiscvToolsPath/bin/riscv32-unknown-elf-gdb VexRiscvRepo/src/test/resources/elf/uart.elf in Run->Debug Configurations->GDB OpenOCD Debugging->Debugger->GDB client Setup->other options I guess?

ottotto335 avatar Apr 07 '23 06:04 ottotto335

ahhh to provide the elf to eclipse run configuration : image

Dolu1990 avatar Apr 07 '23 06:04 Dolu1990

ok get it ! that's all, thanks for your help!^

ottotto335 avatar Apr 07 '23 07:04 ottotto335