3.7. Creating the FPGA Hardware Configuration File of an OpenCL Kernel
- Verify that the QUARTUS_ROOTDIR_OVERRIDE environment variable points to your Intel® Quartus® Prime software. Open a shell and then type echo $QUARTUS_ROOTDIR_OVERRIDE at the command prompt.
If the path to the installation directory of the Intel® Quartus® Prime software is not returned, add it to the QUARTUS_ROOTDIR_OVERRIDE setting.
- Select your target FPGA board. To list the FPGA boards available in your Custom Platform, invoke the command aoc -list-boards at a command prompt. If you have not installed an OpenCL BSP, No board support packages installed message displays. Use the -board-package=<board_package_path> option to point to the OpenCL BSP.
If you have multiple OpenCL BSPs installed, you can compile your kernel with the board variant from a specific Custom Platform by including -board-package=<custom_platform_path> option with -board=<board_name> . At the command prompt, invoke the following command:
aoc -board-package=<board_package_path> -board=<board_name> kernel.cl
The Intel® FPGA SDK for OpenCL™ Offline Compiler compiles the kernel with the board specified in the <board_package_path>. To list Custom Platforms available in the system, include the -list-board-packages option in the aoc command.
For more information about -list-boards, -board-package, and -list-board-packages options of the aoc command, refer to the Listing the Available FPGA Boards in Your Custom Platform (-list-boards and -list-board-packages) section of the Intel® FPGA SDK for OpenCL™ Pro Edition Programming Guide.
- At a command prompt, navigate to the hello_world design directory containing the hello_world.cl file that you used for emulation.
- To compile the kernel for your target FPGA board, invoke the following command:
aoc -v -board-package=<board_package_path> -board=<board_name> device/hello_world.cl -o bin/hello_world.aocx
This command performs the following tasks:
- Generates the Intel® Quartus® Prime design project files from the OpenCL source code.
- Checks for initial syntax errors.
- Performs basic optimizations.
- Creates a hello_world directory containing necessary intermediate files.
- Creates the .aocx file.
- If you have only one FPGA board installed, -board=<board_name> is optional.
- If you have only one OpenCL BSP installed, -board-package=<board_package_path> is optional.
The .aocx file might take hours to build, depending on the complexity of the kernel. To view the progress of the compilation on-screen, include the -v flag in your aoc command. An example output is shown below.
aoc: Environment checks are completed successfully. You are now compiling the full flow!! aoc: Selected target board <board_name> aoc: Running OpenCL parser.... aoc: OpenCL parser completed successfully. aoc: Compiling.... aoc: Linking with IP library ... aoc: First stage compilation completed successfully. aoc: Setting up project for CvP revision flow.... aoc: Hardware generation completed successfully.
The offline compiler displays the line aoc: Hardware generation completed successfully. to signify the completion of the compilation process.
For more information about the -board=<board_name> option of the aoc command, refer to the Compiling a Kernel for a Specific FPGA Board and Custom Platform (-board=<board_name>) and (-board-package=<board_package_path>) section of the Intel® FPGA SDK for OpenCL™ Pro Edition Programming Guide.
For more information about the -v option of the aoc command, refer to the Generating Compilation Progress Report (-v) section of the Intel® FPGA SDK for OpenCL™ Pro Edition Programming Guide.
For more information about the -o <filename> option of the aoc command, refer to the Specifying the Name of an Intel® FPGA SDK for OpenCL™ Offline Compiler Output File (-o <filename>) section of the Intel® FPGA SDK for OpenCL™ Pro Edition Programming Guide.