Prerequisites
You will need the following items:
- Arria 10 SoCDevelopment Kit, Rev C including:
- DDR4 Memory Card
- QSPI Boot Card
- Host PC with:
- Linux OS - required for compiling U-Boot, which is not supported on Windows
- Minimum 16GB or RM - required for building the hardware design
- Serial terminal (for example minicom
- TFTP Server - for getting Linux binaries to U-Boot to be written to QSPI
- SoC EDS - for generating and building U-Boot
- ACDS - for compiling the hardware design
- Local Ethernet network, with DHCP server (will be used to provide IP address to the board).
Overview
The QSPI boot reference design is very similar with the regular SD card version of the GSRD, with the following notes:
- There is a separate GHRD, that is configured to use QSPI instead of SD card
- There are a separate set of Angstrom recipes, with minor changes as compared to the SD card versoin
- The root file system does not contain all the features of the SD card GSRD, because of limited space
QSPI Flash Layout
The following layout was chosen for the QSPI:
Item |
Start Address (Hex) |
Size (Hex) |
Size (Bytes) |
---|
Bootloader Image 0 |
0x0 |
0x0040000 |
262,144 |
Bootloader Image 1 |
0x4_0000 |
0x0040000 |
262,144 |
Bootloader Image 2 |
0x8_0000 |
0x0040000 |
262,144 |
Bootloader Image 3 |
0xC_0000 |
0x0040000 |
262,144 |
Linux Device Tree |
0x10_0000 |
0x00020000 |
131,072 |
zImage |
0x12_0000 |
0x00600000 |
6,291,456 |
Peripheral rbf |
0x72_0000 |
0x100000 |
1,048,576 |
Core rbf |
0x82_0000 |
0x27f0000 |
41,877,504 |
U-boot Environment Setting |
0x3010000 |
0x00010000 |
65,536 |
Linux File System |
0x3020000 |
0x05000000 |
83,886,080 |
Notes:
- Location of the Bootloader at offset 0x0 in QSPI is required by BootROM.
- The FPGA configuration file needs to have the U-Boot (mkimage) wrapper.
- Location of RBF file, Linux kernel and Linux Device Tree are hardcoded in U-Boot source code as U-Boot environment variables (qspirbfaddr, qspibootimageaddr, qspifdtaddr). Their default values can be changed by editing the U-Boot source code file include/configs/socfpga_arria10.h.
- Location of root file system is defined in the Linux Device Tree.
Building Arria 10 QSPI GSRD
This section describes how to build the QSPI version of the A10 GSRD. The build process is very similar with the SD card version of the GSRD.
Notes:
- Prebuilt binary files are included with this release, so the QSPI GSRD can also be used without being rebuilt.
- In order to make this page shorter, the command line tools are used for the whole build process.
Building Hardware Design
1. Download the hardware design archive:
- Get the a10_soc_devkit_ghrd_qspi.tar.gz tarball according to the Release Tags
Note that you will have to open the file in a web browser (wget doesn't work as you'll need to agree to a popup license agreement).
2. Extract the archive:
cd ~
tar xvzf a10_soc_devkit_ghrd_qspi.tar.gz
3. Build hardware design, U-Boot and Linux device tree from Embedded Command Shell:
Building Hardware design
~/intelFPGA/17.0/embedded/embedded_command_shell.sh
cd ~/a10_soc_devkit_ghrd_qspi/
qsys-generate --synthesis=VERILOG ghrd_10as066n2.qsys
quartus_sh --flow compile ghrd_10as066n2.qpf
quartus_cpf -c --hps -o bitstream_compression=on output_files/*.sof output_files/ghrd_10as066n2.rbf
mkimage -A arm -T firmware -C none -O u-boot -a 0 -e 0 -n "RBF" -d output_files/ghrd_10as066n2.core.rbf output_files/ghrd_10as066n2.core.rbf.mkimage
mkimage -A arm -T firmware -C none -O u-boot -a 0 -e 0 -n "RBF" -d output_files/ghrd_10as066n2.periph.rbf output_files/ghrd_10as066n2.periph.rbf.mkimage
Building uboot
bsp-create-settings --preloader-settings-dir=hps_isw_handoff --type=uboot --settings=software/settings.bsp
bsp-update-settings --settings=software/settings.bsp --set uboot.boot_device QSPI
bsp-generate-files --settings=software/settings.bsp --bsp-dir=software/uboot
make -C software/uboot
Generating Linux device tree
sopc2dts --input ghrd_10as066n2/ghrd_10as066n2.sopcinfo --output ghrd_10as066n2.dts --board hps_a10_common_board_info.xml --board hps_10_devkit_board_info.xml --board ghrd_10as066n2_board_info.xml --bridge-removal all --clocks
dtc -I dts -O dtb -o ghrd_10as066n2.dtb ghrd_10as066n2.dts
This will create the following files in the
~/a10_soc_devkit_ghrd folder:
File |
Description |
---|
output_files/ghrd_10as066n2.sof |
FPGA Configuration File in SOF format |
output_files/ghrd_10as066n2.rbf |
FPGA Configuration File in RBF format |
output_files/ghrd_10as066n2.rbf.mkimage |
FPGA Configuration File in RBF format, with the mkimage header |
Note that the hardware design can also be built from the Quartus II GUI. The process is identical as for the SD card version:
Compiling Hardware Design.
Generating and Building U-Boot and U-Boot Device Tree
Build U-Boot from Embedded Command Shell:
~/intelFPGA/17.0/embedded/embedded_command_shell.sh
cd ~/a10_soc_devkit_ghrd_qspi/
bsp-create-settings --preloader-settings-dir=hps_isw_handoff --type=uboot --settings=software/settings.bsp
bsp-update-settings --settings=software/settings.bsp --set uboot.boot_device QSPI
bsp-generate-files --settings=software/settings.bsp --bsp-dir=software/uboot
make -C software/uboot
This will create the following in the
~/a10_soc_devkit_ghrd folder:
File |
Description |
---|
software/uboot/uboot_w_dtb-mkpimage.bin |
U-Boot Binary and Device Tree, wrapped with mkpimage header |
Note that U-Boot BSP generator can also be invoked as a GUI application, not only from the command line. The flow is documented here:
Generating U-Boot and U-Boot Device Tree
Building Linux Device Tree
Build Linux Device Tree from Embedded Command Shell:
~/intelFPGA/17.0/embedded/embedded_command_shell.sh
cd ~/a10_soc_devkit_ghrd_qspi/
sopc2dts --input ghrd_10as066n2/ghrd_10as066n2.sopcinfo --output ghrd_10as066n2.dts --board hps_a10_common_board_info.xml --board hps_10_devkit_board_info.xml --board ghrd_10as066n2_board_info.xml --bridge-removal all --clocks
dtc -I dts -O dtb -o ghrd_10as066n2.dtb ghrd_10as066n2.dts
This will create the following in the
~/a10_soc_devkit_ghrd folder:
File |
Description |
---|
ghrd_10as066n2.dts |
Linux Device Tree Source |
ghrd_10as066n2.dtb |
Linux Device Tree Blob |
Building Linux Kernel and Root Filesystem
The complete instructions on how to build the binaries required to boot Linux from QSPI are:
Please follow the steps described in
Compiling Linux
This will create the following in the folder
~/angstrom-socfpga/deploy/glibc/images/arria10/:
File |
Description |
---|
zImage |
Linux kernel |
console-image-minimal-arria10.jffs2 |
Root Filesystem Image |
console-image-minimal-arria10.tar.xz |
Root Filesystem Archive |
Creating QSPI Image
The following steps are required to generate a GSRD QSPI image
dd if=/dev/zero of=qspiimage.img bs=1 count=134217728
dd if=ghrd_10as066n2.dtb of=qspiimage.img conv=notrunc bs=1 seek=1048576
dd if=~/angstrom-socfpga/deploy/glibc/images/arria10/console-image-minimal-arria10.jffs2 of=qspiimage.img conv=notrunc bs=1 seek=50462720
dd if=~/angstrom-socfpga/deploy/glibc/images/arria10/zImage of=qspiimage.img conv=notrunc bs=1 seek=1179648
dd if=output_files/ghrd_10as066n2.periph.rbf.mkimage of=qspiimage.img conv=notrunc bs=1 seek=7471104
dd if=output_files/ghrd_10as066n2.core.rbf.mkimage of=qspiimage.img conv=notrunc bs=1 seek=8519680
dd if=software/uboot/uboot_w_dtb-mkpimage.bin of=qspiimage.img conv=notrunc bs=1 seek=0
Programming QSPI
This section presents how to write the QSPI GSRD deliverables to the QSPI Flash device. Prebuilt binaries, or rebuilt files can be used, or a combination of both, as desired.
Writing U-Boot and RBF and Booting U-Boot
This section presents how to write to QSPI the U-Boot and the FPGA configuration file and then boot from QSPI to U-Boot prompt.
1. Connect a micro USB cable from connector J22 to the PC (used for JTAG connection) and a mini USB cable from connector J10 to the PC (used for serial connection).
2. Start a serial terminal on PC and connect to the board using 115,200-8-N-1.
3. Power up the board. Observe the serial terminal. If U-Boot tries to boot, press any key to stop it. This is required because the HPS Flash programmer can have problems connecting to the board when Linux is running.
4. Program the files from an Embedded Command Shell
~/intelFPGA/17.0/embedded/embedded_command_shell.sh
cd ~/a10_soc_devkit_ghrd_qspi
quartus_hps --cable=1 --operation=PV --addr=0x0 software/uboot_bsp/uboot_w_dtb-mkpimage.bin
quartus_hps --cable=1 --operation=PV --addr=0x720000 output_files/ghrd_10as066n2.periph.rbf.mkimage
Note: If encounter similar error “
The quartus_hps tool reports: “Quad SPI Flash silicon ID is 0x00000000” “Error: Not able to map flash ID from flash database”, use the following command
quartus_hps -boot=18 -c 1 -o uboot_w_dtb-mkpimage.bin
This triggers a cold reset on the devkit.
5. Power cycle the board and observe the serial terminal. U-Boot will run. Press any key to get to the U-Boot console.
Writing Full QSPI image and Booting Linux
1. Cd to the the qspiimage directory
2. Run the following commands to erase the flash locations where the Linux Device Tree, Linux kernel and Linux filesystem will be written
~/intelFPGA/17.0/embedded/embedded_command_shell.sh
quartus_hps --cable=1 --operation=E --addr=0x0 --size=0x8000000
3. Download and write the full QSPI image to the flash:
quartus_hps --cable=1 --operation=PV --addr=0x0 qspiimage.img
4. Power cycle the board. It should boot to the Linux console.
Writing Linux Binaries to QSPI through U-Boot
Notes: This is an alternative to reduce the programming time for QPSI. However, please make sure you have your firewall configured and a TFTP server running on your host machine. You should also connect the Devkit to the same network as your host machine.
1.
Prerequisite: User have must complete steps in Writing U-Boot and RBF and Booting U-Boot
2. On Host PC, copy Linux Binaries to the TFTP folder. The following assume that the TFTP shared folder is
/tftpboot
cp ghrd_10as066n2.dtb output_files/ghrd_10as066n2.core.rbf.mkimage ~/angstrom-socfpga/deploy/glibc/images/arria10/zImage ~/angstrom-socfpga/deploy/glibc/images/arria10/console-image-minimal-arria10.jffs2 /tftpboot/
3. From U-Boot Console
sf probe
sf erase 0x100000 0x620000
sf erase 0x820000 0x77E0000
tftp $loadaddr ghrd_10as066n2.core.rbf.mkimage
sf write $loadaddr 0x820000 $filesize
tftp $loadaddr ghrd_10as066n2.dtb
sf write $loadaddr 0x100000 $filesize
tftp $loadaddr zImage
sf write $loadaddr 0x120000 $filesize
tftp $loadaddr console-image-minimal-arria10.jffs2
sf write $loadaddr 0x3020000 $filesize
4. Power cycle the board. It should boot to the Linux console.
The precompiled binaries archive contains the following:
File |
Description |
---|
console-image-minimal-arria10.jffs2 |
JFFS2 rootfs partition image |
console-image-qspi-arria10.tar.xz |
Compressed root file system archive |
ghrd_10as066n2.periph.rbf.mkimage |
FPGA Ring Configuration RBF wrapped with mkimage header |
ghrd_10as066n2.core.rbf.mkimage |
FPGA Core Configuration RBF wrapped with mkimage header |
ghrd_10as066n2.sof |
FPGA Configuration File SOF |
qspiimage.tar.gz |
Compressed image of the QSPI |
ghrd_10as066n2.dtb |
Updated Linux Device Tree file |
uboot_w_dtb-mkpimage.bin |
Precompiled U-Boot and U-Boot Device Tree Image |
zImage |
Linux kernel compressed image |
The prebuilt binaries are provided for reference, and can enable the user to skip some or all of the steps from the flow.