In this brief tutorial we will discuss how to debug uboot drivers in SDK 2018.3. The main issue with debugging uboot is that the code relocates. In this tutorial we shall discuss how to overcome this in SDK, and how to add breakpoints to debug potential driver issue.
The use-case we will use here is the debugging of the PS GEM driver (zynq_gem) on the RFSoC board; ZCU111. The SDK supports debugging on a running target, so users can boot u-boot and connect to this running target, then set the relocation information, and set a breakpoint.
Then upon a reboot, then breakpoint should be hit and user can step through the uboot code.
Boot into u-boot and use the bdinfo utility to obtain this information. For example:
Here, we can see that the reloc_off is 0x77ED9000, and the relocaddr is 0x7FED9000
In this use-case, we shall be debugging the zynq_gem driver. So, a good place to start here is the zynq_gem_probe(). Users can get the address of this function from the uboot.map file, and add this to the relocation address to find the relocated address of the zynq_gem_probe().
So, the relocated address would be the relocaddr + the offset in the map file; 0x7FED9000 + 0x4187C = 0x7FF1A87C