openhwgroup / cva6-sdk

CVA6 SDK containing RISC-V tools and Buildroot
59 stars 64 forks source link

Linux Kernel can not set breakpoint with openocd and gdb on GENESYS2 board #41

Closed hilihui closed 3 years ago

hilihui commented 3 years ago

Hi,

I tried to debug Linux Kernel with openocd and gdb on GENESYS2 board(the board is FPGA).

When BBL start Linux Kernel, i set a breakpoint on Kernel entry(start_kernel).The address of the breakpoint is physical address(0x802006be),and the breakpoint can work. But when i continue to set other breakpoints, gdb always return the following error: image Thanks a lot in advance!

Moschn commented 3 years ago

It seems like one of your breakpoints is actually in virtual memory (0xffffffe0000006be). GDB and OpenOCD do not yet fully support virtual memory debugging so I guess you have to wait until this is fully supported.

There is some preliminary support in the newest openOCD that you can enable with some configuration in ariane.cfg.

hilihui commented 3 years ago

Is the newest openocd for riscv? How to config?Thanks!

Moschn commented 3 years ago

I never tried it myself but take a look at https://github.com/riscv/riscv-openocd/pull/386

Moschn commented 3 years ago

Or take a look at this: https://github.com/riscv/riscv-openocd/pull/425

hilihui commented 3 years ago

Hi, my openocd is newest version and support virtual address. Is there other reason? I see that someone can debug linux kernel with openocd on arm cpu,but my cpu is riscv.

Moschn commented 3 years ago

The openOCD port to risc-v did not support virtual memory a year ago. Maybe this has changed now. I do not know. Take a look at the linked PRs to the risc-v openOCD.

Edit: It very much seems like virtual memory support is your issue. So I believe there is no other reason.