Attach and Debug using Xilinx System Debugger - 2021.2 English

Vitis Unified Software Platform Documentation: Embedded Software Development (UG1400)

Document ID
UG1400
Release Date
2021-12-15
Version
2021.2 English

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.

  1. Compile the kernel source using the following configuration options:
    CONFIG_DEBUG_KERNEL=y
    CONFIG_DEBUG_INFO=y
  2. Launch the Vitis software platform.
  3. Click Window > Open Perspective > Debug.
  4. Right-click on the application and select Debug As > Debug Configuration.
  5. In the Debug Configurations page, select Launch on Hardware (Single Application Debug) and click the New button ().
  6. Name the configuration Zynq_Linux_Kernel_Debug.
  7. Debugging begins, with the processors in the running state.
  8. Click the Pause button to suspend the processor:. Debug starts in the Disassembly mode.
  9. Add vmlinux symbol files to both processor cores:
    1. Right-click on ARM Cortex-A9 MPCore#0 and select Symbol Files.
    2. Click add and add vmlinux symbol files.
    3. Click OK.
    4. Right-click on ARM Cortex-A9 MPCore#1 and select Symbol Files.
    5. Click add and add vmlinux symbol files.
    6. Click OK.
  10. You must set up Source Lookup if you built the code on a Linux machine and try to run the debugger on Windows.
  11. Select the debug configuration Zynq_Linux_Kernel_Debug, then right-click it and select Edit Source Lookup.
  12. Click Add.
  13. Select Path Mapping from the Add Source page.
  14. Add the Compilation path and local file system path by clicking Add.
  15. Successful source lookup takes you to the source code debug.
  16. You can add function breakpoints using the Breakpoints view toolbar.
  17. Add a breakpoint at the start_kernel function.
  18. 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.