BBL+Linux debugging with GDB and OpenOCD

(Nikita) #1


I am sorry for the newbie question in advance :slight_smile: I am trying to debug BBL + Linux kernel with GDB through OpenOCD. If I set a breakpoint in the Linux kernel address space (e.g. 0x80200000 which is the beginning of arch/riscv/kernel/head.S), then CPU will freeze at wfi instruction in the following loop inside BBL (bbl/bbl.c):

while (1) {
  __asm__ volatile("wfi");
#ifdef __riscv_div
  __asm__ volatile("div x0, x0, x0");

As I understand CPU will wait forever until any interrupt signal. But I do not understand why does it is freezes under GDB after I had set bp inside Linux address space?

(Jim Wilson) #2

There are 5 cores on a fu540. You might be looking at the wrong core. core 0 always goes into this wfi loop. Unfortunately, I donโ€™t know exactly how this works as Iโ€™ve never tried to debug bbl+kernel this way.

(Nikita) #3

Thank you! I will dig in that way.