This is draft page
Prerequisite
This page present how to develop
OpenCL using Sodia Board BSP and prebuilt SD card image.
You need following preparation for development
OpenCL on Sodia Board:
- Sodia Board
- Linux or Windows Host PC
Need to install following software in host PC.
- Quartus Prime v15.1
- SoC EDS v15.1
- Altera SDK for OpenCL v15.1
License is needed to compile FPGA using Altera SDK for OpenCL. Please contact to distributor.
- External USB SD Card Reader or SD Card slot.
- SD Card or SDHC Card over 4GB. Actual image size is 2GB, but normally SD Card has bad sector, so there is possibility to cause boot issue.
- [ Optional ] Local Ethernet Network with DHCP server to apply IP address for target board.
Sodia Board Settings
This section described board settings for
OpenCL exection. Please set according to below.
- MSEL (J7)
OpenCL SD Card image will configure FPGA from HPS. So MSEL is needed to set as FPP mode. Sodia Board has MSEL jumper(J7-J11) on the left upper side. Please set as follows:
- BSEL & CSEL
Select BSEL as SD Card boot(101b). CSEL setting is not related to OpenCL execution. Set as 00b .
- USB-UART Connector (CN11)
Use as console. Please connect to host PC via USB cable.
- SD Card Slot (CN13)
Please insert SD Card.
- HPS Ethernet Connector (CN10)
This will use for data exchange between host PC and Linux on target board.
Download Contents
How to execute OpenCL
Prepare SD Card
Please refer to "
Creating and Updating SD Card" page how to prepare SD Card. All In One Image is provided from above
Download Contents. We recommend to use Embedeed_Command_Shell(within
SoC EDS) to extract archive file as follows.
$ tar zxf sodia_opencl_sdimage_v1511_r3.tar.gz
Boot Linux
Please refer to "
Creating and Updating SD Card" page how to connect terminal software.
Type "root" when displayed login prompt. login prompt will be out of alignment by network info, but you can type "root".
OpenCL execution with prebuild OpenCL application & kernel image
This section describe how to execute
OpenCL using prebuild
OpenCL app & kernel image.
After login,please type "ls" to check files for setup a
OpenCL that stored in current directory.
$ ls

Setup a
OpenCL environment by execute following command. This script will set environment variable and install device driver for
OpeCL.
$ source ./init_opencl.sh
Type following command to diagnose
OpenCL device.
$ aocl diagnose

Transfer prebuild
OpenCL app & kernel image to Linux on target board. In this section, SCP command is using to transfer data via ethernet for this purpose as one of an example,but you can use another way to transfer data. This command is executing from Embedded_Command_Shell on host PC. At this time, IP address of target board and host PC should be set in same segment. IP address of target board and host PC is needed in same segment. (Please set IP address for your environment)
$ scp hello_world.aocx root@XX.XX.XX.XX:/home/root/hello_world.aocx
$ scp hello_world.elf root@XX.XX.XX.XX:/home/root/hello_world.elf
Note: Please type "yes", if you will see any errors such as host can not registered. Data transfer is normally completed.
After data transfer, you can see following files from Linux console.

Program
OpenCL kernel
(This command is not must, but better.)
$ aocl program /dev/acl0 hello_world.aocx
Execute
OpenCL application。
(Need to store "hello_world.aocx" in same directory)
$ ./hello_world.elf

You can see
OpenCL is executed on Sodia board using prebuild images.
Compile OpenCL kernel using Sodia Board BSP
Install BSP for Sodia board
Please download sodia.zip from
Download Contents section and extract it under the install directory of Altera SDK for
OpenCL as follows:
C:\altera\15.1\hld\board\
Setup Host PC
Launch "Embedded_Command_Shell".
Setup environment variable to compile OpenCL kernel image. You need to set following environment variable for compilation.
$ export ALTERAOCLSDKROOT="C:\altera\15.1\hld"
$ export PATH=${ALTERAOCLSDKROOT}/bin:$PATH
$ export AOCL_BOARD_PACKAGE_ROOT=${ALTERAOCLSDKROOT}/board/sodia
Then type following command to confirm environment variable is set properly. You can see BSP for Sodia board.
$ aoc --list-boards
Download Sample Design
Some examples are provided from ALTERA Web Site. In this section, use
VectorAdd example for your reference. Please download "v15.0 Arm32 (Linux and Windows) package (.tgz)" from following link.

Extract it in any directory.
Modify "Makefile" under vector_add directory to avoid a conflict of destination name. Modify "TARGET" of Line 57 to "vector_add.elf".

Move to "vector_add" directory, and then type following command to compile
OpenCL kernel. This command will do FPGA compilation, so you need to wait roughly 20-40 min (It depend on your PC spec). Also, license is needed for this command. Please contact to distributor for license.
$ aoc -v device/vector_add.cl -o bin/vector_add.aocx --board sodia_sharedonly

After compalation is finished, "vector_add.aocx" is generated under "bin" directory.
Build OpenCL application for ARM
Build application for ARM Linux that is working on target board. Type following command in "vector_add" directory to create application.
$ make all

After build is successful, "vector_add.elf" is created under "bin" directory.
Execute Own OpenCL app & kernel
Transfer those images that is generated by above section to Linux working on target board.
$ scp bin/vector_add.aocx root@XX.XX.XX.XX:/home/root/vector_add.aocx
$ scp bin/vector_add.elf root@XX.XX.XX.XX:/home/root/vector_add.elf
Note: Please type "yes", if you will see any errors such as host can not registered. Data transfer is normally completed.
Proogram
OpenCL kernel & Execute
OpenCL app using following command.
(Need to store "vector_add.aocx" in same directory)
$ ./vector_add.elf"

You can execute own
OpenCL app & kernel.