六、DE25-Nano 开发板 HPS Boot First 模式演示
准备 FPGA配置文件
下载并打开DE25-Nano_revB_v.1.0.0_ResourcePackage\Demonstration\SoC_FPGA\GHRD工程中的golden_top.qsf文件,添加设置:
set_global_assignment -name HPS_INITIALIZATION "HPS FIRST"保存设置并编译GHRD工程:
设置Quartus的环境变量:
export QUARTUS_ROOTDIR=/home/doreen/altera_pro/25.1.1/quartus export PATH=$QUARTUS_ROOTDIR/bin:$PATH
在output_files目录执行下面的指令生成golden_top.hps.jic和golden_top.core.rbf:
quartus_pfg -c golden_top.sof golden_top.jic -o device=MT25QU128 -o flash_loader=A5EB013BB23B -o hps_path=../software/u-boot/spl/u-boot-spl-dtb.hex -o mode=ASX4 -o hps=1如若遇到libboost_atomic-mt-x64.so.1.81.0、libicui18n.so.69库找不到的问题,请增加环境变量设置(这些文件 在quartus/linux64目录下都是有的):
export LD_LIBRARY_PATH=$QUARTUS_ROOTDIR/linux64:$LD_LIBRARY_PATH在output_files目录执行下面的指令将golden_top.hps.jic 文件烧写到QSPI Flash:
quartus_pgm -m jtag -c 1 -o "pvi;golden_top.hps.jic"备注:HPS Boot First模式下固化的.jic文件没包含fpga数据,而是包含sdm固件、hps emif io 数据、以及spl等等。参考下图:
准备设备树Overlay文件
准备 ghrd.dts 文件如下:
/dts-v1/;/plugin/;/ {fragment@0 {target-path = "/fpga-region";__overlay__ {firmware-name = "golden_top.core.rbf";};};};
编译dtbo指令如下:
dtc -@ -I dts -O dtb -o ghrd.dtbo ghrd.dts准备MicroSD启动卡
参考【教程】Linux上用命令烧写SD卡和Windows上用Win32DiskImager工具一键烧写SD卡 de25_nano_revA_sdcard_console_v1.1.img 烧写到SD卡。
把烧写好的SD卡插上读卡器再插到Ubuntu PC,拷贝golden_top.core.rbf、ghrd.dtbo以及run_overlay.sh文件到SD卡的文件系统盘的/home/terasic路径下:
run_overlay.sh内容如下:
#!/bin/bash mkdir /sys/kernel/config/device-tree/overlays/ghrd echo ghrd.dtbo > /sys/kernel/config/device-tree/overlays/ghrd/path
启动开发板观察测试结果
继续参考【教程】Linux上用命令烧写SD卡和Windows上用Win32DiskImager工具一键烧写SD卡启动开发板,打开串口终端,DE25-Nano开发板 boot进入linux后,拷贝golden_top.core.rbf、ghrd.dtbo 到 /lib/firmware,然后执行run_overlay.sh脚本。
sudo cp golden_top.core.rbf /lib/firmware/ sudo cp ghrd.dtbo /lib/firmware/ sudo ./run_overlay.sh
观察现象,加载rbf(.dtbo里面有加载rbf的指令)之前,FPGA 端LED不亮,加载后FPGA端LED亮起,且有一个LED闪烁:
本文部分截图参考Altera文
Altera Documentation and Resources Center
【教程】Agilex 5 SoC 的两种启动模式的开发演示(一)(FPGA Configuration First)参考:https://mp.weixin.qq.com/s/qmAmJBihwH8CFhNzNBxGJg