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

From DAVE Developer's Wiki
Revision as of 08:19, 20 June 2018 by U0001 (talk | contribs) (Programming procedure)

Jump to: navigation, search
Info Box
Bora5-small.jpg Applies to Bora
BORA Xpress.png Applies to BORA Xpress

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.

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, programming tool requires .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.

Please note 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}