PYNQ: PYTHON PRODUCTIVITY

Cannot write .bin file to fpga0/firmware

Hello,

Trying to use an open source project (FOS FPGA OS) based on PYNQ 2.3, I’m trying to reconfigure the FPGA PL. I have generated valid .bin, .bit and .hwh files that I have tested using the PYNQ Overlay libraries.

The project in question uses python to reconfigure the FPGA with the following code snippet:

with open("/sys/class/fpga_manager/fpga0/firmware", "w") as binout:
    binout.write("./bitstreams/static_full_vadd.bin")
    binout.close()

Edit: The given paths are valid

On the PYNQ’s jupyter notebook, this returns the following error:

FileNotFoundError: [Errno 2] No such file or directory

Since this supposedly uses the inbuilt Xilinx FPGA Manager, I tried to echo the bin file in fpga0/firmware, wich didn’t return anything (neither an error nor the message fpga_manager fpga0: writing system_wrapper.bit.bin to Xilinx Zynq FPGA Manager). I could not test the bin this way however.

I know the PYNQ project would rather recommend using the Overlay library to reconfigure the PL, but I was worried about this issue since I thought I could still reconfigure the FPGA this way.

Is this a know issue, or is there any steps that I missed (such as configuring the Xilinx FPGA Manager) to make it work on PYNQ?

Sorry if my question is out of the PYNQ project’s scope, feel free to close the topic if it is :slight_smile:

Board: PYNQ-Z2
PYNQ version: 2.3

All bin files to loaded on the FPGA manager must be placed in /lib/firmware and then the name of the file is written to firmware.

Note that you also need the bin file created from bootgen not the binary output of vivado.

Peter

Thanks PeterOgden, copying the file in /lib/firmware seems to solve the problem as the Python now works.

I still don’t have output from the Xilinx FPGA Manager, but I guess that’s some output issue I could workaround.