Debug the Host Code and Kernel Source Code using the Vitis IDE - 2025.1 English - XD100

Vitis Tutorials: AI Engine Development (XD100)

Document ID
XD100
Release Date
2025-08-25
Version
2025.1 English

This section uses the system project built using the Vitis IDE and launch the IDE debugger to debug the host code and AI Engine kernel source code. Unlike debugging at simulation level, this topic walks you through connecting the harware to the IDE debugger, placing breakpoints in the host code and kernel source code, and observing intermittent values in the Varibale view, register view, and memory inspector.

  1. Download the Vitis IDE project from Download the Vitis IDE project and import into the Vitis IDE.

  2. Invoke the Vitis IDE, and select File -> Import -> Vitis project exported zip file.

  3. Browse to the PeakDetect.ide.zip, enable the System Projects checkbox, and click Finish.

  4. In the Flow view Flow -> Hardware -> Build All. It takes 20-25 minutes to completely build for the hardware target.

  5. Then generate the sd_card.img by **Flow -> Hardware -> Package -> Build Package **.

  6. Prepare the target hardware by flashing the sd_card.img on to the VCK190.

  7. Plug in the sd_card into the SD card slot, and power up the board.

  8. Once the boot completes, type ifconfig in the hardware console. This is required to set up the Linux TCF agent to connect with the host.

    versal-rootfs-common-20231:/run/media/mmcblk0p1# ifconfig
    eth0      Link encap:Ethernet  HWaddr 72:5D:6F:74:88:C9
             UP BROADCAST MULTICAST  MTU:1500  Metric:1
             RX packets:0 errors:0 dropped:0 overruns:0 frame:0
             TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
             collisions:0 txqueuelen:1000
             RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
             Interrupt:34
    
    eth1      Link encap:Ethernet  HWaddr F6:94:91:C7:19:B0
             inet addr:10.140.179.228  Bcast:10.140.179.255  Mask:255.255.252.0
             inet6 addr: fe80::f494:91ff:fec7:19b0/64 Scope:Link
             UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
             RX packets:1325 errors:0 dropped:6 overruns:0 frame:0
             TX packets:565 errors:0 dropped:0 overruns:0 carrier:0
             collisions:0 txqueuelen:1000
             RX bytes:103454 (101.0 KiB)  TX bytes:94168 (91.9 KiB)
             Interrupt:35
    
    lo        Link encap:Local Loopback
             inet addr:127.0.0.1  Mask:255.0.0.0
             inet6 addr: ::1/128 Scope:Host
             UP LOOPBACK RUNNING  MTU:65536  Metric:1
             RX packets:2 errors:0 dropped:0 overruns:0 frame:0
             TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
             collisions:0 txqueuelen:1000
             RX bytes:140 (140.0 B)  TX bytes:140 (140.0 B)
    

    NOTE: It is required to connect the VCK190 board to the Ethernet cable to get the ethernet address.

  9. Set up the connection to the target hardware board.

    • Run the hardware server from the computer that connects to the target board. To do so, launch the hw_server from the computer that has the JTAG connection to the VCK190 board. launch hardware server

    • Create the debug target connection from the Vitis IDE by clicking settings tab in Flow -> Hardware -> Debug.

    • To setup target connection details, follow the steps as mentioned in Target Hardware Connection setup

  10. Now, the Vitis IDE switches automatically to the debug mode, and the debugger suspends the host application at an automatic breakpoint in the host.cpp as follows. host debug

  11. Place a breakpoint at line 38 in the host.cpp, and click resume. Observe the following values of diferent variables in the Variables view. This way you can debug the host code. host variables

  12. You can also debug the AI Engine cores by placing the breakpoints in the kernel source code. Open the src/kernels/peak_detect.cc kernel, and place a breakpoint at line 33. Click the resume button, and observe the following values in the register view and variable view.

  13. You can hover your mouse over variables in the editor window and get the memory address. Add that address in the memory inspector, and observe the corresponding values. For more details, refer to the Debug Using Vitis IDE debugger. debug hardware view

  14. When the application run completes in hardware, you can observe the TEST PASSED message in the console.