PYNQ: PYTHON PRODUCTIVITY

ERROR downloading bitstream PYNQ OS for ZCU102

Hello,

I’m trying to build a working pynq OS for ZCU102. I built an OS but get the following error when I try to program the FPGA (running as root):
[ 336.509329] fpga_manager fpga0: Error while writing image data to FPGA
[ 336.554434] fpga_manager fpga0: Error while writing image data to FPGA
OSError: [Errno 12] Cannot allocate memory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “./driver/driver.py”, line 77, in
runtime_weight_dir = runtime_weight_dir
File “/home/xilinx/output_tfc-w1a1_ZCU102/driver/driver_base.py”, line 78, in init
super().init(bitfile_name, download=download, device=device)
File “/usr/local/lib/python3.6/dist-packages/pynq/overlay.py”, line 355, in init
self.download()
File “/usr/local/lib/python3.6/dist-packages/pynq/overlay.py”, line 419, in download
super().download(self.parser)
File “/usr/local/lib/python3.6/dist-packages/pynq/bitstream.py”, line 187, in download
self.device.download(self, parser)
File “/usr/local/lib/python3.6/dist-packages/pynq/pl_server/device.py”, line 770, in download
fd.write(bitstream.binfile_name)
OSError: [Errno 12] Cannot allocate memory

I can program the bitstream from the vivado hardware manager but not from the OS.
I’ve read many topics and try a lot a things without success.
Thanks for your help!

Nicolas

Can you try adding the following into your device-tree? On boards with more than 2 GB of RAM it’s possible that the contiguous memory region occurs over the 2G boundary and then the PMU can’t access the bitstream.

	reserved-memory {
		#address-cells = <2>;
		#size-cells = <2>;
		ranges;

		linux,cma {
			linux,cma-default;
			compatible = "shared-dma-pool";
			alloc-ranges = <0x0 0x0 0x0 0x7ff00000>;
			size = <0x0 0x20000000>;
			alignment = <0x0 0x2000>;
			reusable;
		};
	};
2 Likes

The line “alloc-ranges = <0x0 0x0 0x0 0x7ff00000>;” was missing in my device-tree.
It solve my problem!

Thanks you a lot!