UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

AR# 67767

2016.2 SDK - Debug Linux kernel running on a ZC702 board

Description

In this demo, a Linux image will be built using the ZC702 BSP in PetaLinux 2016.2. The steps to setup and debug the Linux kernel via Xilinx SDK are also included.

Support for kernel aware debug is currently only available for Zynq.

Solution

Step 1: Build the Linux image for the ZC702 board

The BSP for the ZC702 can be found here. Use it with the following commands to create the PetaLinux project:


petalinux-create -t project -s Xilinx-ZC702-v2016.2-final.bsp
cd Xilinx-ZC702-2016.2/
petalinux-config -c kernel
kernel_hacking

Select compile-time checks and compiler options -> [*] Compile the kernel with debug info

Note: debug_kernel is already enabled.


Because we are using the BSP, the tcf-agent will be enabled. This is required for debugging.

Now use the following commands:

petalinux-build
cd images/linux
petalinux-package --boot --fsbl zynq_fsbl.elf --fpga download.bit --uboot

  • Place the Boot.BIN and image.ub on the SD Card
  • Power on and Boot

Step 2: Attach and Debug using Xilinx System Debugger:

  • Launch SDK
  • Select Window -> Perspective -> Open Perspective -> Debug
  • Select Run -> Debug Configurations
  • Double Click on Xilinx C/C++ Application (System Debugger)
    • Name: "Zynq_Linux_Kernel_Debug"
    • Debug Type: Attach to running target
    • Leave the rest at the default settings
    • Select Apply, and Debug
  • Debugging should begin.
  • Highlight ARM Cortex-A9 MPCore #0 (under APU) and select suspend. You should see the disassembly mode.
  • Add vmlinux files to both processors
    • right click on the processor ARM Cortex-A9 MPCore #0, and select Symbol Files
    • Select Add and add the vmlinux file in the Xilinx-ZC702-v2016.2/images/linux folder created in Step 1.
    • Note: If the debug_kernel, and debug_info where not set, then this file will not have the correct info.
    • Enable OS awareness
    • Select OK
    • The results should look like the following screen capture:


 

To verify, you can add a function breakpoint by highlighting the Breakpoint tab, and selecting "Add Function breakpoint" in the dropdown menu:


 

Set this to "start_kernel":


 

Then restart your board, or reset. You should see the breakpoint being hit.

For example, here is the debug view, and the view of the serial port showing that the "start_kernel" function is hit:


 

You can then step in/over, or resume debugging.

AR# 67767
Date Created 08/25/2016
Last Updated 09/12/2016
Status Active
Type General Article
Devices
  • Zynq-7000
Tools
  • Vivado Design Suite - 2016.2