Open main menu

DAVE Developer's Wiki β

Changes

BELK-AN-008: Programming the FPGA Bitstream with U-Boot

2,739 bytes added, 11:12, 22 November 2021
no edit summary
__FORCETOC__
 
{{InfoBoxTop}}
{{Applies To Bora}}
{{Applies To BoraX}}
{{AppliesToBORA_AN}}
{{AppliesToBORA_Xpress_AN}}
{{AppliesToBORA_Lite_AN}}
{{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 ==
== Introduction ==
This Application Note describes how to download program FPGA bitstream with U-Boot. In particular, it shows how to retrieve the bitstream file from uSD 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:
* 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==
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 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">
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
</pre>
 
To transfer the <code>.bin</code> 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:
<pre class="board-terminal">
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}
</pre>
After programming the bitstream, LED DL3 will be on.
 
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">
Bora> print loadfpga
loadfpga=tftpboot ${loadaddr} ${fpgafile}
Bora> print program_fpga
program_fpga=run loadfpga;fpga load 0 ${loadaddr} 0x${filesize}
</pre>
8,221
edits