Application 1: Run a PL Acceleration Application - 2023.2 English

Vitis Tutorials: Vitis Platform Creation (XD101)

Document ID
XD101
Release Date
2023-12-26
Version
2023.2 English

You will create an acceleration application with PL kernel running on the platform created in step 2 and run it on this custom-VCK190 board.

  1. Creating Vector Addition Application

    • Go to WorkSpace directory created in step1

    • Run Vitis by typing vitis -w . in the console. -w is to specify the workspace. . means the current workspace directory. Close the welcome tab after Vitis launches.

    • Go to example view by clicking the example button and click Simple Vector Addition. example.PNG

    • Click Create Application from Template. The project creation wizard would pop up.

      • Input the System project name as vadd and use the default location for System project location. Then click Next.

      • Select custom_platform platform, click Next.

        Note If the platform component is not in the current workspace user could click + button to add the platform component.

      • Set Kernel Image to xilinx-versal-common-v2023.2/Image.

      • Set Root FS to xilinx-versal-common-v2023.2/rootfs.ext4.

      • Set Sysroot to xilinx-versal-common-v2023.1/sysroots/cortexa72-cortexa53-xilinx-linux. Then click Next.

      • Review the summary of your vadd system project and click Finish.

      Note: In the platform selecting page if the platform you want to use is not in the current list, you can click + button to add the platform to the list.

    After seconds the vadd system project, vadd host component and vadd kernel component will be ready in the component view.

  2. Building Vector Addition Application

    Vadd system project supports three targets: Software emulation, Hardware emulation and Hardware. User could select the target accordingly following steps below.

    • Go to flow navigator and select vadd system project.

      build_application.PNG

    • Click Build All under the target

    • In the Build Component setup dialog please enable all the components. Then click OK.

      build_application.PNG

    After compilation is finished. Users can locate the sd_card.img by expanding the Output directory. This provides a logical view of the output. The actual path of sd_card.img file is located in WrokSpace/vadd/build/<TARGET>/package/package/ directory. For example, if user targets hardware emulation, the sd_card.img file is in located in WrokSpace/vadd/build/hw_emu/package/package/. Users can also view the complete path of the sd_card.img file by simply hovering the mouse pointer over the image file.

  3. Running Hardware Emulation

    After the compilation for hardware emulation is finished, please follow steps below to run hardware emulation.

    • Click Start Emulator under HARDWARE EMULATION target. The Start Emulator setup page would be popped up. Then click Start. build_application.PNG

    • Click Run after the emulator boots up to terminal build_application.PNG

    • Click Stop emulator to stop emulation after emulation is finished. build_application.PNG

  4. Running the Application on Hardware

    1. Copy WrokSpace/vadd/build/hw/package/package/sd_card.img to local if you build the project on a remote server or virtual machine.

    2. Program the sd_card.img to a SD card. Refer to AR#73711 for detailed steps.

      NOTE: The programmed SD card has two partitions. The FAT32 partition with boot components and the EXT4 partition with Linux root file system. By default, the Windows system cannot see the contents of EXT4 partition.

      NOTE: Eject the SD card properly from the system after programming it.

    3. Insert the SD card, and boot the VCK190 board with SD boot mode (SW1[4:1] = “1110”: OFF, OFF, OFF, ON) and power on.

      NOTE: Refer to VCK190 Evaluation Board User Guide for details about boot mode.

    4. Connect to UART console.

    5. Launch the test application from UART console.

    Use the following steps to run the application

    You will need to log in with user petalinux first and set up a new password (it is then also the sudo password):

    • Log into the system

      petalinux login:petalinux
      You are required to change your password immediately (administrator enforced).
      New password:
      Retype new password:
      petalinux:~$ sudo su
      We trust you have received the usual lecture from the local System
      Administrator. It usually boils down to these three things:
            #1) Respect the privacy of others.
            #2) Think before you type.
            #3) With great power comes great responsibility.
      Password:
      petalinux:/home/petalinux#
      
    • Go to auto mounted FAT32 partition and run the application as:

      petalinux:/home/petalinux# cd /run/media/sd-mmcblk0p1
      petalinux:/home/petalinux# ./simple_vadd krnl_vadd.xclbin
      
    1. Expected print on UART console

    Show Log
    root@petalinux:/run/media/mmcblk0p1# ./vadd binary_container_1.xclbin
    EXE: /run/media/mmcblk0p1/simple_vadd
    [XRT] WARNING: The xrt.ini flag "opencl_summary" is deprecated and will be removed in a future release.  A summary file is generated when when any profiling is enabled, so please use the appropriate settings from "opencl_trace=true", "device_counter=true", and "device_trace=true."
    [XRT] WARNING: The xrt.ini flag "opencl_device_counter" is deprecated and will be removed in a future release.  Please use the equivalent flag "device_counter."
    INFO: Reading krnl_vadd.xclbin
    Loading: 'krnl_vadd.xclbin'
    [   74.394840] zocl-drm amba_pl@0:zyxclmm_drm: zocl_create_client: created KDS client for pid(577), ret: 0
    [   74.395731] zocl-drm amba_pl@0:zyxclmm_drm: zocl_destroy_client: client exits pid(577)
    [   74.401000] zocl-drm amba_pl@0:zyxclmm_drm: zocl_create_client: created KDS client for pid(577), ret: 0
    Trying to program device[0]: edge
    [   74.937477] [drm] skip kind 29(AIE_RESOURCES) return code: -22
    [   74.938038] [drm] found kind 8(IP_LAYOUT)
    [   74.938641] [drm] found kind 9(DEBUG_IP_LAYOUT)
    [   74.939375] [drm] skip kind 25(AIE_METADATA) return code: -22
    [   74.939688] [drm] found kind 7(CONNECTIVITY)
    [   74.940087] [drm] found kind 6(MEM_TOPOLOGY)
    [   74.940907] [drm] Memory 0 is not reserved in device tree. Will allocate memory from CMA
    [   74.948647] [drm] Memory 1 is not reserved in device tree. Will allocate memory from CMA
    [   74.963753] cu_drv CU.2.auto: cu_probe: CU[0] created
    [   74.974174] cu_drv CU.2.auto:  ffff000803cbac10 xrt_cu_intr_thread: CU[0] start
    [   74.989334] [drm] zocl_xclbin_read_axlf f4f049d5-183a-e265-264d-ecfa34a51343 ret: 0
    [   75.037345] [drm] bitstream f4f049d5-183a-e265-264d-ecfa34a51343 locked, ref=1
    [   75.038188] zocl-drm amba_pl@0:zyxclmm_drm:  ffff000800323c10 kds_add_context: Client pid(577) add context CU(0xffffffff) shared(true)
    [   75.041054] zocl-drm amba_pl@0:zyxclmm_drm:  ffff000800323c10 kds_del_context: Client pid(577) del context CU(0xffffffff)
    [   75.042096] [drm] bitstream f4f049d5-183a-e265-264d-ecfa34a51343 unlocked, ref=0
    [   75.094803] [drm] bitstream f4f049d5-183a-e265-264d-ecfa34a51343 locked, ref=1
    [   75.095393] zocl-drm amba_pl@0:zyxclmm_drm:  ffff000800323c10 kds_add_context: Client pid(577) add context CU(0xffffffff) shared(true)
    Device[0]: program successful!
    [   75.188269] zocl-drm amba_pl@0:zyxclmm_drm:  ffff000800323c10 kds_add_context: Client pid(577) add context CU(0xffffffff) shared(true)
    [   75.192218] zocl-drm amba_pl@0:zyxclmm_drm:  ffff000800323c10 kds_add_context: Client pid(577) add context CU(0x0) shared(true)
    TEST PASSED
    [   78.347703] zocl-drm amba_pl@0:zyxclmm_drm:  ffff000800323c10 kds_del_context: Client pid(577) del context CU(0xffffffff)
    [   78.349191] zocl-drm amba_pl@0:zyxclmm_drm:  ffff000800323c10 kds_del_context: Client pid(577) del context CU(0x0)
    [   78.354584] zocl-drm amba_pl@0:zyxclmm_drm:  ffff000800323c10 kds_del_context: Client pid(577) del context CU(0xffffffff)
    [   78.355356] [drm] bitstream f4f049d5-183a-e265-264d-ecfa34a51343 unlocked, ref=0
    [   78.462912] zocl-drm amba_pl@0:zyxclmm_drm: zocl_destroy_client: client exits pid(577)
    

    NOTE: The [   35.116279] [drm] messages are print from XRT for debugging purpose. It only shows up on UART. It will now print on ssh. This debugging message can be turned off by turning down the system dmesg reporting level.

    echo "4" > /proc/sys/kernel/printk