Difference between revisions of "BELK-AN-008: Programming the FPGA Bitstream with U-Boot"

From DAVE Developer's Wiki
Jump to: navigation, search
(Introduction)
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
__FORCETOC__
 +
 
{{InfoBoxTop}}
 
{{InfoBoxTop}}
 
{{Applies To Bora}}
 
{{Applies To Bora}}
 
{{Applies To BoraX}}
 
{{Applies To BoraX}}
 +
{{AppliesToBORA_AN}}
 +
{{AppliesToBORA_Xpress_AN}}
 +
{{AppliesToBORA_Lite_AN}}
 
{{InfoBoxBottom}}
 
{{InfoBoxBottom}}
 +
{{WarningMessage|text=This application note was validated against specific versions of the kit only. It may not work with other versions. Supported versions are listed in the ''History'' section.}}
  
 
== History ==
 
== History ==
Line 21: Line 27:
  
 
The procedure here described was tested with binary files released with BELK 4.0.0 on Bora/BoraEVB platform.
 
The procedure here described was tested with binary files released with BELK 4.0.0 on Bora/BoraEVB platform.
 +
 +
It is worth to remember that there are other techniques available to program the bitstream. See for instance the following links:
 +
* https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18841750/Solution+Zynq+PL+Programming
 +
* https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18841833/Programming+the+Programmable+Logic
  
 
==Programming procedure==
 
==Programming procedure==
 
The bitstream file used to test the procedure can be downloaded [https://wiki.dave.eu/index.php/BELK/BXELK_software_components#Downloadable_binary_images here].
 
The bitstream file used to test the procedure can be downloaded [https://wiki.dave.eu/index.php/BELK/BXELK_software_components#Downloadable_binary_images here].
  
By default, the bitstream file is release as <code>.bit</code> file. However, programming tool requires <code>.bin</code> format. Thus, the first thing to do is to convert the bitstream file. Several options are available to do this operation. For example, [https://cloud.dave.eu/public/cdd957 this Python program] can be used as shown in the following box.  
+
By default, the bitstream file is released as <code>.bit</code> file. However, U-Boot requires the <code>.bin</code> format. Thus, the first thing to do is to convert the bitstream file. Several options are available to do this operation. For example, [https://cloud.dave.eu/public/cdd957 this Python program] can be used as shown in the following box.  
 
<pre class="board-terminal">
 
<pre class="board-terminal">
 
E:\tmp\Bora\bit2bin>"c:\Program Files (x86)\python275\python.exe" fpga-bit-to-bin.py --flip belk-4.0.0_bora_fpga.bit belk-4.0.0_bora_fpga.bin
 
E:\tmp\Bora\bit2bin>"c:\Program Files (x86)\python275\python.exe" fpga-bit-to-bin.py --flip belk-4.0.0_bora_fpga.bit belk-4.0.0_bora_fpga.bin
Line 63: Line 73:
 
After programming the bitstream, LED DL3 will be on.
 
After programming the bitstream, LED DL3 will be on.
  
Please note that, by default, U-Boot's environment provides the <code>program_fpga</code> variable to program the bitstream. However, this variable assumes that the Ethernet connection is available as it downloads the bistream file via TFTP protocol:
+
It is worth remembering that, by default, U-Boot's environment provides the <code>program_fpga</code> variable to program the bitstream. However, this variable assumes that the Ethernet connection is available as it downloads the bistream file via TFTP protocol:
 
<pre class="board-terminal">
 
<pre class="board-terminal">
 
Bora> print loadfpga
 
Bora> print loadfpga

Latest revision as of 11:12, 22 November 2021


Info Box
Bora5-small.jpg Applies to Bora
BORA Xpress.png Applies to BORA Xpress
Warning-icon.png This application note was validated against specific versions of the kit only. It may not work with other versions. Supported versions are listed in the History section. Warning-icon.png

History[edit | edit source]

Version Date BELK/BXELK version Notes
4.0.0/2.0.0 June 2018 4.0.0 / 2.0.0 First release

Introduction[edit | edit source]

This Application Note describes how to program FPGA bitstream with U-Boot. In particular, it shows how to retrieve the bitstream file from a microSD card. For instance, this can be convenient when the Ethernet connection is not available.

The procedure here described was tested with binary files released with BELK 4.0.0 on Bora/BoraEVB platform.

It is worth to remember that there are other techniques available to program the bitstream. See for instance the following links:

Programming procedure[edit | edit source]

The bitstream file used to test the procedure can be downloaded here.

By default, the bitstream file is released as .bit file. However, U-Boot requires the .bin format. Thus, the first thing to do is to convert the bitstream file. Several options are available to do this operation. For example, this Python program can be used as shown in the following box.

E:\tmp\Bora\bit2bin>"c:\Program Files (x86)\python275\python.exe" fpga-bit-to-bin.py --flip belk-4.0.0_bora_fpga.bit belk-4.0.0_bora_fpga.bin
Design name: bora_wrapper;UserID=0XFFFFFFFF;Version=2017.1
Partname 7z020clg400
Date 2017/07/11
Time 16:45:57
found binary data: 4045564

To transfer the .bin file to the target, a FAT32 formatted microSD card was used. On the target, the following commands were issued in order to retrieve and program the bitstream file:

Bora> mmc rescan
Bora> mmc info
Device: sdhci@e0100000
Manufacturer ID: 1b
OEM: 534d
Name: 00000
Tran Speed: 50000000
Rd Block Len: 512
SD version 3.0
High Capacity: No
Capacity: 1.9 GiB
Bus Width: 4-bit
Erase Group Size: 512 Bytes
Bora> fatls mmc 0:1
  4045672   belk-4.0.0_bora_fpga.bit
  4045564   belk-4.0.0_bora_fpga.bin

2 file(s), 1 dir(s)

Bora> fatload mmc 0:1 ${loadaddr} belk-4.0.0_bora_fpga.bin
reading belk-4.0.0_bora_fpga.bin
4045564 bytes read in 272 ms (14.2 MiB/s)
Bora> fpga load 0 ${loadaddr} ${filesize}

After programming the bitstream, LED DL3 will be on.

It is worth remembering that, by default, U-Boot's environment provides the program_fpga variable to program the bitstream. However, this variable assumes that the Ethernet connection is available as it downloads the bistream file via TFTP protocol:

Bora> print loadfpga
loadfpga=tftpboot ${loadaddr} ${fpgafile}
Bora> print program_fpga
program_fpga=run loadfpga;fpga load 0 ${loadaddr} 0x${filesize}