Fail to load xclbin on custom board

Hi,

Recently, I ported Pynq 3.1 to the AXU15EGB board from Alinx. I have done this before successfully for Pynq 2.6, there I was able to load overlays and even DpuOverlays. However, I decided to move to Pynq 3.1, as this would allow me to work with newer Vitis AI versions.

The problem now is that when I try to load a basic bitstream, I get the following error:

Error loading xclbin: failed to load xclbin: Invalid argument
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
Input In [2], in <cell line: 1>()
----> 1 overlay = Overlay("dpu.bit")

File /usr/local/share/pynq-venv/lib/python3.10/site-packages/pynq/overlay.py:354, in Overlay.__init__(self, bitfile_name, dtbo, download, ignore_version, device, gen_cache)
    351     self.systemgraph = None
    353 if download:
--> 354     self.download()
    355 else:
    356     if gen_cache:

File /usr/local/share/pynq-venv/lib/python3.10/site-packages/pynq/overlay.py:432, in Overlay.download(self, dtbo)
    429         else:
    430             Clocks.set_pl_clk(i)
--> 432 super().download(self.parser)
    433 if dtbo:
    434     super().insert_dtbo(dtbo)

File /usr/local/share/pynq-venv/lib/python3.10/site-packages/pynq/bitstream.py:168, in Bitstream.download(self, parser)
    151 def download(self, parser=None):
    152     """Download the bitstream onto PL and update PL information.
    153 
    154     If device tree blob has been specified during initialization, this
   (...)
    166 
    167     """
--> 168     self.device.download(self, parser)

File /usr/local/share/pynq-venv/lib/python3.10/site-packages/pynq/pl_server/embedded_device.py:689, in EmbeddedDevice.download(self, bitstream, parser)
    685     fd.write(bitstream.binfile_name)
    687 self.set_axi_port_width(parser)
--> 689 self._xrt_download(parser.xclbin_data)
    690 super().post_download(bitstream, parser, self.name)

File /usr/local/share/pynq-venv/lib/python3.10/site-packages/pynq/pl_server/xrt_device.py:418, in XrtDevice._xrt_download(self, data)
    416     f.write(data)
    417 try:
--> 418     uuid = self.handle.load_xclbin("loaded.xclbin")
    419 except Exception as e:
    420     print(f"Error loading xclbin: {e}")

RuntimeError: failed to load xclbin: Invalid argument

And a warning appears on the terminal

[drm:zocl_xclbin_read_axlf [zocl]] ERROR xclbin m_mod 0 is not a PR mode

on dmesg I can see:

[ 2101.635240] fpga_manager fpga0: writing dpu.bin to Xilinx ZynqMP FPGA Manager
[ 2104.318273] [drm] Loading xclbin bdfae520-77d9-6d4b-c635-1fc5b5ed073c to slot 0
[ 2104.318302] [drm] skip kind 29(AIE_RESOURCES) return code: -22
[ 2104.318319] [drm:zocl_xclbin_read_axlf [zocl]] *ERROR* xclbin m_mod 0 is not a PR mode

and finally the jupyter log at /var/log/jupyter.log does not present any valuable insight.

Image creation and booting

Here is the spec file I wrote to create the image:

ARCH_Alinx := aarch64
BSP_Alinx := BSP0.bsp
FPGA_MANAGER_Alinx := 1

STAGE4_PACKAGES_Alinx := xrt pynq ethernet

I created the BSP myself from a Petalinux distro build on ver. 2024.1.

The next part might be irrelevant but am sharing it just in case its a device tree issue

In theory that BSP has a device tree that I wrote to be able to recognise the USB port and SD card slot. However, this doesn’t seem to transmit the final Pynq image, thus I have to do some gymnastics to get Pynq to boot properly.

It looks something like this.

&sdhci1 { 
disable-wp; 
no-1-8-v; 
}

However, when I boot Pynq the kernel uses the wrong speed to interact with the SD card and is not able to boot. To fix this, during u-boot I run the following commands:

load mmc 1:1 0x10000000 image.ub
fdt move 0x11921bcc 0x20000000
fdt addr 0x20000000
fdt resize 8192
fdt set /axi/mmc@ff170000 disable-wp
fdt set /axi/mmc@ff170000 no-1-8-v
setenv bootargs "console=ttyPS0,115200 root=/dev/mmcblk1p2 rw rootwait"
bootm 0x10000000 - 0x20000000

And finally, the bitstream I was trying to create is from a custom board I wrote on the DPU-Pynq repo[https://github.com/Xilinx/DPU-PYNQ\]. Please note that a bitstream created somewhere else does not work either, I tried.

Environment:

  • Vivado 2024.1
  • Vitis 2024.1
  • Petalinux 2024.1
  • Built image on ubuntu VM
  • Used prebuilt rootfs and sdist
  • AXU15EGB Board

Thank you guys very much and sorry to bother, it’s a very nice forum here.

P.S:
I would stay on the Pynq 2.6 image but when I try to run a model on the DPU I get fingerprints mismatch between the DPU and the model am running. If anyone knows how to fix that I would appreciatly greatly…

Hi @crispy245

DPU-PYNQ is not supported in PYNQ v3.1 due to vart compatibility.

PYNQ v3.0.1 still supports it though, so I would suggest porting your board to that version instead. The Vivado/Vitis/Petalinux tools PYNQ v3.0.1 supports is 2022.1.