cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Adventurer
Adventurer
2,095 Views
Registered: ‎04-14-2015

how to read .bit file in linux command line

Hi,,,

I am loaded linux linaro on SD card and then i am able to boot the linaro linux from Zedboard and had connected wireless keyboard and mouse to the Zedboad, so basically it acts like a complete graphical linux without need of any external PC. now I want to know is it possible to run .bit file in Linux command line which is running in Zedboard.

 

i want to create a project where i want to use the PL section of zedboard, or if i want to use LEDS or switches of the zedboard at the same time running linux from Zedboard. 

normally what i used to do is to create project in vivado, then export the bit stream file to sdk and from there by programming the Zedboard and then run my application, but now what i want to do is to create project in vivado generate bitsteam file and then copy the bitstream file into the SD card without needing to export it to SDK. and then from linux command line i execute the .bit file..

 

Thank you

0 Kudos
6 Replies
Highlighted
Moderator
Moderator
2,084 Views
Registered: ‎09-12-2007

Re: how to read .bit file in linux command line

you can use the fpga manager:

http://www.wiki.xilinx.com/FPGA+Manager+ZCU102

0 Kudos
Highlighted
Adventurer
Adventurer
2,013 Views
Registered: ‎04-14-2015

Re: how to read .bit file in linux command line

@stephenm thank you for your guidance.. but here they are using Xilinx SDK also. but what i want to do is to generate bitstream file using vivado then copy it directly into to SD card and then run/execute it using the command line of linux Linaro which i am running by booting the linux linaro on zedboard using the SD card. i want to skip using Xilinx SDK and to program the Programmable logic of Zedboard i want to use the command line of the linux. can you please guide me is it possible to do.? if yes then how.. ?

 

Thank you

0 Kudos
Highlighted
Contributor
Contributor
2,002 Views
Registered: ‎01-24-2013

Re: how to read .bit file in linux command line

There are a couple ways to do this:

1) Bundle the bitstream with your boot image.  This is done with petalinux-package to create a BOOT.BIN file containing your FPGA bitstream along with the first-stage-bootloader (FSBL).  This is usually the simplest thing to do.

2) Use /dev/xdevcfg to program your bitstream into the FPGA once Linux is running.  The advantage is that you have dynamic control of the FPGA (i.e., you can program different bitstreams on the fly).  However, you'll need to make sure the xdevcfg driver is actually built and loaded on your Linux system.

0 Kudos
Highlighted
Adventurer
Adventurer
1,942 Views
Registered: ‎04-14-2015

Re: how to read .bit file in linux command line

@steven.bell i tried the first step and generated a BOOT.bin file using the bitstream of my project with the help of petalinux. when I copied it to the SD card and inserted the SD card in Zedboard and tried to run Linux linaro from Zedboard i was not able to load the Linux. normally what i do is to insert the SD card in Zedboard connect zedboard to an external monitor using HDMI cable and to operate it i had connected a keyboard and mouse to the zedboard wirelessly. and to run the linaro i only use this command " run sdboot_linaro" and the linaro loads. but now i am not able to load and it says the command is not found and gives me an error... 

 

can you please guide me what i am doing wrong. Thank you

0 Kudos
Highlighted
Contributor
Contributor
1,910 Views
Registered: ‎01-24-2013

Re: how to read .bit file in linux command line

We'll need a little more detail to diagnose your problem.  Are you connecting to the board's serial console?  Do you see the U-boot loading message, and do you get a U-boot prompt?

 

If you're typing `sdboot_linaro` at the U-boot prompt, then you probably need a different command.  `sdboot` or just `boot` should work.  However, Petalinux normally boots without you having to run anything.

0 Kudos
Highlighted
Xilinx Employee
Xilinx Employee
1,878 Views
Registered: ‎01-21-2008

Re: how to read .bit file in linux command line

There are two ways to achieve Zynq-7000, PL configuration from Linux OS (file read from SD,Ethernet, QSPI, NAND Flash etc):

 

1. DevCFG Xilinx kernel library - http://www.wiki.xilinx.com/Solution+Zynq+PL+Programming- If you re using older Vivado 2018.1 software.

 

2. XilFPGA (FPGA Manager) Xilinx kernel library:- The XilFPGA (FPGA Manager) library provides an interface to the Linux or bare-metal users for configuring the programmable logic (PL) over PCAP from PS.

 

So in your case if you are using Linux, then add Kernel configuration XilFPGA (FPGA Manager) library. (http://www.wiki.xilinx.com/FPGA+Manager+ZCU102 – Try following Petalinux section but again you need to add FPGA manger library in Kernel configuration).

 

Note: DevCFG driver got deprecated in 2018.1 release. Use ZYNQ FPGA manager to program Bit-stream into Zynq PL

Both (1 & 2) either library need to add in Kernel configuration. Once you are in Linux command prompt then try using specific command at above link.

 

If you are typing “run sdboot_linaro” at the u-boot command then, try FPGA configuration before Linaro.

 

For example:

 

1. If you are using DevCFG, from U-boot: Load the Bitstream into memory and then use fpga loadb to program the PL; for example:

  1. U-Boot> fatload mmc 0 0x4000000 bitstream.bit
  2. U-Boot> fpga loadb 0 0x4000000 <bitstream file size

2. If you use XilFPGA (FPGA Manager) – 2018.1 & onward:

a. See how to generate Bitstream (.bit) to Binary file (.bin) http://www.wiki.xilinx.com/FPGA+Manager+ZCU102

b. Create a BIF file (you can use the template below), and copy this to images/linux folder:

all:

{

  design_1_wrapper.bit

}

c. Create the bin file of the bistream (from XSCT): bootgen -image boot_a53_bin_pl_all.bif -arch zynqmp -process_bitstream bin

d. Copy the following files onto an SD card: {  design_1_wrapper.bit.bin, BOOT.BIN & Linaro_Image_File}

e. U-Boot:

ZynqMP> fatload mmc 0 0x4000000 design_wrapper.bit.bin

ZynqMP> fpga load 0 0x4000000 $filesize

ZynqMP> run sdboot_linaro

 

Hope this helps. 

 

0 Kudos