OpenXiangShan / XiangShan

Open-source high-performance RISC-V processor
Other
4.71k stars 644 forks source link

How to debug Xiangshan on FPGA with OpenOCD? #3388

Open x402 opened 1 month ago

x402 commented 1 month ago

Before start

Describe you problem

It is mentioned that how to use OpenOCD to debug emu of XiangShan in the doc, but not XiangShan running on FPGA with JTAG. While we are tring to implement the minimal FPGA system of Nanhu on S2C's Prodigy™ S7-19PD Logic System #3377 , I suppose that the CPU crashes on some instruction. So I want to use JTAG and OpenOCD to find out if the CPU stops on some instruction. But we don't know how to begin. So we hope to get some help. 香山文档中有提到如何在仿真中使用OpenOCD进行调试,但是没提到在FPGA平台上运行香山时如何用OpenOCD连接JTAG进行调试。我和同伴正在S2C's Prodigy™ S7-19PD Logic System上搭载南湖的FPGA最小系统进行实验 #3377 ,想知道CPU是否是卡在某个地址的指令无法运行,所以想用JTAG+OpenOCD进行调试,但是现在无从下手,希望可以得到一些指点。

What did you do before

3377

Environment

Additional context

No response

cebarobot commented 4 weeks ago

It seems that you could wire the JTAG from FPGA and use an hardware JTAG debugger to debug it.

看起来您需要在 FPGA 平台上引出 JTAG 接口,并且连接一个硬件 JTAG 调试器即可。

cebarobot commented 3 weeks ago

We write an tutorial for using FPGA JTAG: FPGA JTAG - XiangShan-doc. Hope that could help you.

我们撰写了一个 FPGA JTAG 使用的简易教程:FPGA JTAG - XiangShan-doc。希望能帮到您。

x402 commented 3 weeks ago

We write an tutorial for using FPGA JTAG: FPGA JTAG - XiangShan-doc. Hope that could help you.

我们撰写了一个 FPGA JTAG 使用的简易教程:FPGA JTAG - XiangShan-doc。希望能帮到您。

Thank you very much! The tutorial is helpful. 非常感谢,这个教程很有帮助。

Headcrabed commented 2 weeks ago

@cebarobot 另外请问有测试过直接使用jlink驱动本身的riscv64调试功能吗?openocd的性能和便利程度比起jlink官方驱动还是差了一些

cebarobot commented 2 weeks ago

@cebarobot 另外请问有测试过直接使用jlink驱动本身的riscv64调试功能吗?openocd的性能和便利程度比起jlink官方驱动还是差了一些

我们没有尝试过,您可以尝试一下。

We haven't try that. You could have a try.