• 0
malkauns

Dynamically load bitstream on Petalinux

Question

Posted (edited)

I have a Zybo Z7 board I want to be able to dynamically load my .bit file after the system has booted.  I am using petalinux-v2017.4-final-installer.run.  In earlier versions I was able to do: cat file.bit > /dev/xdevcfg to have the bitstream loaded into the FPGA.  However, /dev/xdevcfg does not exist for me.  Is there something I have to configure when building the project and configuring the kernel to get this device to show up or is there some other way that I should be doing this?

Edited by malkauns

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0

So it looks like /dev/xdevcfg is deprecated and /sys/class/fpga_manager/fpga0/firmware should be used instead.  However, after configuring Vivado to generate a .bin file I get the following error when trying to load the bitstream:

root@Zybo-Z7-20:~# cd /run/media/mmcblk0p2
root@Zybo-Z7-20:/run/media/mmcblk0p2# 
root@Zybo-Z7-20:/run/media/mmcblk0p2# mkdir /lib/firmware
root@Zybo-Z7-20:/run/media/mmcblk0p2# cp system_wrapper.bin /lib/firmware/
root@Zybo-Z7-20:/run/media/mmcblk0p2# echo system_wrapper.bin > /sys/class/fpga_manager/fpga0/firmware
fpga_manager fpga0: writing system_wrapper.bin to Xilinx Zynq FPGA Manager
fpga_manager fpga0: Invalid bitstream, could not find a sync word. Bitstream must be a byte swapped .bin file
fpga_manager fpga0: Error preparing FPGA for writing
-sh: echo: write error: Invalid argument

 

I read about using write_cfgmem to create a byte swapped bin file and tried the following TCL command in vivado:

write_cfgmem -format bin -loadbit "up 0x0 /path/to/bit/file/system_wrapper.bit" out.bin 

 

When trying to load the bitstream it results in the same error above.  How do I create a valid "byte swapped .bin file"?  Is there something wrong with my TCL command?

Share this post


Link to post
Share on other sites
  • 0

I can only get /dev/xdevcfg if I change "1496c680c6df2e3911feed13aa9663a851bf30e9" under Linux Components Selection -> Remote linux-kernel settings -> Remote Linux-kernel git TAG/Commit ID to "master".  But then I lose /dev/media0 for the camera.  Please advise.

Share this post


Link to post
Share on other sites
  • 0

Ah, I apologize... the Zybo-Z7 20 project is actually unique... While it is a 2017.4 it uses a 2018.2 kernel for Pcam support and the 2018.2 kernel has the FPGA manager as you said.

This page talks about swapping bytes and also references Xilinx's documentation on the FPGA manager

The Xilinx documentation doesn't mention byte swapping, but the section is called "Generating .bin from .bit file using Bootgen"

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now