Using Intel C++ Compiler for Tizen*

 

      The Intel® C++ Compiler, also known as icc, is a high performance compiler which lets you build and optimize your C/C++ applications for the Tizen* operating system. In this document we will describe how to use Intel C++ compiler to build the applications for Tizen*.
      This article covers:
           Installation
           Using Intel C++ Compiler from the Command line
           Using Intel C++ Compiler from the Tizen Eclipse IDE
           References

Installation

      Install Tizen SDK
      
The Tizen SDK is a comprehensive set of tools for developing Tizen Web and Native applications. It consists of IDE, Emulator, toolchain, sample code, and documentation. The Tizen SDK is required to build native applications for Tizen. You can visit website https://developer.tizen.org/downloads/tizen-sdk to download and install the latest Tizen SDK.

      Install Intel System Studio
      The Intel® C++ compiler that provides the Tizen OS support, is a component of Intel® System Studio. Intel system studio is a comprehensive tools suite for embedded system development. For more information of Intel system studio, please visit http://software.intel.com/en-us/intel-system-studioIntel system studio 2014 release supports both Windows and Linux as the host operation system. In this document, we will mainly use the Linux host as an example. For windows host, the tools can be used in a similar way.
      After installing Intel System studio, the Intel C++ compiler will be installed in your host directory which is /opt/intel/system_studio_2014.x.y by default.

      Install ICC plugin scripts for Tizen SDK
      Download the file icc-plugins-tizen-sdk.zip from the attachment of this article. This file contains the ICC plugin scripts for Tizen SDK. Extract the files to the folder TIZEN-SDK/tools/smart-build-interface/plugins  where TIZEN-SDK is the installation folder of the Tizen SDK. In the tools/smart-build-interface/plugins folder, there are 4 files with file name starting with icc140. These files will be used by Eclipse IDE when building the native applications for Tizen with the ICC compiler.
      Please note that these plugin scripts are only for early experiments . If you get any issues when using ICC compiler for Tizen, please contact Intel System Studio Support.

Using Intel C++ Compiler from the Command line

      You can follow the following steps to build  applications for a Tizen* target.

  1. Set up the Tizen SDK environment variables. We need to set the PATH, TZN_SYSROOT and TZN_EXEC_PREFIX environment variables to match cross compilation tools directories, for example,
    $ export PATH=/TIZEN-SDK/tools/i386-linux-gnueabi-gcc-4.5/bin:$PATH
    $ export TZN_SYSROOT=/TIZEN-SDK/platforms/tizen2.2/rootstraps/tizen-emulator-2.2.native
    $ TZN_EXEC_PREFIX=i386-linux-gnueabi-
    $ source /opt/intel/system_studio_x.y/bin/compilervars.sh ia32
    In the above setting, we have added Tizen GCC-4.5 toolchain into PATH. We set the TZN_SYSROOT to the sysroot of Tizen emulator. If you are working on the hardware device, you may change the sysroot to tizen-device-2.2.native. TZN_EXEC_PREFIX is the prefix of the Tizen GCC-4.5 which is “i386-linux-gnueabi-“. Intel C++ compiler will use this prefix to invoke the GNU bin utilities such as i386-linux-gnueabi-ld etc.
    On the windows platform, you may do the similar setup by using “set” instead of “export” in the windows command shell.
     
  2. Cross compilation. In the ICC version 14.0 release, it supports --sysroot option which is compatible with GCC compiler. When compiling for Tizen* target, specify –gnu-prefix= and --sysroot= option. For example, to compile a hello-tizen.c source file for Tizen* target,
    $ icc –gnu-prefix=$TZN_EXEC_PREFIX –sysroot=$TZN_SYSROOT hello-tizen.c –o hello-tizen
     
  3. If you are building a Makefile based application for Tizen, to use Intel C++ compiler for build, you may change your makefile where:
    “i386-linux-gnueabi-gcc”  to “icc –gnu-prefix=i386-linux-gnueabi-”
    “i386-linux-gnueabi-g++”  to “icpc –gnu-prefix=i386-linux-gnueabi-”
    “i386-linux-gnueabi-ar”  to “xiar –qgnu-prefix=i386-linux-gnueabi-”
    “i386-linux-gnueabi-ld”  to “xild –qgnu-prefix=i386-linux-gnueabi-”

    You may also refer to the article Improved sysroot support in Intel C++ Compiler for cross compile for more information regarding the option –gnu-prefix and --sysroot.

Using Intel C++ Compiler from the Tizen Eclipse IDE

      The attached “icc-plugins-tizen-sdk.zip" file provides the ICC-14.0 toolchain support in the Tizen Eclipse IDE. The files in “icc-plugins-tizen-sdk.zip” should be copied to TIZEN-SDK/tools/smart-build-interface/plugins in order to use ICC compiler from Tizen Eclipse IDE. The ICC plugins support the Tizen application build, platform build, static library and shared library build.
      Here is a tutorial showing how to use the Intel C++ compiler in the Tizen Eclipse IDE.

  1. Set up ICC environment and invoke Tizen Eclipse IDE
    #go to ide folder of Tizen SDK
    $ cd TIZEN-SDK/ide

    #set up ISS_BASE_DIR environment variable, change the path to match your installation of Intel System Studio.
    $ export ISS_BASE_DIR=/opt/intel/system_studio_2014.x.y

    #set up icc working environment. The icc will be added into $PATH
    $ source /opt/intel/system_studio_2014.x.y/bin/compilervars.sh ia32

    #start up the Eclipse IDE
    $./startup.sh
     
  2. Create a new HelloTizen project
    Click Eclipse IDE Menu File->New->Project, in the New Project window, select “Tizen Native Project”, then click “Next” for next step.

    Select the Template or Sample for your project. Here we just select “Form-based Application” which shown as below. Click “Finish” button to close the setup wizard.

     
  3. Setup Project Properties to use ICC compiler
    Now we have the HelloTizen project in the Eclipse IDE. Select “Properties” in the popup menu by right clicking the project, or click Menu Project -> Properties.
    In the Properties for HelloTizen window, click “Tizen Settings”, in the “Toolchain Information”, select “ICC-14.0” as the toolchain name.


    Now if we click the C/C++ Build -> Settings, we find that the compiler command has been changed to Intel C++ Compiler.

     
  4. Build the project with Intel C++ compiler
    Right click the project HelloTizen, click “Build Project” in the popup manual, or click IDE menu ProjectàBuild Project, Intel C++ compiler will be invoked automatically to build the project. You can check the output from Console which shown as below.

     
  5. Setup Tizen Emulator
    If we don’t have a Tizen based devices, Tizen emulator can be used to run the Tizen application testing. Click Menu WindowàShow ViewàConnection Explorer. In the connection window, start the Emulator Manager, add a new Tizen emulator and launch it. Make sure you have “CPU VT” enabled (ON) in the HW Support so that the emulator can run much faster.

    Launch the Tizen emulator.

     
  6. Run the HelloTizen application
    Launch the HelloTizen application as “Tizen Native Application”. This shows the application running on the Tizen emulator.

References

Intel System Studio
http://software.intel.com/en-us/intel-system-studio

Tizen* Developer Home
https://developer.tizen.org

This article applies to:
Products: INTEL(R) System Studio 2014
Host OS/platforms: Windows (IA-32, Intel(R) 64), Linux* (IA32, Intel(R) 64)
Target OS/platforms: Tizen*

 

 

有关编译器优化的更完整信息,请参阅优化通知