Bar
SpaceWire UK
Specialist providers of VHDL Intellectual Property & Design Services
BarBarBarBar
Tutorial
Missing Image!
Part 1 - Installation of tools, setup of environment and creation of project area

Introduction

This tutorial details the steps required for downloading, installing and setting up the Vitis, Vivado, Vitis HLS & PetaLinux tools.

Aims

The aims of this tutorial are as follows :-
  1. Customize tutorial (optional)
  2. Download tools
  3. Create installation directories
  4. Install Vitis, Vivado & Vitis HLS
  5. Install PetaLinux dependencies
  6. Install PetaLinux
  7. Setup terminal environment
  8. Install 3rd party tools
  9. Create user project area
  10. Create repository area
  11. Cleanup downloads
  12. Remove startup programs

1. Customize tutorial (optional)

The pages in this tutorial are dynamically reconfigurable to suit the file system in use, namely the root locations of projects, repositories and downloads. The options below allow these location to be modified. Cookies are used to store the modifications so they are applied to all pages within the same browser session. The text descriptions and bash commands change according to the options below so copy and paste without manual fiddling is made possible.

: projects location

: repos location

: downloads location

2. Download tools

Download the following files from Xilinx & Avnet into /home/steve/Downloads.
  1. Xilinx Unified Installer 2021.2 SFD (71.9 GB)
  2. ZED BSP (117.4 MB)
  3. ZedBoard Master XDC Rev C_D v3 (3.9 KB)

3. Create installation directories

Create Xilinx installation directory structure and change its ownership for user installation.
steve@Linux-Steve:/home/steve$ sudo mkdir /opt/Xilinx
steve@Linux-Steve:/home/steve$ sudo chown $(id -un):$(id -gn) /opt/Xilinx

4. Install Vitis, Vivado & Vitis HLS

Unzip the tarball & kick off the installation process.
steve@Linux-Steve:/home/steve$ tar -xzf /home/steve/Downloads/Xilinx_Unified_2021.2_1021_0703.tar.gz -C /home/steve/Downloads
steve@Linux-Steve:/home/steve$ /home/steve/Downloads/Xilinx_Unified_2021.2_1021_0703/xsetup
In the Welcome dialog click Next to proceed. Missing Image! In the Select Product to Install dialog select Vitis and click Next to proceed. Missing Image! In the Vitis Unified Software Platform dialog, expand the menu items and select only what is required based on licensing and disk space. The default is to install everything which uses 192.89 Gb of disk space. The following shows the minimum required to use the ZedBoard with a WebPack license. Once happy with the selections click Next to proceed. Missing Image! In the Accept License Agreements dialog, tick both I Agree boxes and click Next to proceed. Missing Image! In the Select Destination Directory dialog, enter /opt/Xilinx for the installation directory, untick the Create program group entries, untick the Create desktop shortcuts and click Next to proceed. Note the location of DocNav, this is not versioned like Vitis, Vivado & Vitis HLS, hence any existing DocNav installation at this location will be overwritten. Missing Image! In the Installation Summary dialog, review the details provided and click Install to proceed. Missing Image! The Installation Progress dialog will now appear showing the progress of the installation (takes around 45 minutes to complete). Missing Image! Once installation is complete the Xilinx Software Install dialog will appear, click OK to proceed. Missing Image! Depending on what devices were selected for installation will ultimately determine whether or not further dialogs appear regarding licensing arrangements. With just Zynq-7000 selected no further dialogs appear and the WebPack license will be used as default.

Install the cable drivers to gain access to the Zedboard hardware.
steve@Linux-Steve:/home/steve$ cd /opt/Xilinx/Vivado/2021.2/data/xicom/cable_drivers/lin64/install_script/install_drivers
steve@Linux-Steve:/opt/Xilinx/Vivado/2021.2/data/xicom/cable_drivers/lin64/install_script/install_drivers$ sudo ./install_drivers
steve@Linux-Steve:/home/steve$ cd ~

5. Install PetaLinux dependencies

PetaLinux has a number of dependencies that the installer does not automatically install. These can be found in the 2020.2 PetaLinux Package List spreadsheet along with the command required to install them. To make the installation run smoother the auto-approve option (-y) can be added to the command. For Xubuntu an extra package (libncurses5) is also required. Execute the modified install command to install the dependencies.
steve@Linux-Steve:/home/steve$ sudo apt-get install -y iproute2 gawk python3 python build-essential gcc git make net-tools libncurses5-dev tftpd zlib1g-dev libssl-dev flex bison libselinux1 gnupg wget git-core diffstat chrpath socat xterm autoconf libtool tar unzip texinfo zlib1g-dev gcc-multilib automake zlib1g:i386 screen pax gzip cpio python3-pip python3-pexpect xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev pylint3 libncurses5

6. Install PetaLinux

Kick off the installation process.
steve@Linux-Steve:/home/steve$ /home/steve/Downloads/Xilinx_Unified_2021.2_1021_0703/xsetup
In the Welcome dialog click Next to proceed. Missing Image! In the Select Product to Install dialog select PetaLinux (Linux only) and click Next to proceed. Missing Image! In the Select Edition to Install dialog select PetaLinux arm and click Next to proceed. Missing Image! In the Accept License Agreements dialog, tick both I Agree boxes and click Next to proceed. Missing Image! In the Select Destination Directory dialog, enter /opt/Xilinx for the installation directory, untick the Create program group entries, untick the Create desktop shortcuts and click Next to proceed. Missing Image! In the Installation Summary dialog, review the details provided and click Install to proceed. Missing Image! Once installation is complete the Xilinx Software Install dialog will appear, click OK to proceed. Missing Image!

7. Setup terminal environment

Create a shell script (xilinx_2021_2.sh) as shown below and place this inside the search path. Execute this (source xilinx_2021_2.sh) when using the Xilinx 2021.2 tools from inside a terminal. Alternatively add the source commands to the shell initialization file (/home/steve/.bashrc).

xilinx_2021_2.sh

  1. #!/bin/bash

  2. # Setup Vitis, Vivado, Vitis HLS & DocNav environment
  3. source /opt/Xilinx/Vivado/2021.2/settings64.sh
  4. # Setup PetaLinux environment
  5. source /opt/Xilinx/PetaLinux/2021.2/tool/settings.sh

If multiple versions of the tools are required then having a more comprehensive shell script that detects and allows the selection of specific tool versions can be very useful. An example of such a script is given below.

xilinx.sh

  1. #!/bin/bash

  2. #
  3. # File .......... xilinx.sh
  4. # Author ........ Steve Haywood
  5. # Version ....... 1.0
  6. # Date .......... 8 February 2021
  7. # Description ...
  8. #   Determine and list which Xilinx tools are available and let the user select
  9. # the require ones to use. Does not reverse any previously selected tools upon
  10. # selecting news ones so to is cleaner to use in a new Terminal session.
  11. #

  12. # Define install base location
  13. dir_base="/opt/Xilinx"

  14. # Define number of tools (Vivado, SDK, Vitis & PetaLinux)
  15. tools=4

  16. # Define tool directories, executables & settings scripts
  17. dir_tool=("Vivado" "SDK" "Vitis" "PetaLinux")
  18. exe_tool=("vivado" "xsdk" "vitis" "petalinux-build")
  19. set_tool=("settings64.sh" "settings64.sh" "settings64.sh" "tool/settings.sh")

  20. # Define terminal colours
  21. col_default=$(tput sgr0)
  22. col_red=$(tput setaf 1)
  23. col_green=$(tput setaf 2)
  24. col_blue=$(tput setaf 4)
  25. col_fail_pass=(${col_red} ${col_green})

  26. # Exit if script wasn't sourced
  27. if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
  28.   printf "Script needs to be sourced : source ${BASH_SOURCE[0]}\n"
  29.   exit 1
  30. fi

  31. # Get array of directories at base location
  32. readarray -t dirs < <(find "${dir_base}/${dir_tool[0]}" -mindepth 1 -maxdepth 1 -type d -printf '%P\n')

  33. # Sort directories array
  34. dirs=($(IFS=$'\n'; echo "${dirs[*]}" | sort))

  35. # Determine and list what tools are installed
  36. declare -A table
  37. printf "Xilinx tools available tools at ${dir_base} :-\n"
  38. for ((dir=1; dir<=${#dirs[@]}; dir++)); do
  39.   printf "${dir}) ${dirs[$((dir-1))]}"
  40.   for ((tool=0; tool<${tools}; tool++)); do
  41.     table[${dir}, ${tool}]=$([ ! -d "${dir_base}/${dir_tool[${tool}]}/${dirs[$((dir-1))]}" ]; echo $?)
  42.     printf "${col_default} - "
  43.     printf "${col_fail_pass[${table[${dir}, ${tool}]}]}"
  44.     printf "${dir_tool[${tool}]}"
  45.     printf "${col_default}"
  46.   done
  47.   printf "\n"
  48. done
  49. printf "0) Exit\n"
  50. printf "Please select tools required or exit"

  51. # Obtain user input and source settings for selected tools
  52. while true; do
  53.   read -p " : " sel
  54.   if ! [[ "${sel}" =~ ^[0-9]+$ ]] ; then
  55.     # User input is not a number
  56.     printf "Invalid choice, select again"
  57.   elif [ ${sel} -ge 1 ] && [ ${sel} -le ${#dirs[@]} ]; then
  58.     # User input is out of range
  59.     printf "\nTools are as follows :-\n" "${sel}"
  60.     for ((tool=0; tool<${tools}; tool++)); do
  61.       if [ ${table[${sel}, ${tool}]} -eq 1 ]; then
  62.         source "${dir_base}/${dir_tool[${tool}]}/${dirs[$((sel - 1))]}/${set_tool[${tool}]}" > /dev/null 2>&1
  63.         printf "${col_blue}${exe_tool[${tool}]}${col_default} @ "
  64.         bin=$(which "${exe_tool[${tool}]}")
  65.         if [ -z ${bin} ]; then
  66.           printf "${col_red}Not found!"
  67.         else
  68.           printf "${col_green}%s" "${bin}"
  69.         fi
  70.         printf "${col_default}\n"
  71.       fi
  72.     done
  73.     break
  74.   elif [ ${sel} -eq 0 ]; then
  75.     printf "Quiting without selection!\n"
  76.     break
  77.   else
  78.     printf "Invalid choice, select again"
  79.   fi
  80. done

Execution of the above script will yield something similar to what is shown below.
steve@Linux-Steve:/home/steve$ source xilinx.sh
Xilinx tools available tools at /opt/Xilinx :-
1) 2013.4 - Vivado - SDK - Vitis - PetaLinux
2) 2015.2 - Vivado - SDK - Vitis - PetaLinux
3) 2019.1 - Vivado - SDK - Vitis - PetaLinux
4) 2020.2 - Vivado - SDK - Vitis - PetaLinux
5) 2021.2 - Vivado - SDK - Vitis - PetaLinux
0) Exit
Please select tools required or exit : 5

Tools are as follows :-
vivado @ /opt/Xilinx/Vivado/2021.2/bin/vivado
vitis @ /opt/Xilinx/Vitis/2021.2/bin/vitis
petalinux-build @ /opt/Xilinx/PetaLinux/2021.2/tool/tools/common/petalinux/bin/petalinux-build

8. Install 3rd party tools

Although Vitis does have a terminal emulator built in having a standalone tool kicking around is very desirable. Quite a few are available, however for this tutorial MiniCom will be the tool of choice. If not already installed install it as shown below. Access to the serial port requires superuser privileges, to remove this restriction the user must be added to the dialout group as shown below (log out and back in for this to take effect).
steve@Linux-Steve:/home/steve$ sudo apt-get install minicom
steve@Linux-Steve:/home/steve$ sudo adduser $(id -un) dialout
Communicating with the Zedboard via MiniCom is achieved as shown below.
steve@Linux-Steve:/home/steve$ minicom -D /dev/ttyACM0 -b 115200
Squirreling projects away for later retrieval is a must have capability. There are many RCS tools available, however for this tutorial Subversion will be the tool of choice. If not already installed install it as shown below.
steve@Linux-Steve:/home/steve$ sudo apt-get install -y subversion
A decent text editor is a must have, ideally something with good column editing capabilities. There are loads of editors to choose from, however for this tutorial Sublime will be the tool of choice. If not already installed install it as shown below.
steve@Linux-Steve:/home/steve$ wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -
steve@Linux-Steve:/home/steve$ sudo apt-add-repository "deb https://download.sublimetext.com/ apt/stable/"
steve@Linux-Steve:/home/steve$ sudo apt install -y sublime-text
To add Verilog & VHDL syntax highlighting to Sublime, launch the tool and firstly install Package Control by going to Menu » Tools » Install Package Control.... Now goto Menu » Preferences » Package Control » Install Package and select SystemVerilog. Do the same for VHDL but select Smart VHDL at the end instead of SystemVerilog.

9. Create user project area

Create project directories and move the board support package & constraints for convenient access.
steve@Linux-Steve:/home/steve$ mkdir -p /home/steve/projects/common/{sw,fw,os,doc}
steve@Linux-Steve:/home/steve$ mv /home/steve/Downloads/avnet-digilent-zedboard-v2021.2-final.bsp /home/steve/projects/common/sw
steve@Linux-Steve:/home/steve$ unzip /home/steve/Downloads/zedboard_master_XDC_RevC_D_v3.zip -d /home/steve/projects/common/fw

10. Create repository area

Create directory where the subversion repositories will be stored.
steve@Linux-Steve:/home/steve$ mkdir -p /home/steve/repos

11. Cleanup downloads

Delete the unzipped installer directory and either delete or archive the installer tarball. Delete the constraints archive.
steve@Linux-Steve:/home/steve$ rm -r /home/steve/Downloads/Xilinx_Unified_2021.2_1021_0703
steve@Linux-Steve:/home/steve$ rm /home/steve/Downloads/zedboard_master_XDC_RevC_D_v3.zip

12. Remove startup programs

Remove the Xilinx Information Center from the list of autostart application by going to Xubuntu's Whisper menu and navigating to Settings » Session and Startup. Click on the Application Autostart tab within the Session and Startup window, untick Xilinx Information Center and then click Close.