1. Introduction: Quick Start Guide For Using Intel Compiler This document explains how to build applications using Intel compiler for Intel Quark SoC X1000 on the Intel Galileo board. Quark is a Pentium ISA instruction compatible 32-bit SoC. It does not support SSE class instructions, so the binaries have to be built/cross-compiled with appropriate compiler flags targeting Quark SoC. Intel Galileo board is supported with downloadable software at: https://communities.intel.com/community/makers/drivers Arduino software development framework based applications can be developed to run on Intel Galileo board using the Arduino IDE that is downloadable from the above link. Please refer to the Intel Galileo Getting Started Guide for all details. Intel Galileo board runs Yocto based Poky Linux distribution. So, native Linux based applications can also be built using both GCC and Intel compiler. This document details necessary steps to cross-compile applications targeting the Intel Quark SoC on the Galileo board. Current scope of this document is limited to use Linux based host build system environment. 2. Prerequisites: This section details the host system and necessary tools for the steps coming up in next section to cross-compile the applications for target Quark SoC. a. Host system configuration supported Linux OS based machine: i. Download and install Intel System Studio with Intel Composer XE installed on the host. Download, install, and setup Arduino IDE SDK: o Refer to the Intel Galileo Getting Started Guide for this installation o Make sure that the Galileo software is installed and setup as per the following note: Note: The first time you compile and install a sketch, the Galileo software will be installed automatically. This requires appropriate file and directory access permissions. You may be required to run the IDE as root or using sudo arduino depending on your Linux distribution. 1
o Note the SDK setup success message in the Arduino IDE: /home/jdpatel/arduino-1.5.3/hardware/tools/install_script.sh Setting it up...done SDK has been successfully set up and is ready to be used. b. Optional Target system configuration Intel Galileo board setup: Note that this step is required for running the cross-compiled binaries only. It is not required for just cross-compiling the target binaries on the host system. Follow the Intel Galileo Getting Started Guide for following steps and configure Intel Galileo board for remote access over SSH. 3. Steps: This section provides the steps necessary to first setup the cross-compilation environment and then usage of proper flags for cross-compilation. Following hello-world example is used for cross-compilation in rest of the steps: cat HelloWorldQuark.c #include <stdio.h> int main(int argc, char* argv[]) { #ifdef INTEL_COMPILER printf("hello World from QUARK - using ICC!!!\n"); #else printf("hello World from QUARK - using GCC!!!\n"); #endif return(0); } A. Build using GCC compiler i. Include path for uclibc tools under Poky Linux SDK tools: export PATH=/home/jdpatel/arduino-1.5.3/hardware/tools/sysroots/x86_64- pokysdk-linux/usr/bin/i586-poky-linux-uclibc/:path which i586-poky-linux-uclibc-g++ ~/2rduino-1.5.3/hardware/tools/sysroots/x86_64-pokysdk-linux/usr/bin/i586- poky-linux-uclibc/i586-poky-linux-uclibc-g++ 2
Cross-compile using i586-poky-linux-uclibc-g++: i586-poky-linux-uclibc-g++ --sysroot=/home/jdpatel/3rduino- 1.5.3/hardware/tools/sysroots/i586-poky-linux-uclibc HelloWorldQuark.c o helloworld-quark-gcc./helloworld-quark-gcc -bash:./helloworld-quark-gcc: /lib/ld-uclibc.so.0: bad ELF interpreter: No such file or directory This is not an error because the cross-compiled binary is targeted to run on Quark SoC and not on the host system running on Core series processor. i Optional Copy binary to the Galileo board: Note replace 1.2.3.4 with actual ip-address of target in following step scp helloworld-quark-gcc root@1.2.3.4:/home/root/scratch/. helloworld-quark-gcc 100% 6281 6.1KB/s 00:00 iv. Optional Execute the cross-compiled binary on the target: Note replace 1.2.3.4 with actual ip-address of target in following steps Launch execution remotely on the target directly from the host: ssh root@1.2.3.4 '/home/root/scratch/quark-helloworld-gcc' Hello World from QUARK - using GCC!!! Or, login to the target and execute it locally: ssh root@1.2.3.4 # cd ~/scratch/ #./helloworld-quark-gcc Hello World from QUARK - using GCC!!! # B. Build using Intel compiler i. Source the Intel compiler from Intel System Studio package: 3
source /opt/intel/system_studio_2014.0.025/bin/iccvars.sh ia32 [jdpatel@core-fedora HelloWorldQuark] icc -V Intel(R) C Compiler for IA-32 applications, Version 14.0.0.025 Build 20140121 Copyright (C) 1985-2014 Intel Corporation. All rights reserved. Include path for uclibc tools under Poky Linux SDK tools (same as for build using GCC): export PATH=/home/jdpatel/arduino-1.5.3/hardware/tools/sysroots/x86_64- pokysdk-linux/usr/bin/i586-poky-linux-uclibc/:path which i586-poky-linux-uclibc-g++ ~/arduino-1.5.3/hardware/tools/sysroots/x86_64-pokysdk-linux/usr/bin/i586- poky-linux-uclibc/i586-poky-linux-uclibc-g++ i Cross-compile using ICC: icc -mia32 --sysroot=/home/jdpatel/arduino- 1.5.3/hardware/tools/sysroots/i586-poky-linux-uclibc -gnu-prefix=i586-pokylinux-uclibc- HelloWorldQuark.c -o helloworld-quark-icc./helloworld-quark-icc -bash:./helloworld-quark-icc: /lib/ld-uclibc.so.0: bad ELF interpreter: No such file or directory This is not an error because the cross-compiled binary is targeted to run on Quark SoC and not on the host system running on Core series processor. v. Optional Copy binary to the Galileo board: Note replace 1.2.3.4 with actual ip-address of target in following step scp helloworld-quark-icc root@1.2.3.4:/home/root/scratch/. helloworld-quark-icc 100% 15KB 14.9KB/s 00:00 vi. Optional Execute the cross-compiled binary on the target: Note replace 1.2.3.4 with actual ip-address of target in following steps Launch execution remotely on the target directly from the host: ssh root@1.2.3.4 '/home/root/scratch/quark-helloworld-icc' 4
4. Troubleshooting: Quick Start Guide For Using Intel Compiler Hello World from QUARK - using ICC!!! Or, login to the target and execute it locally: ssh root@1.2.3.4 # cd ~/scratch/ #./helloworld-quark-icc Hello World from QUARK - using ICC!!! # This section may help resolving some of the common errors related to above steps: i. If the Arduino SDK setup was not completed, following compilation error occurs: i586-poky-linux-uclibc-g++ --sysroot=/home/jdpatel/arduino- 1.5.3/hardware/tools/sysroots/i586-poky-linux-uclibc HelloWorldQuark.c -o helloworld-quark-gcc -bash: /home/jdpatel/arduino-1.5.3/hardware/tools/sysroots/x86_64-pokysdklinux/usr/bin/i586-poky-linux-uclibc/i586-poky-linux-uclibc-g++: /opt/clantontiny/1.4.2/sysroots/x86_64-pokysdk-linux/lib/ld-linux-x86-64.so.2: bad ELF interpreter: No such file or directory Follow the Arduino SDK setup step explained in prerequisites section. While setting up the Arduino SDK, if you encounter following error: find: invalid mode +111 Setting it up...sdk could not be set up. Relocate script failed. Abort! Make following change in file ~/arduino-1.5.3/hardware/tools/install_script.sh: < executable_files=(sudo_exec find native_sysroot -type f -perm +111) --- > executable_files=(sudo_exec find native_sysroot -type f -perm /111) Arduino SDK setup step explained in prerequisites section should now be successful. 5