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 Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • 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
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • 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 getting started 2020.1 + PYNQ setup
  • 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: 14 Sep 2020 4:25 PM Date Created
  • Views 2317 views
  • Likes 1 like
  • Comments 2 comments
  • fpga
  • minized
Related
Recommended

Minized getting started 2020.1 + PYNQ setup

bartokon
bartokon
14 Sep 2020
Hi!

 

 

In this little guide I would like to show you how to create Minized project with Vitis 2020.1 support and PYNQ.

 

If have problems with reading this blog visit hackster.io

First thing first

 

First thing we need is to clone Avnet repositories, they will be used as starting point for our new designs.

mkdir Avnet20201;

cd Avnet 20201;

git clone https://github.com/Avnet/petalinux.git -b 2020.1;

git clone https://github.com/Avnet/hdl.git -b 2020.1;

git clone https://github.com/Avnet/bdf.git -b master;

You should get something like this:
Screenshot from 2020-09-13 20-23-06.png

Now, lets source our environment with Vivado and petalinux settings.

source /home/bartek/Xilinx/Vivado/2020.1/settings64.sh

source /home/bartek/petalinux20201/settings.sh

If you don't know where are these files, look in the installation folder.
Screenshot from 2020-09-13 20-24-58.png

image

Now, navigate to Avnet petalinux folder and run "make_minized.sh" script.

cd petalinux/scripts; ./make_minized.sh;

Screenshot from 2020-09-13 20-28-26.png

The script should build full fledged petalinux project and package it to BSP.

Screenshot from 2020-09-13 20-44-32.png

 

Non-essential cleanup

Let's free some space on Minized FPGA.

Open Vivado project.

 

Screenshot from 2020-09-13 20-56-04.png

 

It's not a good idea to work on already existing project that is used to generate BSP's. The Best thing to do is just to create copy image
In top left corner click File → Project → save project as....
Screenshot from 2020-09-13 21-06-31.png

 

Now, as we have a backup project we can do some modifications.
Open block Design and remove unused Ipcore's.

 

Screenshot from 2020-09-13 21-09-39.png

 

I just removed everything besides the Wi-Fi controller and interrupt manager.
Screenshot from 2020-09-13 21-17-07.png

 

 

If you wish you can enable additional interfaces for Vitis.
I have enabled M02-M06 Interfaces on ps7_axi_periph
Screenshot from 2020-09-13 21-17-55.png

Save design and generate bitstream.

After bitstream generation is finished, export hardware project for petalinux and Vitis.

Click File → Export → Export

Screenshot from 2020-09-13 21-23-10.png

 

 

image

image

image

Constrains should be located in your project folder.

Screenshot from 2020-09-13 22-40-26.png

 

Inside "Boards" and "MINIZED" you will find project constrains
Now we have new.xsa ready. Let's create new petalinux project based on generated bsp.

petalinux-create -t project -s minized_2020_1.bsp -n MinizedFromBSP

Screenshot from 2020-09-13 23-07-52.png

 

 

Go to terminal and change referenced.xsa file for petalinux project

cd MinizedFromBSP;

petalinux-config --get-hw-description=/home/bartek/Avnet20201/MzWorkInProgress/

Enable FPGA Manager (for PYNQ)
Screenshot from 2020-09-13 23-03-39.png

image

Add extra.ext4 image format.

Screenshot from 2020-09-14 10-25-46.png

image

Exit and save.

We need to add Xilinx APF driver for XRT platforms.

Type:

petalinux-config -c kernel

 

Screenshot from 2020-09-13 23-16-03.png

image

image

image
And check Xilinx APF Accelerator driver and DMA support.
Exit and save changes.
Now let's make some modifications to the meta-avnet layer in our project.
Go to petalinux→projects→minized_2020_1
Screenshot from 2020-09-13 23-18-32.png

 

 

Meta-avnet provides yocto information about Avnet development boards, for example Minized. Petalinux automatically generate device-tree based on XSA you provided. As I have deleted Bluetooth and accelerometer interrupt I should remove their references from device-tree.
Open system-bsp.dtsi in meta-avnet layer.
Screenshot from 2020-09-13 23-22-38.png

 

First remove references to &bluetooth_uart and &axi_iic_0, also add:

zyxclmm_drm {

     compatible = "xlnx,zocl";

      status = "okay";

};

to &amba.

You should get something like this:

Screenshot from 2020-09-13 23-25-10.png

Go to terminal and type:

petalinux-create -t apps --template install -n jupyterandwifi --enable

Go to meta-user → reciepes-apps→jupyterandwifi
Screenshot from 2020-09-14 00-27-08.png

Open.bb append and change do_install()

do_install() {
install -d ${D}/${bindir}
install -m 0755 ${S}/jupyterandwifi ${D}/${bindir} 
}

 

to:

 

inherit update-rc.d
INITSCRIPT_NAME = "jupyterandwifi"
INITSCRIPT_PARAMS = "start 99 S ."
do_install() {
  install -d ${D}${sysconfdir}/init.d
  install -m 0755 ${S}/jupyterandwifi ${D}${sysconfdir}/init.d/jupyterandwifi
}
FILES_${PN} += "${sysconfdir}/*"

 

This will add "jupyterandwifi" script to init.d directory and run at startup.

Open "jupyterandwifi" script.

Screenshot from 2020-09-14 00-27-28.png

 

And write a little script.

#!/bin/sh
set -e

echo "Hello PetaLinux World"
FLAG="/usr/local/bin/quicksetup.log"

#Turn on WIFI
cp -f /usr/local/bin/wpa_supplicant.conf /etc/.
wpa_supplicant -Dnl80211 -iwlan0 -c /etc/wpa_supplicant.conf -B
sleep 2
udhcpc -i wlan0 &
sleep 1

#Start jupyter
if [ ! -f $FLAG ]; then
#Setup jupyter-notebook
jupyter-notebook --generate-config
jupyter-notebook password
touch $FLAG
fi

Exit and save.

user-rootfsconfig and add PYNQ packages

#Note: Mention Each package in individual line
#These packages will get added into rootfs menu entry

CONFIG_gpio-demo
CONFIG_peekpoke
CONFIG_jupyterandwifi
CONFIG_python3-pynq
CONFIG_python3-audio
CONFIG_python3-pillow
CONFIG_pynq-overlay
CONFIG_python3-jupyter
CONFIG_python3-pandas
CONFIG_python3-numpy
CONFIG_libstdc++

Feel free to look at PYNQ forum to learn more about creating petalinux with PYNQ support https://discuss.pynq.io/c/tutorials-workshops/15

Let's activate these packages.

Open terminal and type:

petalinux-config -c rootfs

 

Screenshot from 2020-09-14 00-10-22.png

image

image
Also go to "Petalinux Package Groups" and activate:

"packagegroup-petalinux-xrt"
"packagegroup-petalinux-python-modules"
"packagegroup-petalinux-lmsensors"
"packagegroup-petalinux"

You can always activate more if you need. Minized have 8GB of memory, so just keep rootfs <8GB

 

Screenshot from 2020-09-14 00-11-48.png

image

You can use "/" to search for extra packages.
Exit and save changes.
Also, remember to change "wpa_supplicant.conf" to match your WI-FI SSID and password
Screenshot from 2020-09-14 00-19-46.png

 

ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
update_config=1

network={
  key_mgmt=WPA-PSK
  ssid="MySsidName"
  psk="MyPassword"
}

 

Now we can build the project.
Type:

petalinux-build -c avnet-image-full;

petalinux-build --sdk;

"petalinux-build --sdk" will be used later by Vitis.

Go to linux→image and copy "rootfs.wic" to USB stick.

*You should format USB to ext4 format, as "rootfs.wic" is bigger than 4GB.*

Screenshot from 2020-09-14 09-40-39.png

image

Open "minized_2020_1" folder (That generated by./make_minized script) and use "boot_qspi_INITRD.sh" to program QSPI.

If you need more information, look at documentation "how_to_boot.txt"

Screenshot from 2020-09-14 09-32-23.png

./boot_qspi_INITRD.sh

or

xsdb boot_jtag_INITRD_MINIMAL.tcl

Now lets program EMMC memory from Minized.
Open your favorite terminal, I will use Cutecom, because I can just copy and paste all commands and relax image

sudo cutecom

use:

root

root

As a username and password.
Connect USB and second micro USB cable for it, to provide power.
You should see debug info after connecting USB device.

 

Screenshot from 2020-09-14 09-48-05.png

Now in Minized terminal type (I have added extra sleep commands just to be sure, that everything finishes unmounting):

umount /dev/mmcblk0*;
sleep 1;
dd if=/run/media/sda1/rootfs.wic of=/dev/mmcblk0;
sleep 1;
cp /media/sd-mmcblk0p1/avnet-boot/avnet_emmc.scr /media/sd-mmcblk0p1/boot.scr;
sleep 1;
umount /dev/mmcblk0*;
sleep 1;
parted /dev/mmcblk0 resizepart 2 100%;
sleep 1;umount /dev/mmcblk0*;
sleep 1;
e2fsck -f /dev/mmcblk0p2;
sleep 1;
resize2fs /dev/mmcblk0p2;
sleep 1;
flash_erase /dev/mtd2 0 0;
sleep 1;

reboot Minized

Vitis Platform

 

In the meantime let's create Vitis platform for Minized.
First create.bif

gedit bif.bif

Screenshot from 2020-09-14 09-57-41.png

 

And run "./sdk.sh" it should be located in MinizedFromBSP → images → linux folder.

./sdk.sh

Open Vitis 2020.1 and create new platform project.

 

Screenshot from 2020-09-14 10-08-38.png

image

Screenshot from 2020-09-14 17-10-55.png

image

Screenshot from 2020-09-14 17-06-29.png

 

image
Fill in the blank fields and build platform project.
Create new application project
Screenshot from 2020-09-14 17-13-23.png
image
image
image
Change project settings to hardware project and build vadd example.
Screenshot from 2020-09-14 17-17-15.png

 

After build is finished upload "MzPQ" and "vadd.xclbin" to Minized.
You can do it with jupyter notebook.
Screenshot from 2020-09-14 17-24-59.png
Screenshot from 2020-09-14 17-26-53.png

 

Now let's create BOOT.bin for Minized.
Click Xilinx → Create Boot Image
Screenshot from 2020-09-14 17-29-11.png

image

image
Click Xilinx → Program Flash and program QSPI memory.

Screenshot from 2020-09-14 17-33-14.png

 

Some tests

 

Reboot Minized and type:
export XILINX_XRT=/usr
chmod +x MzPQ
./MzPQ vadd.xclbin
Screenshot from 2020-09-14 17-39-50.png

 

*export XILINX_XRT=/usr* You can add it permanently by:
adding it to "/etc/environment"

echo XILINX_XRT=/usr >> /etc/environment

This will start jupyter-notebook.

jupyter-notebook --ip=0.0.0.0 --port=9090 --no-browser --allow-root &

Password for jupyter-notebook is generated at first startup where you entered password two times.
Create new notebook and run vadd
Screenshot from 2020-09-14 17-48-59.png

 

As you can see I got some errors with libsensors library, and FPGA isn't reprogrammed by PYNQ (which is good/bad for us because WI-FI driver won't crash). Soon there should be a proper tutorial how to make PYNQ image from petalinux, just wait for it and search at discuss.pynq.io image
This is it, thank you for reading.

 

Take care!




  • Sign in to reply

Top Comments

  • lightcollector
    lightcollector over 4 years ago +2
    Really great job Bartosz! I'm sure you know that almost all of the info here can be applied to any of the Zed and other Xilinx Zynq boards. Also, I think this approach is a more practical way to add PYNQ…
  • lightcollector
    lightcollector over 4 years ago

    Really great job Bartosz!

     

    I'm sure you know that almost all of the info here can be applied to any of the Zed and other Xilinx Zynq boards.  Also, I think this approach is a more practical way to add PYNQ and Jupyter to the resource limited MiniZed and many other boards.  That is as long as you can live without all of the apt packages and some other Ubuntu distribution features and get by with pypi.  This is what team PYNQ had in mind when they added PYNQ as a Petalinux package.

     

    Keep up the good work the MiniZed, you have taken it further than anyone and shared how with others!

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • bartokon
    bartokon over 4 years ago

    Ahh, element14 doesn't support multiple screenshots in one frame :\

    I will remember that image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
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