Sunteți pe pagina 1din 5

Quick Start Guide For Using Intel Compiler

To Build Applications Targeting Quark SoC On Galileo Board


1. Introduction:
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.

ii. 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.

Quick Start Guide For Using Intel Compiler


To Build Applications Targeting Quark SoC On Galileo Board
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_64pokysdk-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/i586poky-linux-uclibc/i586-poky-linux-uclibc-g++
$

Quick Start Guide For Using Intel Compiler


To Build Applications Targeting Quark SoC On Galileo Board
ii.

Cross-compile using i586-poky-linux-uclibc-g++:


$ i586-poky-linux-uclibc-g++ --sysroot=/home/jdpatel/3rduino1.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.
iii.

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/.
root@1.2.3.4's password:
helloworld-quark-gcc
100% 6281
6.1KB/s
$

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'
root@1.2.3.4's password:
Hello World from QUARK - using GCC!!!
$

Or, login to the target and execute it locally:


$ ssh root@1.2.3.4
root@1.2.3.4's password:
# 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

00:00

Quick Start Guide For Using Intel Compiler


To Build Applications Targeting Quark SoC On Galileo Board
$ 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.

ii.

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_64pokysdk-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/i586poky-linux-uclibc/i586-poky-linux-uclibc-g++
$

iii.

Cross-compile using ICC:


$ icc -mia32 --sysroot=/home/jdpatel/arduino1.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/.
root@1.2.3.4's password:
helloworld-quark-icc
100%
15KB 14.9KB/s
$

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'
root@1.2.3.4's password:

00:00

Quick Start Guide For Using Intel Compiler


To Build Applications Targeting Quark SoC On Galileo Board
Hello World from QUARK - using ICC!!!
$

Or, login to the target and execute it locally:


$ ssh root@1.2.3.4
root@1.2.3.4's password:
# cd ~/scratch/
# ./helloworld-quark-icc
Hello World from QUARK - using ICC!!!
#

4. Troubleshooting:
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/arduino1.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.


ii.

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.

S-ar putea să vă placă și