https://github.com/gpanders/vitis_example
Example project for Xilinx Vitis
https://github.com/gpanders/vitis_example
Last synced: about 1 month ago
JSON representation
Example project for Xilinx Vitis
- Host: GitHub
- URL: https://github.com/gpanders/vitis_example
- Owner: gpanders
- License: mit
- Created: 2020-02-06T15:20:07.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-02-26T04:44:43.000Z (about 5 years ago)
- Last Synced: 2025-02-05T09:52:00.396Z (3 months ago)
- Language: Tcl
- Size: 46.9 KB
- Stars: 5
- Watchers: 4
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Vitis Example
=============Getting Started
---------------1. [Install Vitis][vitis]
2. [Install Xilinx Run Time (XRT)][xrt]
3. [Install PetaLinux][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`](/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](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](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`](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.[vitis]: https://www.xilinx.com/html_docs/xilinx2019_2/vitis_doc/Chunk1858803630.html#ariaid-title2
[xrt]: https://www.xilinx.com/html_docs/xilinx2019_2/vitis_doc/Chunk1858803630.html#ariaid-title3
[petalinux]: https://www.xilinx.com/support/download/index.html/content/xilinx/en/downloadNav/embedded-design-tools.html