Difference between revisions of "Xilinx ZYNQ UltraScale+ MPSoC/Development/Petalinux"

From RidgeRun Developer Connection
Jump to: navigation, search
m
 
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
<noinclude>
 
<noinclude>
{{Xilinx ZYNQ UltraScale+ MPSoC/Head|previous=Development/Targeted Reference Designs (TRD)|next=Development/Vitis Baremetal}}
+
{{Xilinx ZYNQ UltraScale+ MPSoC/Head|previous=Development/Targeted Reference Designs (TRD)|next=Development/Vitis Baremetal|keywords=}}
 
</noinclude>
 
</noinclude>
  
= Petalinux SDK installation =
+
{{DISPLAYTITLE:Xilinx ZYNQ UltraScale+ MPSoC Petalinux SDK |noerror}}
 +
 
 +
== Petalinux SDK installation ==
  
 
You can download the Petalinux SDK from [https://www.xilinx.com/support/download/index.html/content/xilinx/en/downloadNav/embedded-design-tools.html 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:
 
You can download the Petalinux SDK from [https://www.xilinx.com/support/download/index.html/content/xilinx/en/downloadNav/embedded-design-tools.html 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:
Line 17: Line 19:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
= Create a new project =  
+
== Create a new project ==  
  
 
Download the latest KV260 Starter Kit BSP from [https://www.xilinx.com/support/download/index.html/content/xilinx/en/downloadNav/embedded-design-tools.html Xilinx Embedded Design Tools]. In this case, we are going to use version 2022.1.
 
Download the latest KV260 Starter Kit BSP from [https://www.xilinx.com/support/download/index.html/content/xilinx/en/downloadNav/embedded-design-tools.html 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:
 +
 +
<syntaxhighlight lang=bash>
 +
petalinux-create -t project -s xilinx-kv260-starterkit-v2022.1-05140151.bsp -n sample-project
 +
</syntaxhighlight>
 +
 +
== Add Xilinx packages ==
 +
 +
 +
You can enable the specific Xilinx packages for the KV260 Starter kit by adding the packages to the rootfs configuration menu:
 +
 +
<syntaxhighlight lang=bash>
 +
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
 +
</syntaxhighlight>
 +
 +
If you are using a Petalinux version previous to 2022.1 you will also have to set the board variant as follows:
 +
 +
<syntaxhighlight lang=bash>
 +
echo 'BOARD_VARIANT = "kv"' >>  project-spec/meta-user/conf/petalinuxbsp.conf
 +
</syntaxhighlight>
 +
 +
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:
 +
 +
<syntaxhighlight lang=bash>
 +
petalinux-config -c rootfs
 +
</syntaxhighlight>
 +
<br>
 +
[[File:Kv260-rootfs-xilinx-packages.png|1000px|thumb|center|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:
 +
 +
<syntaxhighlight lang=bash>
 +
petalinux-create -t apps -n sample-app
 +
</syntaxhighlight>
 +
 +
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:
 +
 +
<syntaxhighlight lang=bash>
 +
petalinux-create -t apps --template fpgamanager -n sample-firmware --enable --srcuri "user.bit user.dtsi user.xclbin shell.json"
 +
</syntaxhighlight>
 +
 +
== 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:
 +
 +
<syntaxhighlight lang=bash>
 +
petalinux-build
 +
petalinux-package --wic --bootfiles "ramdisk.cpio.gz.u-boot boot.scr Image system.dtb"
 +
</syntaxhighlight>
 +
 +
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):
 +
 +
<syntaxhighlight lang=bash>
 +
sudo dd if=<image-file.wic> of=/dev/sdX bs=32M
 +
</syntaxhighlight>
  
 +
'''Note:''' if having trouble logging in to the board after flashing you can enable Image Features->debug-tweaks.
  
 
<noinclude>{{Xilinx ZYNQ UltraScale+ MPSoC/Foot|Development/Targeted Reference Designs (TRD)|Development/Vitis Baremetal}}</noinclude>
 
<noinclude>{{Xilinx ZYNQ UltraScale+ MPSoC/Foot|Development/Targeted Reference Designs (TRD)|Development/Vitis Baremetal}}</noinclude>

Latest revision as of 06:50, 2 December 2022






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.

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.


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