Skip to content

gpanders/vitis_example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vitis Example

Getting Started

  1. Install Vitis

  2. Install Xilinx Run Time (XRT)

  3. Install PetaLinux

  4. Source the setup files for Vitis, XRT, and PetaLinux

    source /opt/Xilinx/Vitis/2019.2/settings64.sh
    source /opt/Xilinx/petalinux/2019.2/settings.sh
    source /opt/xilinx/xrt/setup.sh
    

    The paths may be different on your machine. Adjust accordingly.

  5. Run make run to build project and start software emulation

  6. Once the QEMU VM starts up, login with username root and password root, then run the following commands to launch software emulation:

    mount /dev/mmcblk0p1 /mnt
    cd /mnt
    ./init.sh
    

    Use reboot to shutdown the VM.

Details

Take a look at the Makefile to see exactly what's being done at each step.

Before we can run software emulation, we must first build all of the required components. These components are:

  • The host executable
  • The xclbin file
    • Xilinx kernel objects (.xo files)
      • Xilinx platform file (.xpfm)
        • Linux software components
          • Xilinx shell archive (.xsa)

The Xilinx shell archive is the output from Vivado and represents the hardware (fabric) component of the design. This is built by running the Tcl script found at scripts/create_xsa.tcl.

The XSA file is used by PetaLinux to generate the Linux software components; namely, the Linux kernel, root filesystem (sysroot), and device tree blob (combined together into image.ub), U-Boot (u-boot.elf), the ARM Trusted Firmware (bl31.elf), the first stage bootloader (fsbl.elf) and the PMU firmware (pmufw.elf). The sysroot is compressed into an initramfs in the image.ub file as well as a compressed tar file (rootfs.tar.gz).

The software components are copied into the build/boot directory and the sysroot is extracted into build/sysroot. From here, the software components and the XSA file are used to generate the Xilinx platform file. This is done using the script at scripts/create_platform.tcl.

Once the platform file is created, v++ is invoked to compile the kernel sources (found under the kernel/ directory) into Xilinx kernel objects (.xo files). Once compiled, the Xilinx kernel object files are linked (again using v++) into an xclbin file. All of these are placed under the build/$TARGET/ directory (where $TARGET is one of sw_emu, hw_emu, or hw).

The host executable depends only on the sysroot generated by PetaLinux. Once the sysroot is extracted to build/sysroot/ the host executable is compiled (using the Makefile found at src/host/Makefile) and copied to build/$TARGET/host.

When v++ links the Xilinx object files into the xclbin file, it also creates a _vimage directory. This directory contains the files used to generate a virtual SD card image containing the host executable, the Linux software components, and the generated xclbin file. This image is used by QEMU to emulate the target device and perform software or hardware emulation.

The list of files to be copied onto the virtual SD card image is found at _vimage/emulation/sd_card.manifest. By default, this file does not contain the host executable, the xrt.ini file (configuration file specifying emulation parameters), or the correct path to the xclbin file. The sdcard Makefile target corrects this by modifying the sd_card.manifest file to provide the correct path to the xclbin file as well as appending the host executable and the xrt.ini file.

Finally, invoking make run will use Xilinx's launch_emulator script to start the QEMU virtual machine using the virtual SD card image.

About

Example project for Xilinx Vitis

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published