-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to debug UEFI app via JTAG on RPi4B? #194
Comments
So, I had hoped someone else would answer this, because I tend to do most of my development via printfs, only reaching for the jtag probe when I think its really going to allow me to catch something I can't dump. So, you are asking about debugging UEFI with jtag, and it sounds like you have the jtag probe working, so the one remaining bit is actually getting useful information out of it. But there is a bit of confusion about vmlinux, which will require slightly different debugging procedures, and probably isn't really a topic here, rather on a kernel/etc forum. So, to debug uefi with openocd/gdb probably the easiest way is to build a debug build of the firmware, attach a serial port to the rpi and capture all the "add-symbol-file" messages that appear. Then redirect them into your GDB session. Adding
Then you can set breakpoints/etc by the symbols, or look at backtraces. ex:
You should see add-symbol-file outputs for most things that get run, and have debugging information, including the uefi shell itself. From there a good place to start tends to be the module entrypoints/etc. |
My current status:
vmlinux
(which comes with EFI_STUB), using a USB stick:FS0:\> vmlinux-5.11.0-38 initrd=\initrd.img-5.11.0-38 root=/dev/sda2
. The kernel and initrd are copied from a ubuntu 21.04 installation on QEMU VM.PcdDebugEnableJTAB
atbuild
command line (--pcd gRaspberryPiTokenSpaceGuid.PcdDebugEnableJTAG=1
). Using theRPI_EFI.fd
built, OpenOCD can connect to RPi4B via JTAG successfully. (I also addedenable_jtag_gpio=1
andgpio=22-27=np
inconfig.txt
).Now I am wondering if there is a guide on how to debug the firmware drivers/apps? For example, after entering UEFI Shell, I want to step through the EFI_STUB to inspect the kernel boot sequence, but I don't know where to set the break point since the load address of
vmlinux
is unknown to me.Any pointer will be appreciated.
Thanks!
The text was updated successfully, but these errors were encountered: