Open vietthanh85 opened 2 years ago
Hi, I would say, to debug it you would need to check what is happning on the VJTAG using signaltap (or another logic analyser), and see if it does something when you start openocd.
That way we can be sure which way to look at, as there is quite many things involved to get things to work ^^
Hi, I would say, to debug it you would need to check what is happning on the VJTAG using signaltap (or another logic analyser), and see if it does something when you start openocd.
That way we can be sure which way to look at, as there is quite many things involved to get things to work ^^
@Dolu1990 Thank you. I've got your point.
I guess that the OpenOCD configurations to connect to USB Blaster and the board might be not correct, but I am not sure how to configure it correctly. Do you have any idea about what the wrong steps are? Your help would be very appreciated!
OpenOCD (including the VexRiscv version of OpenOCD) doesn't have a generic way to deal with Intel's virtual JTAG. To my knowledge, there is only one CPU that supports virtual JTAG in OpenOCD and that's OpenRISC. (See here.)
Support of virtual JTAG for the VexRiscv requires a similar amount of work in OpenOCD. Personally, I simply use general purpose GPIOs and the SpinalHDL JTAG TAP to connect a debugger to a VexRiscv CPU.
Tom
If i remember well, somebody got it to work with the vjtag from altera, but i realy don't remember anything else XD
I guess that the OpenOCD configurations to connect to USB Blaster and the board might be not correct, but I am not sure how to configure it correctly. Do you have any idea about what the wrong steps are? Your help would be very appreciated!
OpenOCD (including the VexRiscv version of OpenOCD) doesn't have a generic way to deal with Intel's virtual JTAG. To my knowledge, there is only one CPU that supports virtual JTAG in OpenOCD and that's OpenRISC. (See here.)
Support of virtual JTAG for the VexRiscv requires a similar amount of work in OpenOCD. Personally, I simply use general purpose GPIOs and the SpinalHDL JTAG TAP to connect a debugger to a VexRiscv CPU.
Tom
Thank @tomverbeure . By the way, I've just found this blog https://koyamanx.github.io/ck-dev/blog/my_riscv_debug_feature_part1. He tried to debug RISC-V cores on Altera boards by OpenOCD using VJTAG. He also ported it from OpenRISC (or1k_tap_vjtag.c). Unfortunately, only Japanese is available. I am following to this blog post through a lot of things need to be modified and it's still far from the success. Hope this helps in case of you have a similar work to do.
Nice find! The number of changes that are specific to virtual JTAG are very reasonable: https://github.com/koyamanX/riscv-openocd/commit/ad03470a2b4d3f0fadd9e1944445ac9193487d37.
Tom
Thanks :)
@vietthanh85 Any luck getting this to work in the end? Trying to have a go myself
I haven't looked at this any further and I'm not planning to in the near future. Have a go at it!
@vietthanh85 Any luck getting this to work in the end? Trying to have a go myself @LYWalker not yet. https://koyamanx.github.io/ck-dev/blog/my_riscv_debug_feature_part1 https://github.com/koyamanX/riscv-debug This is not a complete guideline. A lot of TODOs to get it working. I am thinking to use another solution from LiteX: https://github.com/jevinskie/litex/blob/jev/main/litex/soc/cores/jtag.py
I can confirm that I have VJTAG working, I'll create a pull request soon. It has edits in the openocd port as well, as you can imagine.
@LYWalker Nice thanks :D
@Dolu1990 See these pull requests: https://github.com/SpinalHDL/SpinalHDL/pull/950 https://github.com/SpinalHDL/openocd_riscv/pull/28
Let me know if you have any suggestions. I've tested it successfully on the DE0 board.
I have followed to https://github.com/SpinalHDL/VexRiscv/tree/master/doc/nativeJtag, but I need to modify for my Altera DE0-Nano-SoC board (Cyclone® V SE 5CSEMA4U23C6N device) and Altera Virtual JTAG. Unfortunately, it was not successful yet. The following is my modifications.
Original (Xilinx Bscane2)
Modification for Altera Virtual JTAG
Original: Add import for JtagTapInstructionCtrl
Modification: Add import for JtagTapInstructionCtrl and VJTAG
Then, it generated verilog and hex files successfully. I used them to make Quartus project. I also added VJTAG module to Quartus project. (Currently, I reused
vJTAG.qip
,vJTAG.v
from this example: http://idle-logic.com/2012/04/15/talking-to-the-de0-nano-using-the-virtual-jtag-interface/) Fortoplevel.v
, I also removed the following linesThen, the bitstream was loaded into the board successfully and Murax worked normally (LED blinked).
For debugging by OpenOCD, I modified as follows: Create new file
altera-5csema4.cfg
in folderopenocd_riscv/tcl/cpld/
with following content (I have checked the corresponding device handbook for Cyclone V and found that theexpected-id
should be0x02d010dd
):Then, I modified
usb_connect.cfg
to work with Altera USB Blaster instead of "Digilent USB Device":I did not modify
soc_init.cfg
. For other steps, I followed to the reference.Here is the result when I tried to debug with OpenOCD:
GDB client terminal:
The problem is that: CPU was not halted after I sent
monitor reset halt
from gdb client. So, I cannot debug anything the application :( I guess that the OpenOCD configurations to connect to USB Blaster and the board might be not correct, but I am not sure how to configure it correctly. Do you have any idea about what the wrong steps are? Your help would be very appreciated! Many thanks!