Overview
The FPGA can be configured (also known as 'programmed') in several ways:
- From an external configuration flash memory,
- With the Quartus Programmer tool,
- From HPS software.
This page presents the different FPGA configuration options from HPS software:
- From Preloader
- From U-boot
- From Linux.
For the GSRD the selected method of programming the FPGA is from U-boot, with the image stored on the SD card.
Note: Before re-programming the FPGA fabric, make sure that the FPGA2HPS bridges (f2sdram, axi) are disabled, and that there is no software on HPS that may access the FPGA. This includes shutting down applications that access soft IP and also unloading any soft IP Linux kernel modules. Failure to do so will cause the system to behave in a non-deterministic way and most likely it will crash.
GSRD FPGA Configuration
This section provides some details about how the FPGA is configured in the GSRD.
In the GSRD case, the FPGA is configured from U-boot with the help of a script. This scheme ensures that the Linux boot succeeds even if the FPGA image is not present on the SD card. If the FPGA image is not present, Linux will still boot, but the FPGA will need to be configured using another method.
The following U-boot environment variables are used to define the U-boot procedure for programming FPGA:
bootcmd=run callscript; run mmcload; run mmcboot
callscript=if fatload mmc 0:1 $fpgadata $scriptfile;then source $fpgadata; else echo Optional boot script not found. Continuing to boot normally;
scriptfile=u-boot.scr
Note that the U-boot environment variables can be seen at the U-boot console by running the 'printenv' command.
The script file
u-boot.scr was obtained with the following procedure:
1. On host PC, create text file
boot.scriptwith the following contents:
fatload mmc 0:1 $fpgadata soc_system.rbf;
fpga load 0 $fpgadata $filesize;
run bridge_enable_handoff;
run mmcload;
run mmcboot;
Note that this file is already provided with this release at
https://s3.amazonaws.com/rocketboards/releases/2015.02/sockit-gsrd/src/boot.script.
2. Add the U-boot header to the
boot.script script file to create the
u-boot.scr file:
$ ~/altera/14.1/embedded/embedded_command_shell.sh
$ mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "My script" -d boot.script u-boot.scr
3. Write the file on the FAT partition of the SD card.
Further Work
Please refer to
http://www.rocketboards.org/foswiki/Documentation/GSRD141ProgrammingFPGAfromHPSArrowSoCKitEdition for more information about FPGA programming.