Xilinx ZYNQ UltraScale+ MPSoC - Development - Petalinux

From RidgeRun Developer Connection
< Xilinx ZYNQ UltraScale+ MPSoC
Revision as of 15:29, 31 August 2022 by Jrodriguez (talk | contribs) (Building and flashing the board)
Jump to: navigation, search






Previous: Development/Targeted Reference Designs (TRD) Index Next: Development/Vitis Baremetal





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
Rootfs configuration to enable all the Xilinx packages

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.


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 troubles logging in to the board after flashing you can enable Image Features->debug-tweaks.


Previous: Development/Targeted Reference Designs (TRD) Index Next: Development/Vitis Baremetal