Skip to content

Commit

Permalink
Merge pull request #1293 from RostakaGmfun/KAA-1571-release10
Browse files Browse the repository at this point in the history
KAA-1571: Introduce CMake toolchain file for Intel Edison platform.
  • Loading branch information
rasendubi authored Nov 17, 2016
2 parents a3b9d68 + 46a359c commit 49cdf41
Show file tree
Hide file tree
Showing 4 changed files with 115 additions and 27 deletions.
61 changes: 61 additions & 0 deletions client/client-multi/client-c/toolchains/edison.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#
# Copyright 2014-2016 CyberVision, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# The following configuration variables are accepted:
#
# * EDISON_SDK_ROOT
# Absolute path to the Intel Edison SDK root directory.
# Default value: /opt/poky-edison/1.6
#


if(NOT DEFINED SDK_32bits)
set(SDK_32bits FALSE)
endif()

#Set the target parameters
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_VERSION 3.10.17-poky-edison+)
set(CMAKE_SYSTEM_PROCESSOR i686)

if(NOT DEFINED EDISON_SDK_ROOT)
set(EDISON_SDK_ROOT /opt/poky-edison/1.6)
endif()

message(STATUS "EDISON_SDK_ROOT: ${EDISON_SDK_ROOT}")

if(SDK_32bits)
set(cross_compiler_sysroot ${EDISON_SDK_ROOT}/sysroots/i686-pokysdk-linux)
else()
set(cross_compiler_sysroot ${EDISON_SDK_ROOT}/sysroots/x86_64-pokysdk-linux)
endif()
set(CMAKE_C_COMPILER ${cross_compiler_sysroot}/usr/bin/i586-poky-linux/i586-poky-linux-gcc)
set(CMAKE_CXX_COMPILER ${cross_compiler_sysroot}/usr/bin/i586-poky-linux/i586-poky-linux-g++)


set(CMAKE_SYSROOT ${EDISON_SDK_ROOT}/sysroots/core2-32-poky-linux)
set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT})
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

SET(CMAKE_C_FLAGS "--sysroot=${CMAKE_SYSROOT} -m32 -march=i586 -ffunction-sections -fdata-sections" CACHE STRING "" FORCE)
SET(CMAKE_CXX_FLAGS "--sysroot=${CMAKE_SYSROOT} -m32 -march=i586 -ffunction-sections -fdata-sections" CACHE STRING "" FORCE)

include_directories(${CMAKE_SYSROOT}/usr/include)
include_directories(${CMAKE_SYSROOT}/usr/include/c++)
include_directories(${CMAKE_SYSROOT}/usr/include/c++/i586-poky-linux)
71 changes: 48 additions & 23 deletions client/client-multi/client-cpp/toolchains/edison.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,49 +13,74 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# The following configuration variables are accepted:
#
# * EDISON_SDK_ROOT
# Absolute path to the Intel Edison SDK root directory.
# Default value:
# * Windows:
# * 32-bit: C:/Edison/poky-edison-eglibc-i686-edison-image-core2-32-toolchain-1.7.2
# * 64-bit: C:/Edison/poky-edison-eglibc-x86_64-edison-image-core2-32-toolchain-1.7.2
# * UNIX: /opt/poky-edison/1.6
# * EDISON_MAKE_PROGRAM
# Used on Windows platform to supply absolute path to make utility.
# Default value:
# * 32-bit: C:/Program Files/mingw/i686-4.9.2-posix-dwarf-rt_v3-rev1/mingw32/bin/mingw32-make.exe
# * 64-bit: C:/Program Files (x86)/mingw/i686-4.9.2-posix-dwarf-rt_v3-rev1/mingw32/bin/mingw32-make.exe
#

if(NOT DEFINED SDK_32bits)
set(SDK_32bits FALSE)
set(SDK_32bits FALSE)
endif()

#Set the target parameters
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_VERSION 3.10.17-poky-edison+)
set(CMAKE_SYSTEM_PROCESSOR i686)

if(NOT DEFINED EDISON_SDK_ROOT AND WIN32)
if(${SDK_32bits})
set(EDISON_SDK_ROOT C:/Edison/poky-edison-eglibc-i686-edison-image-core2-32-toolchain-1.7.2)
else()
set(EDISON_SDK_ROOT C:/Edison/poky-edison-eglibc-x86_64-edison-image-core2-32-toolchain-1.7.2)
endif()
else(NOT DEFINED EDISON_SDK_ROOT)
set(EDISON_SDK_ROOT /opt/poky-edison/1.6)
if(NOT DEFINED EDISON_SDK_ROOT)
if(WIN32)
if(SDK_32bits)
set(EDISON_SDK_ROOT "C:/Edison/poky-edison-eglibc-i686-edison-image-core2-32-toolchain-1.7.2")
else()
set(EDISON_SDK_ROOT "C:/Edison/poky-edison-eglibc-x86_64-edison-image-core2-32-toolchain-1.7.2")
endif()
else()
set(EDISON_SDK_ROOT /opt/poky-edison/1.6)
endif()
endif()

message(STATUS "EDISON_SDK_ROOT: ${EDISON_SDK_ROOT}")

#Set the host parameters
if(WIN32)
#Windows host
if(${SDK_32bits})
if(NOT DEFINED EDISON_MAKE_PROGRAM)
if(SDK_32bits)
set(CMAKE_MAKE_PROGRAM "C:/Program Files/mingw/i686-4.9.2-posix-dwarf-rt_v3-rev1/mingw32/bin/mingw32-make.exe")
else(SDK_32bits)
set(CMAKE_MAKE_PROGRAM "C:/Program Files (x86)/mingw/i686-4.9.2-posix-dwarf-rt_v3-rev1/mingw32/bin/mingw32-make.exe")
endif(SDK_32bits)
else()
set(CMAKE_MAKE_PROGRAM "${EDISON_MAKE_PROGRAM}")
endif()
#Windows host
if(SDK_32bits)
set(cross_compiler_sysroot ${EDISON_SDK_ROOT}/sysroots/i686-pokysdk-mingw32)
#MinGW make
set(CMAKE_MAKE_PROGRAM "C:/Program Files/mingw/i686-4.9.2-posix-dwarf-rt_v3-rev1/mingw32/bin/mingw32-make.exe")
else()
set(cross_compiler_sysroot ${EDISON_SDK_ROOT}/sysroots/x86_64-pokysdk-mingw32)
#MinGW make
set(CMAKE_MAKE_PROGRAM "C:/Program Files (x86)/mingw/i686-4.9.2-posix-dwarf-rt_v3-rev1/mingw32/bin/mingw32-make.exe")
endif()
set(CMAKE_C_COMPILER ${cross_compiler_sysroot}/usr/bin/i586-poky-linux/i586-poky-linux-gcc.exe)
set(CMAKE_CXX_COMPILER ${cross_compiler_sysroot}/usr/bin/i586-poky-linux/i586-poky-linux-g++.exe)
set(CMAKE_CXX_COMPILER ${cross_compiler_sysroot}/usr/bin/i586-poky-linux/i586-poky-linux-g++.exe)
else()
#Linux host
if(${SDK_32bits})
if(SDK_32bits)
set(cross_compiler_sysroot ${EDISON_SDK_ROOT}/sysroots/i686-pokysdk-linux)
else()
set(cross_compiler_sysroot ${EDISON_SDK_ROOT}/sysroots/x86_64-pokysdk-linux)
endif()
set(CMAKE_C_COMPILER ${cross_compiler_sysroot}/usr/bin/i586-poky-linux/i586-poky-linux-gcc)
set(CMAKE_CXX_COMPILER ${cross_compiler_sysroot}/usr/bin/i586-poky-linux/i586-poky-linux-g++)
set(CMAKE_CXX_COMPILER ${cross_compiler_sysroot}/usr/bin/i586-poky-linux/i586-poky-linux-g++)
endif()


Expand All @@ -66,9 +91,9 @@ set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

SET(CMAKE_C_FLAGS "-Os -g3 -Wall --sysroot=${CMAKE_SYSROOT} -m32 -march=i586 -ffunction-sections -fdata-sections" CACHE STRING "" FORCE)
SET(CMAKE_CXX_FLAGS "-Os -g3 -Wall --sysroot=${CMAKE_SYSROOT} -m32 -march=i586 -ffunction-sections -fdata-sections" CACHE STRING "" FORCE)
SET(CMAKE_C_FLAGS "--sysroot=${CMAKE_SYSROOT} -m32 -march=i586 -ffunction-sections -fdata-sections" CACHE STRING "" FORCE)
SET(CMAKE_CXX_FLAGS "--sysroot=${CMAKE_SYSROOT} -m32 -march=i586 -ffunction-sections -fdata-sections" CACHE STRING "" FORCE)

INCLUDE_DIRECTORIES(${CMAKE_SYSROOT}/usr/include)
INCLUDE_DIRECTORIES(${CMAKE_SYSROOT}/usr/include/c++)
INCLUDE_DIRECTORIES(${CMAKE_SYSROOT}/usr/include/c++/i586-poky-linux)
include_directories(${CMAKE_SYSROOT}/usr/include)
include_directories(${CMAKE_SYSROOT}/usr/include/c++)
include_directories(${CMAKE_SYSROOT}/usr/include/c++/i586-poky-linux)
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ sort_idx: 60

The guide explains how to build applications for Intel Edison based on the Kaa C++ endpoint SDK.


# Configuring Intel Edison board

If this is the first time you use the Intel Edison technology, you have to start with configuring your board.
For this purpose, refer to the official Edison getting started guide.
After finishing with the guide, you will be able to access your board through both a serial terminal and the ssh client.

>**Note:** The instructions below are for the official Intel Edison firmware.
>**Note:** The instructions below are for the official Intel Edison firmware, Poky (Yocto Project Reference Distro) 1.7.3, kernel version 3.10.17-poky-edison+.

## Installing third-party components for C++ SDK

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Refer to [the Linux guide]({{root_url}}Programming-guide/Using-Kaa-endpoint-SDKs
**Verified against:**

- **Host OS:** Ubuntu 16.04 64-bit LTS
- **Target OS:** Poky (Yocto Project Reference Distro) 1.7.3
- **Target OS:** Poky (Yocto Project Reference Distro) 1.7.3, kernel version 3.10.17-poky-edison+.

# Install dependencies

Expand All @@ -44,9 +44,9 @@ Now, dependencies are installed and it is time to create Kaa application.
Since Edison is running Linux, you can refer to [the Linux guide]({{root_url}}Programming-guide/Using-Kaa-endpoint-SDKs/C/SDK-Linux/#c-sdk-build) for detailed process of application creation.
But remember, you must specify correct compiler when compiling your Kaa application for Intel Edison:

export EDISON_CC=/opt/poky-edison/1.6.1/sysroots/x86_64-pokysdk-linux/usr/bin/i586-poky-linux/i586-poky-linux-gcc
cmake -DKAA_MAX_LOG_LEVEL=3 -DCMAKE_C_COMPILER=$EDISON_CC ..
cmake -DKAA_MAX_LOG_LEVEL=3 -DCMAKE_TOOLCHAIN_FILE=PATH_TO_KAA_SDK/toolchains/edison.cmake ..
make

Where `PATH_TO_KAA_SDK` is path to Kaa C SDK relative to the `build` directory.
For more details on how to build, upload and run your application on Edison board, you may refer to official [user guide](https://software.intel.com/en-us/intel-edison-board-user-guide).

0 comments on commit 49cdf41

Please sign in to comment.