PYNQ: PYTHON PRODUCTIVITY

Ubuntu Focal?

Hello Everybody!
I am a little new to PYNQ, so I do not completely understand how the build process works. Having an image for my ultra96 board based on Ubuntu 20.04 would be very helpful. Is it possible to build an image based on newer Ubuntu version?

Thanks

You could try update the build scripts to use 20.04, however it may break no/few/some/lots of things.
There are a lot of (inter)dependencies in the PYNQ image that get tested and updated for each PYNQ release, so bumping the OS version on your own isn’t recommended.
Is there a compelling reason to use 20.04?

Cathal

Hi Cathal
Thanks for the reply!
My master thesis work includes controlling small drones, and using accelerated object detection. I have an Ultra96 board for that.

To control the drone, I intend to use ROS with the Pixhawk flight controller. I’m running into issues with setting up the RTPS bridge for ROS2 and PX4, that’s why MAVROS would be great, but that only works with ROS1. ROS1 Melodic would work fine, but it still uses Python2, and from what I understand PYNQ libs need Python3. ROS1 Noetic uses Python3, but it requires Ubuntu Focal.

I intend to use a PYNQ DNN overlay in one of the ROS nodes to detect the relative position of a specific object.

Given these, I either need to:

  1. Build a Focal based image for the board for ROS Noetic
  2. Build ROS Melodic with Python3 support for the board
  3. Build the ROS2-ROS1 bridge so I can use Melodic (ROS1) for drone control and Eloquent (ROS2) for managing PYNQ calls
  4. Get the RTPS bridge working on the board so I don’t need MAVROS at all

I’ve been trying #4 but it proves to be difficult, partially because of compatibility with aarch64 instead of amd64. I’m looking at other options now.

If I could get a Focal based PYNQ image it would make my life a lot simpler right now.

Can you use docker to run your application?
pynq 2.6 supports docker by default, this may be the easiest solution for you

Mario

can I run python programs that use the pynq libraries with the FPGA from within a Focal docker image?

Yes, please read the last paragraph of the link above.

Hey @marioruiz
I’ve tried with an Ubuntu 20 based docker image and an Ubuntu 20 based Petalinux image running on the board, and I’m having the same issue when trying to install pynq with pip3 install pynq.

At first it cannot find xf86drm.h, so I install libdrm-dev with sudo apt install libdrm-dev.

Afterwards the pynq installation fails one step further, trying to import drm.h. Do you have an idea on what might be the issue?

The error message:

creating build/lib/pynq/tests
    copying pynq/tests/test_pl.py -> build/lib/pynq/tests
    copying pynq/tests/test_mmio.py -> build/lib/pynq/tests
    copying pynq/tests/util.py -> build/lib/pynq/tests
    copying pynq/tests/test_su.py -> build/lib/pynq/tests
    copying pynq/tests/test_gpio.py -> build/lib/pynq/tests
    creating build/lib/pynq/lib/tests
    copying pynq/lib/tests/test_rgbled.py -> build/lib/pynq/lib/tests
    copying pynq/lib/tests/test_audio.py -> build/lib/pynq/lib/tests
    copying pynq/lib/tests/test_video.py -> build/lib/pynq/lib/tests
    copying pynq/lib/tests/test_switch.py -> build/lib/pynq/lib/tests
    copying pynq/lib/tests/test_led.py -> build/lib/pynq/lib/tests
    copying pynq/lib/tests/test_button.py -> build/lib/pynq/lib/tests
    copying pynq/lib/tests/pynq_welcome.pdm -> build/lib/pynq/lib/tests
    running build_ext
    make PYNQ_BUILD_ARCH=aarch64 -C pynq/lib/_pynq/_displayport/
    make: Entering directory '/tmp/pip-install-dp14u5s_/pynq/pynq/lib/_pynq/_displayport'
    g++ -fPIC -I=/usr/include/libdrm -c -g -std=c++11 displayport.cpp
    In file included from displayport.cpp:14:
    /usr/include/xf86drm.h:40:10: fatal error: drm.h: No such file or directory
       40 | #include <drm.h>
          |          ^~~~~~~
    compilation terminated.
    make: *** [Makefile:8: all] Error 1
    make: Leaving directory '/tmp/pip-install-dp14u5s_/pynq/pynq/lib/_pynq/_displayport'
    error: command 'make' failed with exit status 2
    ----------------------------------------

edit: drm.h exists and is in /usr/include

$ ll /usr/include/libdrm
total 576
drwxr-xr-x   3 root root  4096 Feb 15 21:04 ./
drwxr-xr-x 127 root root 16384 Feb 15 21:04 ../
-rw-r--r--   1 root root 31894 May 27  2020 amdgpu_drm.h
-rw-r--r--   1 root root 55079 May 27  2020 amdgpu.h
-rw-r--r--   1 root root 32818 May 27  2020 drm_fourcc.h
-rw-r--r--   1 root root 32306 May 27  2020 drm.h
-rw-r--r--   1 root root 24920 May 27  2020 drm_mode.h
-rw-r--r--   1 root root  2782 May 27  2020 drm_sarea.h
-rw-r--r--   1 root root  6977 May 27  2020 etnaviv_drmif.h
-rw-r--r--   1 root root 62951 May 27  2020 i915_drm.h
-rw-r--r--   1 root root  7895 May 27  2020 mach64_drm.h
-rw-r--r--   1 root root 13010 May 27  2020 mga_drm.h
-rw-r--r--   1 root root 12105 May 27  2020 msm_drm.h
drwxr-xr-x   3 root root  4096 Feb 15 21:04 nouveau/
-rw-r--r--   1 root root  7000 May 27  2020 nouveau_drm.h
-rw-r--r--   1 root root  4131 May 27  2020 qxl_drm.h
-rw-r--r--   1 root root 10000 May 27  2020 r128_drm.h
-rw-r--r--   1 root root 16388 May 27  2020 r600_pci_ids.h
-rw-r--r--   1 root root  1991 May 27  2020 radeon_bo_gem.h
-rw-r--r--   1 root root  2839 May 27  2020 radeon_bo.h
-rw-r--r--   1 root root  1678 May 27  2020 radeon_bo_int.h
-rw-r--r--   1 root root  1601 May 27  2020 radeon_cs_gem.h
-rw-r--r--   1 root root  5121 May 27  2020 radeon_cs.h
-rw-r--r--   1 root root  2179 May 27  2020 radeon_cs_int.h
-rw-r--r--   1 root root 38317 May 27  2020 radeon_drm.h
-rw-r--r--   1 root root  5968 May 27  2020 radeon_surface.h
-rw-r--r--   1 root root  7170 May 27  2020 savage_drm.h
-rw-r--r--   1 root root  2633 May 27  2020 sis_drm.h
-rw-r--r--   1 root root 14877 May 27  2020 tegra_drm.h
-rw-r--r--   1 root root  2406 May 27  2020 tegra.h
-rw-r--r--   1 root root 14457 May 27  2020 vc4_drm.h
-rw-r--r--   1 root root 16906 May 27  2020 vc4_packet.h
-rw-r--r--   1 root root  8244 May 27  2020 vc4_qpu_defines.h
-rw-r--r--   1 root root  8372 May 27  2020 via_drm.h
-rw-r--r--   1 root root  5010 May 27  2020 virtgpu_drm.h
-rw-r--r--   1 root root 32085 May 27  2020 vmwgfx_drm.h

edit: ignore this, new thread