Xilinx ZYNQ UltraScale+ MPSoC Petalinux SDK
Xilinx ZYNQ UltraScale+ MPSoC | ||||
---|---|---|---|---|
Introduction | ||||
Getting Started | ||||
Xilinx Kria | ||||
Development | ||||
Development Flows Examples | ||||
GStreamer | ||||
|
||||
Contact Us |
Petalinux SDK installation
You can download the Petalinux SDK from Xilinx Embedded Design Tools or using the Vivado Unified installer. Even if you use the unified installer you will need to install the SDK by executing the installer:
./petalinux-v2022.1-final-installer.run
Then, whenever you need the SDK you can load the environment by sourcing the settings.sh file from the installation directory.
source settings.sh
Create a new project
Download the latest KV260 Starter Kit BSP from Xilinx Embedded Design Tools. In this case, we are going to use version 2022.1.
A new Petalinux project using the downloaded template can be created with:
petalinux-create -t project -s xilinx-kv260-starterkit-v2022.1-05140151.bsp -n sample-project
Add Xilinx packages
You can enable the specific Xilinx packages for the KV260 Starter kit by adding the packages to the rootfs configuration menu:
cd sample-project echo 'CONFIG_packagegroup-kv260-smartcam' >> project-spec/meta-user/conf/user-rootfsconfig echo 'CONFIG_packagegroup-kv260-aibox-reid' >> project-spec/meta-user/conf/user-rootfsconfig echo 'CONFIG_packagegroup-kv260-defect-detect' >> project-spec/meta-user/conf/user-rootfsconfig echo 'CONFIG_packagegroup-kv260-nlp-smartvision' >> project-spec/meta-user/conf/user-rootfsconfig
If you are using a Petalinux version previous to 2022.1 you will also have to set the board variant as follows:
echo 'BOARD_VARIANT = "kv"' >> project-spec/meta-user/conf/petalinuxbsp.conf
After that, you can enter the rootfs configuration menu and activate each package by typing 'y' next to each one inside the user packages menu:
petalinux-config -c rootfs
Creating your own app
To create a custom application to include in your image you can execute the following command:
petalinux-create -t apps -n sample-app
This will create the app inside the project-spec/meta-user/recipes-apps/sample-app directory which you can modify as you wish. For now, we will leave the default app which prints "Hello World!" to stdout.
Creating your own FPGA firmware
Create Vivado project
Create a new Vivado RTL project and select the Kria KV260 Vision AI Starter Kit as the board. If you are using Vivado older than 2022.1 you may need to install the board from Tools > Vivado Store.
Add the firmware to Petalinux
To create a custom firmware you can provide the required files to the fpgamanager template as follows:
petalinux-create -t apps --template fpgamanager -n sample-firmware --enable --srcuri "user.bit user.dtsi user.xclbin shell.json"
Building and flashing the board
Once you are happy with the packages included in your Petalinux image you can build it and generate the SD card image as follows:
petalinux-build petalinux-package --wic --bootfiles "ramdisk.cpio.gz.u-boot boot.scr Image system.dtb"
This will create the image file images/linux/petalinux-sdimage.wic which you can use to flash the SD card with BalenaEtcher or with the following commands (replace sdX with the correct device):
sudo dd if=<image-file.wic> of=/dev/sdX bs=32M
Note: if having trouble logging in to the board after flashing you can enable Image Features->debug-tweaks.