BELK-TN-005: Running PYNQ on Bora

From DAVE Developer's Wiki
Revision as of 12:58, 11 October 2018 by U0001 (talk | contribs) (Setting up the board)

Jump to: navigation, search
Info Box
Bora5-small.jpg Applies to Bora
BORA Xpress.png Applies to BORA Xpress

History[edit | edit source]

Version Date Notes

1.0.0

September 2018 First public release
1.1.0 October 2018 Moved to PYNQ 2.3

Introduction[edit | edit source]

As stated in the official documentation, Python Productivity for Zynq (Pynq)'s main goal is ...

... to make it easier for designers of embedded systems to exploit the unique benefits of APSoCs in their applications. Specifically, PYNQ enables architects, engineers and programmers who design embedded systems to use Zynq APSoCs, without having to use ASIC-style design tools to design programmable logic circuits.

PYNQ achieves this goal in three ways:

- Programmable logic circuits are presented as hardware libraries called overlays. These overlays are analogous to software libraries. A software engineer can select the overlay that best matches their application. The overlay can be accessed through an application programming interface (API). Creating a new overlay still requires engineers with expertise in designing programmable logic circuits. The key difference however, is the build once, re-use many times paradigm. Overlays, like software libraries, are designed to be configurable and re-used as often as possible in many different applications.

- PYNQ uses Python for programming both the embedded processors and the overlays. Python is a “productivity-level” language. To date, C or C++ are the most common, embedded programming languages. In contrast, Python raises the level of programming abstraction and programmer productivity. These are not mutually-exclusive choices, however. PYNQ uses CPython which is written in C, and integrates thousands of C libraries and can be extended with optimized code written in C. Wherever practical, the more productive Python environment should be used, and whenever efficiency dictates, lower-level C code can be used.

- PYNQ is an open-source project that aims to work on any computing platform and operating system. This goal is achieved by adopting a web-based architecture, which is also browser agnostic. We incorporate the open-source Jupyter notebook infrastructure to run an Interactive Python (IPython) kernel and a web server directly on the ARM Cortex A9 of the Zynq device. The web server brokers access to the kernel via a suite of browser-based tools that provide a dashboard, bash terminal, code editors and Jupyter notebooks. The browser tools are implemented with a combination of JavaScript, HTML and CSS and run on any modern browser.

source: https://pynq.readthedocs.io

This Technical Note shows hot to run PYNQ on Bora platform. It is worth remembering that, even though the procedure was tested on Bora, it should work on BoraX as well without any modification.

To see PYN in action, please see this clip.

Testbed's hardware and software configuration[edit | edit source]

As stated before, the procedure was tested on Bora/BoraEVB hardware platform.

With regard to the software configuration, the following versions were used:

Original root file system included several kernel drivers built as modules. The Linux kernel used for this test was different than the kernel released along with the PYNQ's root file system, however. Consequently, these modules were not compatible with the kernel running on Bora. To overcome this issue, these drivers were linked statically into the kernel image.

Setting up the board[edit | edit source]

U-Boot environment was configured in order to retrieve the kernel image and the device tree blob from the microSD card. Also, it was configured to make the kernel to mount the root file system from a partition of the microSD card.

The following box shows the full boot process (clock on the "Expand" box):

TBD aggiornare

Testing the PYNQ framework[edit | edit source]

The following image shows the PYNQ processes running.

Running processes ordered by memory occupation


To test the whole framework, the following testbed was used.

Testbed block diagram

The test consisted of the following steps:

  • First, a FIR filter was generated using the wizard provided by Vivado.
  • The resulting IP was instantiated in Programmable Logic (PL).
  • Using Jupyter Notebooks, the Python test code was edited and run.
    • Two different approaches were used: generic driver and IP-specific driver.

This example was inspired by the following tutorial: https://youtu.be/LoLCtSzj9BU.