The FRACTAL project (funded under the INDUSTRIAL LEADERSHIP program of the European Commission) is developing a computing node on which to base a cognitive fractal network capable of learning from and responding to its environment. It supports seamless, fast, and reliable interaction between the physical world and the cloud for applications ranging from self-driving cars to remote medical procedures.
This repository includes all necessary files and scripts for developing a Vitis Application Project on the FRACTAL platform (which is also a Vitis Platform Project). These application projects are software projects that target the Versal™ AI Core Series VCK190 Evaluation Kit to build a custom HW accelerated application.
Quick-start:
The VCK190 image provided by Xilinx in the Vitis AI User Guide is suited for most use cases without further customization. The image provided in version 3.0 of this document has been successfully validated on HW, and has all the features provided in this repository available either natively or through the DNF package manager.
In case there would be any further HW or PetaLinux requirement not covered by the Xilinx's image, then proceed with the following guide to customize the Vivado Project and the PetaLinux configuration to generate a new Versal image for the Vitis Unified Software Platform.
The whole build flow requires Vitis Core Development Kit version 2021.2 installed in the host machine with a suitable license for Vivado® Design Suite (a temporary license for Versal devices should be enough). It is available from the following link: Vitis (SW Developer) - Download link.
Additionally, download the PetaLinux installer to the src/ directory (it is available from Xilinx's website). It is required to build the PetaLinux OS.
Optional:
PetaLinux OS can be build on a docker container (generated automatically). The Docker build-flow is disabled by default, but Docker is required to be already installed in the host machine if enabled. Follow these instructions.
Also, make sure to download the VCK190 BSP from Xilinx's website, as well as the Versal Common image also from Xilinx's website, and place them in the src/ directory.
To start the build process, execute the following command from the Linux terminal:
# Source Vivado and Vitis settings from their respective installation directories
source <XILINX_INSTALL_DIR>/Vitis/2021.2/settings64.sh
# Make the FRACTAL Platform from scratch
make all
It executes the following tasks:
- Clean all output products (
make clean_all
):- Clean HW platform (
make clean_hw_platform
) - Clean PetaLinux Docker container (
make clean_docker
) - Clean PetaLinux image (
make clean_petalinux_os
) - Clean SW platform (
make clean_sw_platform
)
- Clean HW platform (
- Check all requirements (
make check_all
): - Build HW platform on Vivado (
make hw_platform
⏩ vivado/make all
)- Clean vivado/ directory (vivado/
make clean
) - Create HW platform in Vivado (vivado/
make xsa
⏩vivado/src/platform_xsa.tcl)- Create block design (vivado/src/dr.bd.tcl)
- Set platform properties (vivado/src/pfm_decls.tcl)
- QOR settings (vivado/src/qor_scripts/)
- Generate output products (vivado/src/platform_xsa.tcl)
- Clean vivado/ directory (vivado/
- (Optional) Build PetaLinux Docker container (
make petalinux-2021.2_docker
)- Clean the Docker image if required (
make clean_docker
) - Build the Docker image (Dockerfile)
- Clean the Docker image if required (
- Build OS with PetaLinux (
make petalinux_os
⏩ Docker ⏩ petalinux/make all
)- Clean the petalinux/ directory (petalinux/
make clean
) - Create PetaLinux project (petalinux/
make create
) - Configure PetaLinux project (petalinux/
make update_all_configs
)- Link Vivado's XSA file to project (petalinux/
make update_hw
) - Set main parameters (petalinux/
make update_main_config
) - Configure kernel (petalinux/
make update_kernel_config
) - Configure RootFS (petalinux/
make update_rootfs_config
) - Configure external sources/layers (petalinux/
make update_ext_src_config
) - Configure Xen Hypervisor if necessary (petalinux/
make update_xen_hypervisor
)
- Link Vivado's XSA file to project (petalinux/
- Build project (petalinux/
make update_build
) - Package BOOT Image for base platforms (petalinux/
make update_bootimage
) - Build & Package SysRoot for SDK/Vitis (petalinux/
make update_sysroot
) - Extract Versal Common Image from Xilinx's archive (petalinux/
make common_image
)1 - Create the
sd_card
directory with all required files for flashing the image to a compatible SD card (petalinux/make sd_card
)
- Clean the petalinux/ directory (petalinux/
To boot the Fractal Versal Platform image on HW, follow the instructions described on the UG1144-PetaLinux Tools Documentation: Reference Guide under the section Packaging and Booting > Booting PetaLinux Image on Hardware with an SD Card > Steps to Boot a PetaLinux Image on Hardware with SD card > Steps to Flash and Boot the PetaLinux Images Manually.
Additional make
targets are:
# Check the Xilinx's version installed in the host machine:
make check_all
# Build only the Vivado project:
make hw_platform
# Launch the Vivado project for inspection:
make launch_vivado
# Create the Docker container for building PetaLinux:
make petalinux-2021.2_docker
# Run the Docker container and open the terminal:
make run_petalinux_docker
# Build the PetaLinux image:
make petalinux_os
# Rebuild the PetaLinux image in case the configuration has been changed:
make update_petalinux_os
# Launch the Qemu emulator running the created PetaLinux image:
make qemu
# Build the SW platform:
make sw_platform
# Clean all the output products. Internally it calls:
# - make clean_hw_platform
# - make clean_docker
# - make clean_petalinux_os
# - make clean_sw_platform
make clean_all
# Clean all the Vivado output products:
make clean_hw_platform
# Clean the Docker container:
make clean_docker
# Clean the PetaLinux image:
make clean_petalinux_os
# Clean the SW platform:
make clean_sw_platform
The following diagram explains the build-flow dependencies.
Notes:
- The diagram should be read from top to down.
- The diagram is for illustration only. The actual build-flow is more sequential.
graph TD
DDR[DDR Memory Controllers] --> NOC
CIPS[CIPS configuration] --> BD
NOC[NoC] --> BD
AIE[AIE Wrapper] --> BD
CLOCK[Clocks] --> BD
RESET[Resets] --> BD
AXISMC[AXI SmartConnects] --> BD
AXIIRQ[AXI Interrup Controllers] --> BD
RTLM[RTL Modules] --> BD
BD[Block Design] --> VIVADO
TCLH[TCL Hooks] --> VIVADO
CONSTR[Constraints] --> VIVADO
PFMPROP[Platform Properties] --> VIVADO
VIVADO[Vivado HW Platform] --> PTLX
VIVADO[Vivado HW Platform] --> VITIS
PTLXPKG[PetaLinux Packages] --> PTLX
EXTLAY[External Sources/Layers] --> PTLX
PTLX[PetaLinux] --> VITIS
VITIS[Vitis SW Platform]
FRACTAL custom platform:
- CPU:
- 2x Arm Cortex-A72 cores (APU)
- 2x Arm Cortex-R5F cores (RPU)
- Memory:
- 8 GB DDR4
- 8 GB LPDDR4 (4x 16 Gb)
- GPU:
- Versal AI Engine
- Programmable Logic:
- Clocks:
- 62.5 MHz
- 125 MHz
- 250 MHz
- 333.33 MHz
- 500 MHz (default clock, with reset)
- Up to 15 RTL acceleration kernels (XRT)
- DSP Engine:
- DSP58 (27x24 multiplier, 58-bit wide accumulator, and negate functionality)
- Scalar fixed-point ALU mode
- Vector fixed-point ALU mode (3xINT8 dot product)
- Complex arithmetic unit mode (18x18 MACC)
- Floating-point arithmetic mode (32-bit single-precision & 16-bit half-precision, multiplier & adder)
- DSP58 (27x24 multiplier, 58-bit wide accumulator, and negate functionality)
- Clocks:
- Boot Mode:
- Micro SD
- QSPI (Boot Module)
- PetaLinux configuration:
- Main configuration:
petalinux-config
(project-spec/configs/config):- DTG Settings:
- Machine name (
CONFIG_SUBSYSTEM_MACHINE_NAME
):versal-vck190-reva-x-ebm-01-reva
(if using the BSP)template
(if using the template)
- Machine name (
- U-Boot configuration:
- Target (
CONFIG_SUBSYSTEM_UBOOT_CONFIG_TARGET
):xilinx_versal_virt_defconfig
- Target (
- Image Packaging configuration:
- Disable Initial RAM File System:
initramfs
(SUBSYSTEM_ROOTFS_INITRAMFS
) - Enable Initial RAM Disk:
initrd
(SUBSYSTEM_ROOTFS_INITRD
) - Initial RAM File System name (
CONFIG_SUBSYSTEM_INITRAMFS_IMAGE_NAME
):petalinux-image-minimal
- Root FS formats (
CONFIG_SUBSYSTEM_RFS_FORMATS
):cpio
cpio.gz
cpio.gz.u-boot
tar.gz
jffs2
ext4
- Disable Initial RAM File System:
- Firmware Version configuration:
- Hostname (
CONFIG_SUBSYSTEM_HOSTNAME
):fractal_versal
- Product (
CONFIG_SUBSYSTEM_PRODUCT
):fractal_versal
- Hostname (
- Yocto settings:
- Board name (
CONFIG_SUBSYSTEM_BOARD_NAME
):vck190
- Enable extended Yocto build tools (
YOCTO_BUILDTOOLS_EXTENDED
) - (Optional)
- Enable local Linux/Yocto sources (
CONFIG_YOCTO_BB_NO_NETWORK
) - Disable network Linux/Yocto sources (
CONFIG_YOCTO_NETWORK_SSTATE_FEEDS
) - Local sstate directory (
CONFIG_YOCTO_LOCAL_SSTATE_FEEDS_URL
):/tmp/petalinux/workspace/sstate_aarch64_2021.2/aarch64
- Enable local Linux/Yocto sources (
- Board name (
- DTG Settings:
- RootFS configuration:
petalinux-config -c rootfs
(project-spec/configs/rootfs_config):- File System packages:
- Base:
- Dandified YUM package manager (
dnf
) - File System Resize Tool (
e2fsprogs-mke2fs
&e2fsprogs-resize2fs
) - FPGA Manager Script (
fpga-manager-script
) - Haveged unpredictable random number generator (
haveged
) - Memory Technology Devices utilities (
mtd-utils
)
- Dandified YUM package manager (
- Console:
- Network:
- CAN utilities (
can-utils
) - OpenSSH (
openssh
,openssh-ssh
,openssh-sftp
,openssh-sftp-server
&openssh-sshd
)
- CAN utilities (
- Tools:
- Partition Editor (
parted
)
- Partition Editor (
- Utilities:
- Advanced Linux Sound Architecture (
alsa-tools
&alsa-utils
) - Bash completion (
bash-completion
) - File compression (
bzip2
,gzip
,unzip
& 'zip') - File information (
file
) - Basic directory searching utilities (
findutils
) - GNU Awk (
gawk
) - Git version control (
git
) - Global Regular Expression Print (
grep
) - HDD parameters (
hdparm
) - File visualization tool (
less
) - LMbench performance analysis (
lmbench
) - PCI utilities (
pciutils
) - (
pkgconfig
)
- Advanced Linux Sound Architecture (
- Network:
- Development:
- Binary utilities (
binutils
) - Python (See tables below for a detailed list of Python modules)
- Binary utilities (
- Libraries:
- Xilinx Runtime Library (
xrt
) - Xilinx AI Engine driver (
ai-engine-driver
)
- Xilinx Runtime Library (
- Miscellaneous:
- sysfs library (
libsysfs
)
- sysfs library (
- Base:
- PetaLinux package groups:
- PetaLinux basic (
packagegroup-petalinux
) - Sensor interface libraries (MRAA & UPM) (
packagegroup-petalinux-mraa
) - Open AMP for RTOS control (`packagegroup-petalinux-openamp)
- Open CV (
packagegroup-petalinux-opencv
) - PetaLinux utilities (
packagegroup-petalinux-utils
)
- PetaLinux basic (
- Image features:
- Auto login (
auto-login
)
- Auto login (
- Apps:
- GPIO demo (
gpio-demo
) - Peek-Poke (
peek-poke
)
- GPIO demo (
- File System packages:
- XEN Hypervisor configuration:
- Enable XEN Hypervisor package in RootFS configuration (
packagegroup-petalinux-xen
) - Include XEN device tree (xen.dtsi) in system-user.dtsi and device-tree.bbappend
- Enable XEN Hypervisor package in RootFS configuration (
- External sources configuration:
- External Yocto layers:
- TensorFlow (
meta-tensorflow
)
- TensorFlow (
- Custom layers:
- FRACTAL (
meta-fractal
- Empty right now)
- FRACTAL (
- External Yocto layers:
- Main configuration:
Python 2 | |||||
---|---|---|---|---|---|
python | python-core | python-gdbm | python-mime | python-pprint | python-syslog |
libpython2 | python-crypt | python-hotshot | python-misc | python-profile | python-terminal |
python-2to3 | python-ctypes | python-html | python-mmap | python-pydoc | python-tests |
python-argparse | python-curses | python-idle | python-modules | python-re | python-textutils |
python-audio | python-datetime | python-image | python-multiprocessing | python-resource | python-threading |
python-bsddb | python-db | python-io | python-netclient | python-robotparser | python-tkinter |
python-codecs | python-debugger | python-json | python-netserver | python-shell | python-unittest |
python-compile | python-difflib | python-lang | python-numbers | python-smtpd | python-unixadmin |
python-compiler | python-distutils | python-logging | python-pickle | python-sqlite3 | python-xml |
python-compression | python-email | python-mailbox | python-pkgutil | python-stringold | python-xmlrpc |
python-contextlib | python-fcntl | python-math | python-plistlib | python-subprocess | python-zlib |
Python 3 | |||||
---|---|---|---|---|---|
python3 | python3-ctypes | python3-git | python3-misc | python3-pprint | python3-sqlite3 |
libpython3 | python3-curses | python3-gitdb | python3-mmap | python3-profile | python3-stringold |
python3-2to3 | python3-datetime | python3-html | python3-modules | python3-pydoc | python3-syslog |
python3-async | python3-db | python3-idle | python3-multiprocessing | python3-pygobject | python3-terminal |
python3-asyncio | python3-dbus | python3-image | python3-netclient | python3-pyvenv | python3-tests |
python3-audio | python3-debugger | python3-io | python3-netserver | python3-resource | python3-threading |
python3-codecs | python3-difflib | python3-json | python3-nose | python3-scons | python3-tkinter |
python3-compile | python3-distutils | python3-logging | python3-numbers | python3-setuptools | python3-unittest |
python3-compression | python3-email | python3-mailbox | python3-numpy | python3-shell | python3-unixadmin |
python3-core | python3-fcntl | python3-math | python3-pickle | python3-smmap | python3-xml |
python3-crypt | python3-gdbm | python3-mime | python3-pkgutil | python3-smtpd | python3-xmlrpc |
- XSA: CIPS settings added manually; configured in the bd-files.
- This design is fully FAT-32 (ext4 is not used but can easily be enabled).
The following documents provide supplemental information for this tutorial.
It contains sections on AI Engine graph development, how to use the AI Engine compiler, AI Engine simulation, and performance analysis.
-
Versal Custom Thin Platform Extensible System It follows the same approach to create a thin Versal platform. For the PetaLinux configuration script documentation, please refer to this repository.
The following are links to Vitis's related information referenced in this tutorial:
The following are links to the XRT information used in this tutorial:
-
Documentation: Explains general XRT API calls used in the PS Host Application.
-
GitHub Repo: Contains the XRT source code.
-
XRT AIE API: Documents the AI Engine XRT API calls
- December 2021 - Initial Release
- March 2022 - Getting Started update explaining the whole build flow.
- April 2022 - Update to Xilinx's 2021.2 development flow
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0.
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Footnotes
-
During development of this platform, major roadblocks have been found such that the platform was not able to boot on HW with the output products from PetaLinux. We believe that the platform workflow is not yet ready for the Versal ACAP family of devices and that some of the PetaLinux Tool commands are not generating the appropriate images. Therefore, we recommend using the Versal common image offered by Xilinx as much as possible. For this project, only the BOOT.BIN binary and the RootFS image are used from the build process. The rest of the required files are taken from the the Versal Common Image. ↩