Pynq 2.7 for Zybo-Z7

Hi everyone, I hope you’re okay. I was following this post by PeterOgden to create a Pynq 2.7 image for Zybo-Z7 and thought in sharing my experience.

For those interested in recreating the image you can follow these stages.

1. Create the Board Support Package (BSP) (30 min approx.)
Although the Pynq-Z2 and the Zybo-Z7 have the same FPGA (i.e. xc7Z020-clg400), they present some differences. So, the following specifications should be considered for the Zybo-Z7.

  • DDR part number: MT41K256M16 RE-125.
  • The PS UART1 is routed to the FTDI instead of the UART0 for the Pynq-Z2.
  • The Crystal oscillator has a frequency of 33.3333 MHz.

The Zybo-Z7/petalinux_bsp/hardware_project/zyboz7.tcl file was modified to considered the aforementioned. Also, the block diagram for the bsp is shown in bd_layout.pdf (38.4 KB).

  • $ source /tools/Xilinx/Vitis/2020.2/settings.sh
  • $ source ~/petalinux/2020.2/settings.sh
  • $ petalinux-util --webtalk off
  • Make sure that ~/PYNQ/boards/Zybo-Z7/Zybo-Z7.spec has the line BSP_Zybo-Z7 :=
  • $ cd ~/PYNQ/sdbuild
  • $ make bsp BOARDDIR=/home/user/PYNQ/boards BOARDS=“Zybo-Z7”
  • copy the bsp file from ~/PYNQ/sdbuild/output/bsp/Zybo-Z7/xilinx-zyboz7-2020.2.bsp to ~/PYNQ/boards/Zybo-Z7/. Thus, along the Zybo-Z7.spec.
  • Add the bsp to the Zybo-Z7.spec: BSP_Zybo := xilinx-zyboz7-2020.2.bsp.

2. Create the image (2h30 min approx.)
To make the port process simple, I deleted the logictools overlay and reduce the base overlay deleting the Arduino and Raspberry Pi peripherals. Also, I modified the Makefile inside the sdbuild folder to avoid compiling for all the boards (Pynq-Z1, Pynq-Z2, ZCU-104, sw_repo). The changes are after the Pynq repository is cloned in line 65 (you can check this changes in the file Makefile_sdbuild shared).
This changes also affect the ~/PYNQ/build.sh file.
The base overlay block diagram is shown in bd_layout.pdf (107.0 KB). Also the constraints file base.xdc was updated from the Zybo-Z7 master xdc.
The steps used were:

  • Download the PYNQ rootfs arm v2. 7 found in PYNQ - Python productivity for Zynq - Board The downloaded file is named focal.arm.2.7.0_2021_11_17.tar.gz and will be placed in ~/PYNQ/sdbuild/.
  • $ cd ~/PYNQ/sdbuild
  • $ make BOARDDIR=/home/user/PYNQ/boards BOARDS=“Zybo-Z7” PREBUILT=focal.arm.2.7.0_2021_11_17.tar.gz nocheck_images
  • Wait patiently, be happy :yum:

The image file named Zybo-Z7-2.7.0.img will be stored in ~/PYNQ/sdbuild/output. Its size will be around 7.6 GB.

3. Copy image to micro SD card (20 min approx.)
The steps used were:

  • $ cd ~/PYNQ/sdbuild/output
  • $ df -h
  • Select the device corresponding to your SD card. Be careful, you could damage your OS if choose wrong.
  • $ umount /dev/sXX1 (for instance mine was in /dev/sdb1).
  • $ sudo dd bs=4M if=Zybo-Z7-2.7.0.img of=/dev/sXX status=progress

That’s it :smiley:.
I know these instructions can be vague and lack of deep explanations. But my intention is to share the stages I followed, so you can adjust them to your own needs.

5 Likes

First thank you for showing such great example to this community.
Meantime, I would like to know if there is any issue or setting require on run the Makefile you modified?
It looks like extracting:
sed -e '105,165d' $(BUILD_ROOT)/PYNQ/build.sh
Still running the entire sh script and ends up building all.
Thank you

1 Like

Hi Brian, I hope you’re doing great :-). Issues could be present as each time you run the Makefile, git makes changes locally. To make sure the build.sh file is getting modified, you should check the ~/PYNQ/sdbuild/build/ directory and search for the build.sh copied there. Lines after the 105 are not needed (since they are forcing the Pynq repo to be cloned again for the Pynq-Z2 and compile the original overlays). One workaround could be to just delete those lines by hand.
I’m sorry I can’t guarantee the Makefile given will work as it is, because among tests I loss track of the changes made to my local copy of the PYNQ repository :sweat_smile:.
However, I’m sure you could get it working following the aforementioned :smiley: Please, let me know as soon as you get it.