Avnet / Ultra96 Pynq
Labels
Projects that are alternatives of or similar to Ultra96 Pynq
Grab the pre-built SD images
Click the releases tab above or click here to obtain SD card images and instructions for Ultra96 v1 or v2
Xilinx Vitis AI hardware accelerated inference for PYNQ >= v2.5
Built for Ultra96 v1/2 and also ZCU104 and ZCU111, click here for how to get started!
Build your own PYNQ SD image for Ultra96 v1/v2
This is optional for advanced users if they want to rebuild their own U96 PYNQ images.
This repository contains source files and instructions for building PYNQ to run on the Ultra96 board.
Building PYNQ for Ultra96 can take many hours to complete. Plan accordingly!
Required tools:
- Ubuntu 16.04 or 18.04 LTS 64-bit host PC
- Passwordless SUDO privilege for the building user
- At least 160GB of free hard disk space if you do not have the Xilinx tools installed yet
- Roughly 80GB of free hard drive space if you have the Xilinx tools installed
- You may be able to work with less free hard drive space, YMMV
- At least 8GB of RAM (more is better)
- Xilinx Petalinux and Vitis or Vivado (find the version compatible with a specific PYNQ release at Xilinx Tool Version)
- Read Xilinx UG1144 for Petalinux host PC setup requirements
- Create a Xilinx account to obtain and license the tools
- Note: for web-pack and some other users, building will fail because of not having a license for a required HDMI IP core
Step 1: Clone and configure the Ultra96 repository
Retrieve the Ultra96 PYNQ board git into a new directory somewhere outside the PYNQ git directory. You can define the path to this new directory as shown (adjust this path if you like).
export LOCAL_ULTRA96=$(pwd)/ultra96-pynq-git
Then clone the repository and setup Ultra96-PYNQ git to work on the image_v2.6.0
branch.
git clone https://github.com/Avnet/Ultra96-PYNQ.git $LOCAL_ULTRA96
cd $LOCAL_ULTRA96
git checkout -b image_v2.6.0 origin/image_v2.6.0
Using pre-built BSP and overlay files
Pre-built Ultra96 v1 and v2 BSPs and overlays for the current release are included under the GitHub Release File Assets. To download assets to prepare for the build:
- From the github RELEASE asset list please download either the
ultra96v1_bsp.zip
(for U96 v1) or theultra96v2_bsp.zip
(for U96 v2) and extract the contents. - Place either the v1 (
sensors96b_v1.bsp
) or v2 (sensors96b_v2.bsp
) BSP file into the$LOCAL_ULTRA96/Ultra96
folder. - From the same zip file (for either the v1 or v2) place both
sensor96b.hwh
andsensors96b.bit
files into the$LOCAL_ULTRA96/Ultra96/sensors96b
folder.
Creating your own BSP
Alternatively, if you would like to start with your own or a new BSP see notes at bottom. If you do prepare a new custom BSP you may also need to create your own overlay. It is suggested that you use the included sensors96b overlay tcl as a starting point.
With either the pre-built BSP, or your own BSP, you must setup soft links depending upon whether you are using Ultra96 v1 or v2.
For Ultra96 v1:
cd $LOCAL_ULTRA96/Ultra96
ln -s specs/Ultra96_v1.spec Ultra96.spec
ln -s petalinux_bsp_v1 petalinux_bsp
For Ultra96 v2:
cd $LOCAL_ULTRA96/Ultra96
ln -s specs/Ultra96_v2.spec Ultra96.spec
ln -s petalinux_bsp_v2 petalinux_bsp
Step 2: Setup the PYNQ repository and building environment
Retrieve the main PYNQ repo into a new directory somewhere outside the Ultra96-PYNQ directory. You can define the path to this new directoy (adjust this path if you like).
export LOCAL_PYNQ=$(pwd)/pynq-git
Clone and setup PYNQ git to work on a branch (for example, image_v2.6.0
).
git clone https://github.com/Xilinx/PYNQ.git $LOCAL_PYNQ
cd $LOCAL_PYNQ
git checkout origin/image_v2.6.0
Configure and install build tools, this will take some effort and will be an iterative process. Run setup_host.sh
to install missing tools, make checkenv
to check if all tools are installed.
cd sdbuild
./scripts/setup_host.sh
make checkenv
Step 3: Build PYNQ image
In your local PYNQ repository while still in the sub directory sdbuild
, run make.
IMPORTANT: For the BOARDDIR path setting it should be absolute not relative, you have been warned!
make clean
make BOARDDIR=$LOCAL_ULTRA96
Once the build has completed (it will take a long long time), if successful an SD card image will be available under the PYNQ git directory sdbuild/output
. Depending on the PYNQ release, the image may have different names. As an example, for PYNQ v2.6, the image is Ultra96-2.6.img
.
Use Etcher or Win32DiskImager to write this image to an SD card.
Insert card, PYNQ should boot up on the Ultra96!
For more information about how to setup and use PYNQ for Ultra96, please refer to the online documentation.
Build PYNQ-compatible BSPs from scratch
Notes: Pre-built 2020.1 PetaLinux BSPs can be found under the GitHub v2.6.0 Releases Asset Files. If you optionally use these, you would skip the steps below to create and configure the BSPs from scratch and copy the prebuilt BSP to the location of where the build from scratch procedures creates them.
To get started you must obtain and install Xilinx Vitis or Vivado and Petalinux on Ubuntu 16.04 LTS. For Xilinx tools, you will need a version compatible with the PYNQ release (for Xilinx tool compatibility, see Xilinx Tool Version). If you are installing the Xilinx tools for the first time on your existing setup you must read Xilinx UG1144 for Petalinux setup requirements.
If you prefer, you can also setup all the tools on a VirtualBox VM (e.g. using Vagrant software).
Step 1: Hardware design
Use the Xilinx Vivado tools to generate the hardware design. The hardware design source files contain a PL (Xilinx Programmable Logic) design sensors96b that enables U96 PYNQ to interact with a Grove mezzanine board. The hardware design also contains Ultra96 board specific settings. After building the hardware design, it will need to be manually imported into the Petalinux BSP.
To build the hardware design for Ultra96 v1:
cd $LOCAL_ULTRA96/Ultra96/sensors96b
cp -f sensors96b.tcl.v1 sensors96b.tcl
make
To build the hardware design for Ultra96 v2:
cd $LOCAL_ULTRA96/Ultra96/sensors96b
cp -f sensors96b.tcl.v2 sensors96b.tcl
make
Step 2: Create and configure BSP
After the hardware design has finished building and you have installed Petalinux, create the Ultra96 BSP by executing:
cd $LOCAL_ULTRA96
mkdir bsp
cd bsp
petalinux-create -t project -n sensors96b --template zynqMP
cd sensors96b
petalinux-config --get-hw-description=../../Ultra96/sensors96b
After the system config menus appear you need to set the following case-sensitive values, after completion exit and save:
- Subsystem AUTO Hardware Settings → Serial Settings → PMUFW serial stdin/stdout → (psu_uart_1)
- Subsystem AUTO Hardware Settings → Serial Settings → FSBL serial stdin/stdout → (psu_uart_1)
- Subsystem AUTO Hardware Settings → Serial Settings → ATF serial stdin/stdout → (psu_uart_1)
- Subsystem AUTO Hardware Settings → Serial Settings → DTG serial stdin/stdout → (psu_uart_1)
- DTG Settings → MACHINE_NAME → (avnet-ultra96-rev1)
- u-boot Configuration → u-boot config → (other) (Note: "other" is the default setting, leave it this way!)
- u-boot Configuration → u-boot config target → set this to nothing, delete default and make it blank!
- Image Packaging Configuration → Root filesystem type → (EXT4 (SD/eMMC/SATA/USB))
- Yocto Settings → YOCTO_MACHINE_NAME → (ultra96-zynqmp)
To work around a potential bug for Ultra96 that prevents including your own hardware design you must edit:
$LOCAL_ULTRA96/bsp/sensors96b/project-spec/meta-user/conf/petalinuxbsp.conf
.
Add the following line at the bottom of the file:
MACHINE_FEATURES_remove_ultra96-zynqmp = "mipi"
For Ultra96 v2 you may want to remove the TI WiFi driver module. To do this:
petalinux-config -c kernel
Locate the following configuration:
- Device Drivers → Network device support → Wireless LAN → Texas Instrument devices
Deselect it (type 'N') and exit, exit, exit. When asked, save the configuration using the default name and exit.
Step 3: Package BSP
Finish creating the BSP by packaging it up into a single BSP file and placing it for PYNQ to find.
For Ultra96 v1:
cd $LOCAL_ULTRA96/bsp
petalinux-package --bsp --force -p sensors96b --hwsource ../Ultra96/sensors96b/sensors96b --output ../Ultra96/sensors96b_v1.bsp
For Ultra96 v2:
cd $LOCAL_ULTRA96/bsp
petalinux-package --bsp --force -p sensors96b --hwsource ../Ultra96/sensors96b/sensors96b --output ../Ultra96/sensors96b_v2.bsp
Note: The PYNQ packages scripts and extra files will also pull in and override some settings for any bsp automatically. For example the v2 Microchip wifi driver.