element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
FPGA
  • Technologies
  • More
FPGA
Blog Minized - Vitis accleration 2019.2
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join FPGA to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: bartokon
  • Date Created: 17 Jul 2020 3:12 PM Date Created
  • Views 1552 views
  • Likes 0 likes
  • Comments 0 comments
  • minized_petalinux
  • avnet
  • zynq
  • vitis platform
  • bsp
  • minized
Related
Recommended

Minized - Vitis accleration 2019.2

bartokon
bartokon
17 Jul 2020

Hi!

 

I have created this little tutorial how to prepare your Minized for some acceleration in Vitis 2019.2 image

Project is built based on Avnet BSP and shows whole platform creation process.

Acceleration BSP is included in project, feel free to use your own XSA for design.

 

Creating your first project using Vitis acceleration flow could be a really time-consuming if you don't know its specific workflow. In this tutorial, I hope to give you some insight into creating Minized platform based on resources provided by Avnet. This specific platform will be based on 2019.2 version of tools, but the workflow in future releases should be similar image

Good tutorials:

https://www.element14.com/community/groups/fpga-group/blog/2020/04/28/avnet-hdl-git-howto

https://www.hackster.io/news/microzed-chronicles-vitis-acceleration-hardware-platform-creation-5ef634f49191

https://www.hackster.io/news/microzed-chronicles-vitis-sw-platform-fd3921137bcf

So, let's get started!

Preparing the environment

First, we need to create some working folder for example in home directory.

Go to your home directory and type

mkdir Avnet

Mine working directory is located in:

/home/bartek/Magisterka/Tutorial/Avnet/
cd Avnet

Clone Avnet's repositories containing necessary files:

git clone https://github.com/Avnet/bdf.git --branch master;
git clone https://github.com/Avnet/hdl.git --branch 2019.2;
git clone https://github.com/Avnet/petalinux.git --branch 2019.2;
image

Necessary modifications

Scripts we wish to use are still could not be ready! If you changed default directories, petalinux scripts will not be built bsp's properly.

The first thing we want to check the installation folder of Vivado and Petalinux

I have installed them in:

/home/bartek/Xilinx/Vivado/2019.2
/home/bartek/petalinux20192

Now knowing the right paths we can modify building scripts.

cd petalinux/scripts
gedit make_minized_emmc_enhanced_bsp.sh

and change:

APP_PETALINUX_INSTALL_PATH=/opt/petalinux-v2019.2-final
APP_VIVADO_INSTALL_PATH=/opt/Xilinx/Vivado/2019.2

To:

APP_PETALINUX_INSTALL_PATH=(petalinux install directory)
APP_VIVADO_INSTALL_PATH=(Vivado install directory)

For me it is:

image

 

APP_PETALINUX_INSTALL_PATH=/home/bartek/petalinux20192
image

 

APP_VIVADO_INSTALL_PATH=/home/bartek/Xilinx/Vivado/2019.2

it should look like this:

image

 

save changes and type:

./make_minized_emmc_enhanced_bsp.sh

Wait for the script to finish it could take some time.

Modify Vivado project

In this step, we will import Minized SD-CARD manager IP and connect it to EMIO ports of ZYNQ.

(If you don't have SD-CARD or PMOD just skip this step and Minized will boot using EMMC memory)

First, we need to open a project we want to modify. Open Vivado search for the project you want to work on. For this example, I will be using the"minized_petalinux" project.

image

 

Just double-click MINIZED.xpr and the project should open.

Click "Open Block Design"
image

 

As you can see the script you have used generated Vivado project and used it in creating petalinux system for your board!

Click "Add Sources"

The dialog should pop up

image

 

Click "Add Files" and search for sdcard_mgr.vhd
image

 

Click "Finish"

Now you need to add this IP to your already existing block design. Just drag and drop from your "Design Sources" to block design (Diagram window on the right)

Double click on ZYNQ "ps7" and click "SD 1"
image

 

Now modify ZYNQ PS to use EMIO ports instead of MIO.

image

 

Set SD 1 to EMIO and click "OK"

Now we need to connect IP core to EMIO ports and make external PMOD ports

Select all PMOD pins and click "ctrl + t" to make them external
Connect other pins to ZYNQ PS
image

 

The next step is adding new constrains regarding PMOD pins.

image

 

Open minized_petalinux.xdc and add:
#SD - CARD
set_property PACKAGE_PIN L15 [get_ports PMOD1_PIN1_0]
set_property IOSTANDARD LVCMOS33 [get_ports PMOD1_PIN1_0]

set_property PACKAGE_PIN M15 [get_ports PMOD1_PIN2_0]
set_property IOSTANDARD LVCMOS33 [get_ports PMOD1_PIN2_0]

set_property PACKAGE_PIN L14 [get_ports PMOD1_PIN3_0]
set_property IOSTANDARD LVCMOS33 [get_ports PMOD1_PIN3_0]

set_property PACKAGE_PIN M14 [get_ports PMOD1_PIN4_0]
set_property IOSTANDARD LVCMOS33 [get_ports PMOD1_PIN4_0]

set_property PACKAGE_PIN K13 [get_ports PMOD1_PIN7_0]
set_property IOSTANDARD LVCMOS33 [get_ports PMOD1_PIN7_0]

set_property PACKAGE_PIN L13 [get_ports PMOD1_PIN8_0]
set_property IOSTANDARD LVCMOS33 [get_ports PMOD1_PIN8_0]

set_property PACKAGE_PIN N13 [get_ports PMOD1_PIN9_0]
set_property IOSTANDARD LVCMOS33 [get_ports PMOD1_PIN9_0]

set_property PACKAGE_PIN N14 [get_ports PMOD1_PIN10_0]
set_property IOSTANDARD LVCMOS33 [get_ports PMOD1_PIN10_0]

Save everything then

Click "generate bitstream"

After generating finishes write in Tcl Console

write_hw_platform -force  -include_bit -file <your working dir>

For me:

write_hw_platform -force -include_bit -file /home/bartek/Magisterka/Tutorial/Avnet/petalinux/projects/minized_emmc_enhanced_2019_2/MINIZED_SD_MY_XSA.xsa

Modify Petalinux project

Open a new terminal in your minized_emmc_enhanced project

image

 

Now we need to source Petalinux settings.sh file.

Type in terminal:

source <dir to Petalinux installation folder>/settings.sh

For me:

source /home/bartek/petalinux20192/settings.sh

Change referenced xsa by writing:

petalinux-config --get-hw-description=<path to generated XSA>

This should pop up:

image

 

Open "Image Packaging Configuration"

and change root filesystem type, device node and the filesystem formats like this:

image

 

Go to DTG settings -> Kernel Bootargs
image

 

add "clk_ignore_unused"
image

 

Exit popup while saving changes.

Now we need to add Vitis XRT and ZOCL to our petalinux project.

We need to add:

CONFIG_xrt
CONFIG_xrt-dev
CONFIG_zocl
CONFIG_opencl-clhpp-dev
CONFIG_opencl-headers-dev
CONFIG_packagegroup-petalinux-opencv

to "user-rootfsconfig"

image
image

 

And modify "system-user.dtsi"

image

 

We need to add:

&amba {
     zyxclmm_drm {
          compatible = "xlnx,zocl";
          status = "okay";
     };
};

If you encounter errors from dtsi write this by your own hand and do not copy!

image

 

Save and exit

Type:

petalinux-config -c rootfs
Go to "user packages"
image

 

and turn on additional packages

image

 

If you are missing some library just go to "Filesystem Packages" or "Petalinux Package Groups" and add some, like python3, opg, openAMP or TOOLS TO FORMAT EMMC from ZYNQ.

Save and exit

Now we need to add DMA drivers to the kernel.

petalinux-config -c kernel

Make the following changes:

Device Drivers -> Generic Driver Options -> DMA Contiguous Memory Allocator -> Size in Mega Bytes change the size from 16 to 128 MB

image

 

Device Drivers -> Staging drivers -> Xilinx APF Accelerator driver

Device Drivers -> Staging drivers -> Xilinx APF Accelerator driver -> Xilinx APF DMA engines support

image
image
image

 

Save and exit

Time to build our system!

petalinux-build; petalinux-build --sdk;

The project should use the cache directory to speed up the build.

https://www.element14.com/community/groups/fpga-group/blog/2020/06/24/accelerating-petalinux-bsp-build-time

"petalinux-build" will generate files for ZYNQ to use.

petalinux-build --sdk will generate "sdk.sh" script that contains files for Vitis.

In the meantime

Prepare SD-CARD

We need to create two partitions on our SD-CARD one is for BOOT (/dev/mmcblk1p1) and one for ROOTFS (/dev/mmcblk1p2)

I will be using gparted for this step:

sudo gparted
image

 

Create two partitions.

One fat32 "BOOT" with "boot, esp" flag.
Second ext4 "root"

Now we need to mount our SD-CARD.

Create a temporary mounting directory:

cd ~;
mkdir mnt;

To see what devices are connected to our PC type:

ls -l /dev/ | grep sd

My SD card is named "sdc" and has two partitions "sdc1" - BOOT and "sdc2" - ROOT

image

 

We need to mount these.

To mount BOOT partition to /home/bartek/mnt type:

sudo mount /dev/sdc1 /home/bartek/mnt

The second partition mounted automatically for me.

image

Copy files to SD-CARD

Go to minized_emmc_enhanced project and go to /images/linux

The files we need:

image

 

rootfs.cpio etc... are remnants from the older build.

Make new directories for image.ub and boot components, copy generated files to new folders.

mkdir imageDir; 
mkdir bootComponents;
mkdir rootfs;

cp image.ub imageDir/image.ub;

cp u-boot.elf bootComponents/u-boot.elf;
cp zynq_fsbl.elf bootComponents/zynq_fsbl.elf;

cp rootfs.ext4 rootfs/rootfs.ext4;
imageDir should contain "image.ub"
bootComponents contain "u-boot.elf", "zynq_fsbl.elf"
rootfs contain "rootfs.ext4"

Go to rootfs and make new folder for mounting "rootfs.ext4"

cd rootfs;
mkdir mntpoint;
sudo mount rootfs.ext4 mntpoint;

Now type

sudo cp -rf mntpoint/* <second partition of SD-CARD>

for me:

sudo cp -rf mntpoint/* /media/bartek/252142d1-65c2-4f9c-9e9b-89a4bb450dbd

and copy "image.ub" to the first partition.

Go to "imageDir" and type:

sudo cp image.ub /home/bartek/mnt

After copying remember to use "sync" to prevent data loss.

sync

Unmount file systems.

sudo umount /home/bartek/mnt

SD-CARD is ready. Put it into PMOD.

image

 

Let's try to boot it

Go to Petalinux project and type:

petalinux-boot --jtag --fpga --u-boot

Open your favorite terminal (I'm using CuteCom).

The default password for root is root.

root
root
image

 

Now check if XRT is initialized successfully:

xbutil scan
image

 

XRT have detected [0] Edge device, so its all good.

Create bif file

We need to create bif file, that Vitis will use to generate BOOT.BIN for our system.

gedit output.bif

Bif should look like this:

//arch = zynq; split = false; format = BIN
the_ROM_image:
{
     [bootloader] <zynq_fsbl.elf>
     <bitstream>
     <u-boot.elf>
}

Create Vitis Minized Acceleration Platform

We will need to extract data from "sdk.sh" generated by "petalinux-build --sdk"

for this, we go to our

Avnet/petalinux/projects/minized_emmc_enhanced_2019_2/images/linux

folder and type:

./sdk.sh

And choose output location:

../linux/
The files will be extracted in images/linux/sysroots folder.

Open Vitis and create new platform project

image

 

Click "Finish"
image

 

Select "zynq_fsbl.elf" in bootComponents
image

 

Select all the other files and build platform
image
image
image

 

Create new application based on MinizedSD platform
image

 

Change target to "Hardware"

And build project.

After build finishes copy "MinizedSD_APP.exe" and "vadd.xclbin" to your "/home/root" folder on SD-card.

image

 

As you can see from console log:

sdcard_gen --xpfm /home/bartek/workspace20192/MinizedSD/export/MinizedSD/MinizedSD.xpfm --sys_config MinizedSD --bif /home/bartek/workspace20192/Minized_APP_system/Debug/system.bif --no_bitstream --sd_file /home/bartek/workspace20192/Minized_APP/Hardware/Minized_APP.exe

Vitis didn't packed our new bitstream in system project. To bypass this we could create our own BOOT.BIN

Click XIlinx -> Create boot image
image
image
image
image

 

And click "Create Image"

In the top left corner

Click Xilinx -> Program Flash

Set Minized to JTAG mode, find new BOOT.BIN and click "program"

image

 

OR

Use BOOT.BIN generated by Vitis in application SD-CARD folder.

image
image

Turn on your Minized in QSPI boot mode, and in terminal write:

export XILINX_XRT=/usr

And run our example program!

./MinizedSD_APP.exe vadd.xclbin

 

image

 

 

End

Thank you for your time.

I wish you successful projects!

 

Thanks to Tom Curran and Adam Taylor.

  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube