It is possible to debug the Linux kernel using Xilinx System Debugger. Follow the steps below to attach to the Linux kernel running on the target and to debug the source code.
- Compile the kernel source using the following configuration options:
CONFIG_DEBUG_KERNEL=y CONFIG_DEBUG_INFO=y
- Launch the Vitis software platform.
- Click .
- Right-click on the application and select .
- In the Debug Configurations page, select Launch on Hardware (Single Application Debug) and click the New button ().
- Name the configuration Zynq_Linux_Kernel_Debug.
- Debugging begins, with the processors in the running state.
- Click the Pause button to suspend the processor:. Debug starts in the Disassembly mode.
- Add vmlinux symbol files to both processor cores:
- Right-click on ARM Cortex-A9 MPCore#0 and select Symbol Files.
- Click add and add vmlinux symbol files.
- Click OK.
- Right-click on ARM Cortex-A9 MPCore#1 and select Symbol Files.
- Click add and add vmlinux symbol files.
- Click OK.
- You must set up Source Lookup if you built the code on a Linux machine and try to run the debugger on Windows.
- Select the debug configuration Zynq_Linux_Kernel_Debug, then right-click it and select Edit Source Lookup.
- Click Add.
- Select Path Mapping from the Add Source page.
- Add the Compilation path and local file system path by clicking Add.
- Successful source lookup takes you to the source code debug.
- You can add function breakpoints using the Breakpoints view toolbar.
- Add a breakpoint at the
start_kernel
function. - Click the reset button. The Zynq-7000 SoC processor boots from the SD card and stops at the beginning of
the kernel initialization. Note: The Linux kernel is always compiled with full optimizations and in-lining enabled. Therefore, stepping through code might not work as expected due to the possible reordering of some instructions. Furthermore, some variables might be optimized out by the compiler and consequently might not be available for the debugger.