Changes

Jump to: navigation, search

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

2,113 bytes added, 08:18, 20 June 2018
no edit summary
== 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 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.
==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 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.
<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.
 
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:
<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>
4,650
edits

Navigation menu