In this tutorial, we will create the hardware design for the Zedboard to be used as a Vitis acceleration platform. This tutorial is adapted from Xilinx Vitis Tutorial.

Prepare files for platform packaging

  1. Let store all the necessary files for Vitis platform creation flow in zed_custom_package. Then we create a platform folder inside to hold platform creation source components.
    • Create a folder zed_custom_package
    • Inside this folder, create a folder platform
  2. Install sysroot:
    • Go to zed_custom_petalinux/images/linux directory.
    • Type ./sdk.sh -d <Install Target Dir> to install PetaLinux SDK. use the -d option to provide a full pathname to the output directory zed_custom_package/platform (This is an example) and confirm.
    • Note: The environment variable LD_LIBRARY_PATH must not be set when running this command
  3. Create boot directory and image directory inside pfm directory

    cd zcu104_custom_pkg/pfm
    mkdir boot
    mkdir image
    

    After this step, your directory hierarchy looks like this:

    - zcu104_custom_platform # Vivado Project Directory
    - zcu104_custom_plnx     # PetaLinux Project Directory
    - zcu104_custom_pkg      # Platform Packaging Directory
      - sysroots             # Extracted Sysroot Directory
      - pfm                  # Platform Packaging Sources
        - boot               # Platform boot components
        - image              # Files to be put in FAT32 partition
    
  4. Create BIF (linux.bif) to describe boot component structure for bootgen
    • Add a BIF file (linux.bif) to the <zed_custom_package>/platform/boot directory with the contents shown below.
    • The file names should match the contents of the boot directory. The Vitis tool expands these pathnames relative to the sw directory of the platform at v++ link time or when generating an SD card. However, if the bootgen command is used directly to create a BOOT.BIN file from a BIF file, full pathnames in the BIF are necessary. Bootgen does not expand the names between the <> symbols.
    /* linux */
    the_ROM_image:
    {
       [bootloader] <zynq_fsbl.elf>
       <bitstream>
       <u-boot.elf>
    }
    
  5. Prepare for the boot coomponents
    • Copy the generated Linux software boot components from <your_petalinux_dir>/images/linux directory to the <zed_custom_package>/platform/boot directory to prepare for running the Vitis platform packaging flow:
      • zynqmp_fsbl.elf
      • u-boot.elf
  6. Prepare image directory. Contents in this directory will be packaged to FAT32 partition by v++ package tool.
    • Copy the generated Linux software components from /images/linux directory to the /platform/image directory.
      • boot.scr: script for u-boot initialization.
      • system.dtb: the device tree blob that u-boot reads during boot to understand system setup.
  7. Copy additional dependencies to have a complete package
    • Copy rootfs.ext4 and uImage from zed_custom_petalinux/images/linux to zed_custom_package/platform.
    • Copy zed_custom_platform.xsa from zed_custom_platform to zed_custom_package/platform.

Create a Vitis platform

  1. Launch Vitis IDE
    • Select zed_custom_package folder as workspace directory
  2. Create a new platform project
    • Select menu File > New > Platform Project to create a platform project.
    • Enter the project name. For this example, type zed_custom. Click Next.
    • In the Platform page,
    • Click Browse button, select the XSA file generated by the Vivado. In this case, it is zed_custom_platform.xsa.
    • Set the operating system to linux.
    • Set the processor to ps7_cortexa9.
    • Uncheck option Generate boot components, because we’ll use PetaLinux generated boot components.
    • Click Finish.
  3. Setup software settings in Platform Settings view.
    • Click the linux on psu_cortexa53 domain, browse to the locations and select the directory or file needed to complete the dialog box for the following:
    • Bif file: Browse to zed_custom_package/platform/boot/linux.bif file and click OK.
    • Boot Components Directory: Browse to zed_custom_package/platform/boot and click OK.
    • Linux Image Directory: Browse to zed_custom_package/platform/image and click OK.
  4. Click zed_custom project in the Vitis Explorer view, click the Build button to generate the platform.

Run vector addition application

  1. Creating Vector Addition Application
    • Open Vitis workspace you were using before.
    • Select File -> New -> Application Project.
    • Click Next
    • Select zed_custom as platform, click Next.
    • Name the project vadd, click Next.
    • Set Domain to linux on ps7_cortexa9, set Sys_root path to zed_custom_pkg/platform/sysroots/ortexa9t2hf-neon-xilinx-linux-gnueabi (as you created by running sdk.sh).
    • Set the Root FS to rootfs.ext4 and Kernel Image to uImage. These files should be located in package.
    • Click Next.
    • Select System Optimization Examples -> Vector Addition and click Finish to generate the application.
    • In the Explorer window double click the vadd_system file to open it, change the Active Build configuration from Emulation-SW to Hardware.
    • Select vadd_system in Explorer window and click Build icon in toolbar.
  2. Running Vector Addition Application on the Board
    • Copy zed_custom_package/vadd_system/Hardware/package/sd_card.img to local if Vitis is running on a remote server.
    • Write sd_card.img into SD Card, see tutorials for linux, mac and windows.
    • Boot Zedboard with the SD card in SD boot mode.
    • Connect to board
      • UART connection
         minicom -D /dev/ttyACM0 -b 115200 -8
        
      • login
         login: root
         password: root
        
    • Go to auto mounted FAT32 partition
    cd /mnt/sd-mmcblk0p1
    
    • Run vadd application
      ./vadd binary_container_1.xclbin
      
    • It should show program prints and XRT debug info.
      TEST PASSED