1. 下载软件:选择版本,[环境,下载方式](http://dl.altera.com/opencl/16.1/?edition=standard&download_manager=direct&direct_download=1&version_number=16.1&description=Intel+FPGA+SDK+for+OpenCL+%28includes+Quartus+Prime+software+and+devices%29&platform=linux&filesize=21847674880&download_method=download&direct_file=AOCL-16.1.0.196-linux.tar)。
2. 解压安装包:`sudo tar -xvf AOCL-16.1.0.196-linux.tar`
3. 在解压后的文件夹下,安装AOCL:`sudo ./AOCLSetup-16.1.0.196-linux.run`(有可能只安装`sudo ./QuartusSetup-16.1.0.196-linux.run`即可)。
4. 将破解文件移动到quartus对应文件夹下:`sudo mv libgcl_afcq.so libsys_cpt.so ~/intelFPGA/16.1/quartus/linux64`。
5. 打开quartus,复制网卡地址并替换license.data文件里的xxxxxx
6. 将license.dat移动到quartus目录下的licenses文件夹下`sudo mv license.dat ~/intelFPGA/16.1/licenses
`。这一步可以不做
7. 在quartus下加载license即可使用quartus(为何每次都要加载一下?)
8. 配置opencl环境,运行init_opencl.sh。`~/intelFPGA/16.1/hld$ source init_opencl.sh
`
9. terminal下检查aocl安装是否成功:`aocl version`
10. 检查支持板``aoc --list-boards`
11. 发现没有ARM开发的支持,原来需要[下载](http://dl.altera.com/soceds/16.1/?edition=pro&platform=linux&download_manager=direct)安装altera SoC EDS(arm的交叉编译工具),在安装中需要确保ds5安装。具体步骤可见[文档](http://www.terasic.com.tw/attachment/archive/836/DE1SOC_OpenCL_v02.pdf)
12. 安装EDS`wangjc@wangjc-Inspiron-3668:~/Downloads$ sudo chmod +x SoCEDSSetup-16.1.0.196-linux.run
`
`wangjc@wangjc-Inspiron-3668:~/Downloads$ sudo ./SoCEDSSetup-16.1.0.196-linux.run
`
在embedded目录下运行ds-5 install.sh,默认安装到如下目录
Where would you like to install to? [default: /usr/local/DS-5_v5.25.0]
将文件移动到embedded目录下
13. 安装DE1 SoC 的openCL BSP,下载[地址](http://www.terasic.com.tw/cgi-bin/page/archive.pl?Language=English&No=836&PartNo=4)
14. 将解压的BSP拷贝到hld/board文件夹下,并重命名为terasic。`wangjc@wangjc-Inspiron-3668:~/Downloads$ sudo mv de1soc ~/intelFPGA/16.1/hld/board/terasic
`
15. 新建de1soc文件夹并将文件移入文件夹中(可不做)。`wangjc@wangjc-Inspiron-3668:~/intelFPGA/16.1/hld/board/terasic$ sudo mv de1soc_sharedonly driver examples board_env.xml linux_sd_card_image.zip de1soc
`
16. 配置环境,每次都要运行init_opencl.sh文件么?增加bsp变量地址。`wangjc@wangjc-Inspiron-3668:~/intelFPGA/16.1/hld$ export AOCL_BOARD_PACKAGE_ROOT=/home/wangjc/intelFPGA/16.1/hld/board/terasic/de1soc
` (应该按照下面17来做)
17. 配置etc/profile文件`export QUARTUS_ROOTDIR=/home/wangjc/intelFPGA/16.1/quartus
export ALTERAOCLSDKROOT=/home/wangjc/intelFPGA/16.1/hld
export PATH=$PATH:”$QUARTUS_ROOTDIR”/bin: ”$ALTERAOCLSDKROOT”/linux64/bin:”$ALTERAOCLSDKROOT”/bin:/home/wangjc/intelFPGA/16.1/embedded/ds-5/DS-5_v5.25.0/bin
export LD_LIBRARY_PATH=”$ALTERAOCLSDKROOT”/linux64/lib
export AOCL_BOARD_PACKAGE_ROOT=”$ALTERAOCLSDKROOT”/board/terasic/de1soc
export QUARTUS_64BIT=1`
上面的引号`”`需要是英文的,否则报错
`export QUARTUS_ROOTDIR=/home/wangjc/intelFPGA/16.1/quartus
export ALTERAOCLSDKROOT=/home/wangjc/intelFPGA/16.1/hld
export PATH=$PATH:"$QUARTUS_ROOTDIR"/bin:"$ALTERAOCLSDKROOT"/linux64/bin:"$ALTERAOCLSDKROOT"/bin:/home/wangjc/intelFPGA/16.1/embedded/ds-5/DS-5_v5.25.0/bin
export LD_LIBRARY_PATH=$ALTERAOCLSDKROOT/linux64/lib
export AOCL_BOARD_PACKAGE_ROOT=$ALTERAOCLSDKROOT/board/terasic/de1soc
export QUARTUS_64BIT=1`
应用设置`wangjc@wangjc-Inspiron-3668:/etc$ source /etc/profile
`
18. 确认环境变量是否匹配。(每次都要`source /etc/profile` ?可能是配置上有问题)
`wangjc@wangjc-Inspiron-3668:~$ aocl version
`输出aocl版本
`wangjc@wangjc-Inspiron-3668:~$ aoc --list-boards
`输出支持的bsp
`wangjc@wangjc-Inspiron-3668:~$ echo $AOCL_BOARD_PACKAGE_ROOT`输出bsp文件夹
19. 按照文档编译example中的boardtest时发现报错:
`wangjc@wangjc-Inspiron-3668:~/intelFPGA/16.1/hld/board/terasic/de1soc/examples/boardtest$ aoc device/boardtest.cl --sw-dimm-partition -o bin/boardtest.aocx
Board 'de1soc' not found.
Searched in the board package at:
/home/wangjc/intelFPGA/16.1/hld/board/terasic/de1soc
Board list:
de1soc_sharedonly
If you are using a 3rd party board, please ensure:
1) The board package is installed (contact your 3rd party vendor)
2) You have set the environment variable 'AOCL_BOARD_PACKAGE_ROOT'
to the path to your board package installation
Error: No board_spec.xml found for board 'de1soc' (Searched for: /home/wangjc/intelFPGA/16.1/hld/board/terasic/de1soc/./de1soc/board_spec.xml).
`怀疑是cl文件中的板配置名不对。查看readme 文件后发现可以指定board,将board指定为de1soc_sharedonly,注意要将权限设置为合适,sudo不行的话设置`sudo -s`切换为长期权限。
`wangjc@wangjc-Inspiron-3668:~/intelFPGA/16.1/hld/board/terasic/de1soc/examples/boardtest$ aoc device/boardtest.cl --sw-dimm-partition -o bin/boardtest.aocx --board de1soc_sharedonly
`
20. 额。。。发现需要opencl的licese。。。`Could not acquire a valid license for the Intel(R) FPGA SDK for OpenCL(TM).
Error: Verilog generator FAILED.
Refer to boardtest/boardtest.log for details.
`偷的懒都是要还的啊~~
尝试直接使用quartus的license`export LM_LICENSE_FILE=/home/wangjc/intelFPGA/16.1/licenses/license.dat `错误依旧
21. 获取license后编译。(还老是要source /etc/profile)
22. 等待编译,warning挺多。。。编译后成功生成aocx文件。