Attach and Debug Linux Kernel Using Xilinx System Debugger (TCF)


It is possible to debug the Linux Kernel using the Xilinx® System Debugger (TCF). 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:

    1. CONFIG_DEBUG_KERNEL=y
    2. CONFIG_DEBUG_INFO=y
  2. Launch SDK.

  3. Click Window > Open Perspective > Debug.




  4. Click Run > Debug Configurations.





  5. In the Debug Configurations dialog box, select Xilinx C/C++ application (TCF) and click the New icon. Name the configuration Zynq_Linux_Kernel_Debug.

  6. Debugging begins, with the processors in the running state, as shown below.



  7. Click the button to suspend the processor. Debug starts in the Disassembly mode.



  8. Add the vmlinux symbol file:

    1. Right click ARM Cortex-A9 MPCore#0 and select Symbol Files.



    2. Click Add.



    3. Add the vmlinux symbol file and click OK.




  9. You must setup “Source Lookup” if you built the code on a Linux machine and try to run the debugger on Windows.



  10. Select the debug configuration Zynq_Linux_Kernel_Debug and right-click it to select Edit Source Lookup.








  11. Click Add and select Path Mapping from the Add Source dialog box.




  12. Add the Compilation path and local file system path by clicking Add.


  13. Successful source lookup takes you to the source code debug.



  14. You can add function breakpoints by clicking the button in the Breakpoints view.




  15. Add a breakpoint at the start_kernel function.






  16. Press the reset button. The Zynq®-7000 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 inlining enabled. Therefore:

    • Stepping through code might not work as expected due to the possible reordering of some instructions.
    • Some variables might be optimized out by the compiler and therefore not be available for the debugger.

Related tasks
SDK System Debugger (TCF)

Copyright 1995-2013 Xilinx, Inc. All rights reserved.