仅对英特尔可见 — GUID: nac1542410380604
Ixiasoft
D.1. 当在AFU映像上运行fpgasupdate时,为什么会看到'No Suitable slots found'消息?
D.2. 需要哪些环境变量?
D.3. 如果看到错误消息'Error enumerating resources: no driver available'该怎么做?
D.4. 安装OPAE驱动程序后,命令lsmod | grep fpga不显示任何输出。如何成功安装OPAE驱动程序?
D.5. 命令rpm -qa | grep opae不返回已安装的opae rpm package。如何成功安装此软件包?
D.6. 如果 Intel® FPGA PAC D5005没有显示在PCIe总线上,该怎么做?
仅对英特尔可见 — GUID: nac1542410380604
Ixiasoft
6.2. 运行Hello FPGA示例
hello_fpga示例主机应用程序使用OPAE库在本机环回(NLB)配置中测试硬件。使用nlb_mode_0 AFU映像加载FPGA以运行此示例。
- 运行以下命令以加载hello_fpga示例主机应用程序:
sudo fpgasupdate $OPAE_PLATFORM_ROOT/hw/samples/nlb_mode_0/bin/\ nlb_mode_0_unsigned.gbs
注: fpgasupdate工具接受PCIE B:D.F (例如:04:00.0)作为一个参数。 - 配置系统大页面以分配此实用程序所需的20个2 MB大页面。此命令需要根特权:
sudo sh -c "echo 20 > /sys/kernel/mm/hugepages/\ hugepages-2048kB/nr_hugepages"
注: 上面的配置用于单卡系统。对于多卡系统,请将2 MB大页面的数量设置为20*<number_of_cards>。 - 对位于$OPAE_PLATFORM_ROOT/sw/opae*/samples/hello_fpga.c的hello_fpga更改到源代码目录:
cd $OPAE_PLATFORM_ROOT/sw
- 提取tar文件:
tar xf opae-*.tar.gz
- 更改为OPAE目录。
cd opae*
- 提取tar文件:
- 编译示例:
gcc -o hello_fpga -std=gnu99 -rdynamic \ -ljson-c -luuid -lpthread -lopae-c -lm -Wl,-rpath \ -lopae-c $OPAE_PLATFORM_ROOT/sw/opae*/samples/hello_fpga.c
- 输入以下命令运行此示例:
sudo ./hello_fpga
样例输出:
Running Test Running on Bus 0x3b Done Running Test
Acceleration Stack 2.0.1 Release将以下工作AFU映像包含在$OPAE_PLATFORM_ROOT/hw/samples目录中:
- dma_afu/bin/dma_afu_unsigned.gbs
- streaming_dma_afu/bin/streaming_dma_afu_unsigned.gbs
- hello_afu/bin/hello_afu_unsigned.gbs
- hello_intr_afu/bin/hello_intr_afu_unsigned.gbs
- hello_mem_afu/bin/hello_mem_afu_unsigned.gbs
- nlb_mode_0/bin/nlb_mode_0_unsigned.gbs
- nlb_mode_3/bin/nlb_mode_3_unsigned.gbs
- nlb_mode_0_stp/bin/nlb_mode_0_stp_unsigned.gbs
- hssi_prbs/bin/hssi_prbs_unsigned.gbs
- byte_enable/bin/byte_enable_afu_unsigned.gbs
注: 为了使fpgasupdate能够成功地对比特流进行编程,在AFU开发过程中构建的所有AFU比特流必须通过PACSign进行处理(无论是否通过签署秘钥来添加相应的标头)。样本AFU ($OPAE_PLATFORM_ROOT/hw/<sample afu>/bin/*_unsigned.gbs)中提供的比特流由PACSign进行处理来添加相应的标头,但不使用任何秘钥进行签署。
下面的代码显示了一个示例AFU主机代码的编译和执行。
sudo fpgasupdate $OPAE_PLATFORM_ROOT/hw/samples/<afu>/bin/*_unsigned.gbs
cd $OPAE_PLATFORM_ROOT/hw/samples/<afu>/sw
make
sudo ./<executable>对于样本AFU nlb_mode_0和nlb_mode_3,预编译的可执行文件被复制到位置/usr/bin。
请输入以下命令来执行AFU sample nlb_mode_0:
sudo fpgasupdate \ $OPAE_PLATFORM_ROOT/hw/samples/nlb_mode_0/bin/*_unsigned.gbs
sudo sh -c "echo 20 > /sys/kernel/mm/hugepages/\ hugepages-2048kB/nr_hugepages"
sudo nlb0
请输入以下命令来执行sample nlb_mode_3:
sudo fpgasupdate \ $OPAE_PLATFORM_ROOT/hw/samples/nlb_mode_3/bin/*_unsigned.gbs
sudo sh -c "echo 20 > /sys/kernel/mm/hugepages/\ hugepages-2048kB/nr_hugepages"
sudo nlb3
请参考每个<example AFU>目录下的README文件以获取更多信息。