Unknown macro: {style}

.ia-secondary-container

Unknown macro: { margin}
Unknown macro: {div}
Kaa releases
Unknown macro: {div}
Shortcuts

Page tree
Skip to end of metadata
Go to start of metadata

This guide explains how to build applications for Samsung Artik 5 (further, the Artik) based on the Kaa C++ endpoint SDK (further, the C++ SDK).

Configuring Artik 5 board

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

Installing third-party components for C++ SDK

The following third-party components must be installed before building the C++ SDK.

  • Mandatory: Boost (1.54 min.v.), Avro (1.7.5), and Botan (only v.1.10) libraries.
  • Optional: To build Avro version higher than 1.7.5, you will need Boost with the iostream library. To build Boost with iostreams, you will need to build the zlib and the libbz2 libraries as described below.

Install the third-party components as follows:

  1. Install the toolchain.

    wget https://launchpad.net/linaro-toolchain-binaries/trunk/2013.10/+download/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux.tar.bz2
    tar xvjf gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux.tar.bz2
    sudo mv gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux /opt/gcc-linaro-arm-linux-gnueabihf
  2. Install zlib & libbz2 (for Avro version higher than 1.7.5).

    zlib
    wget http://zlib.net/zlib-1.2.8.tar.gz
    tar -xvzf zlib-1.2.8.tar.gz
    export INSTALLDIR=/opt/gcc-linaro-arm-linux-gnueabihf
    export PATH=$INSTALLDIR/bin:$PATH
    export TARGETMACH=arm-linux-gnueabi
    export BUILDMACH=i686-pc-linux-gnu
    export CROSS=arm-linux-gnueabihf
    export CC=${CROSS}-gcc
    export LD=${CROSS}-ld
    export AS=${CROSS}-as
    cd zlib-1.2.8
    ./configure --prefix=/opt/gcc-linaro-arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr
    make install
    bzip2
    wget http://www.bzip.org/1.0.6/bzip2-1.0.6.tar.gz
    tar -xvzf bzip2-1.0.6.tar.gz
    export INSTALLDIR=/opt/gcc-linaro-arm-linux-gnueabihf
    export PATH=$INSTALLDIR/bin:$PATH
    export TARGETMACH=arm-linux-gnueabi
    export BUILDMACH=i686-pc-linux-gnu
    export CROSS=arm-linux-gnueabihf
    export CC=${CROSS}-gcc
    export LD=${CROSS}-ld
    export AS=${CROSS}-as
    export AR=${CROSS}-ar
    cd bzip2-1.0.6
    sed -e "/^all:/s/ test//" Makefile > Makefile-libbz2_so
    make -f Makefile-libbz2_so CC="${CC}" AR="${AR}"
    make PREFIX=${INSTALLDIR}/arm-linux-gnueabihf/libc/usr install



  3. Install Boost (1.54 or higher).

    wget -O boost_1_59_0.tar.bz2 http://sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.bz2/download
    tar xvjf boost_1_59_0.tar.bz2
    cd boost_1_59_0
    export PATH=$PATH:/opt/gcc-linaro-arm-linux-gnueabihf/bin
    ./bootstrap.sh

    Edit the project-config.jam file. Add 'using gcc : artik : arm-linux-gnueabihf-gcc ;' after 'using gcc ;'

    ./bjam install toolset=gcc-artik --prefix=/opt/gcc-linaro-arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr
  4. Install Avro (1.7.5-1.7.7).

    The path for the Avro patch is provided below:

    1. avro-1.7.7_build.patch

    2. avro-1.7.5_build.patch

    wget https://archive.apache.org/dist/avro/avro-1.7.5/cpp/avro-cpp-1.7.5.tar.gz
    cd avro-cpp-1.7.5
    patch < avro-cpp-1.7.5_build.patch
    mkdir build && cd build
    cmake -DCMAKE_INSTALL_PREFIX:PATH=/opt/gcc-linaro-arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr -DCMAKE_TOOLCHAIN_FILE=../artik.cmake ..
    make install
  5. Install Botan (1.10).

    wget http://botan.randombit.net/releases/Botan-1.10.10.tgz
    tar -xvzf Botan-1.10.10.tgz
    cd Botan-1.10.10
    export PATH=$PATH:/opt/gcc-linaro-arm-linux-gnueabihf/bin
    python configure.py --cpu=arm --cc-bin=arm-linux-gnueabihf-gcc --prefix=/opt/gcc-linaro-arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr
    make install
    mv /opt/gcc-linaro-arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr/include/botan-1.10/botan/ /opt/gcc-linaro-arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr/include
    rm -r /opt/gcc-linaro-arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr/include/botan-1.10

Creating applications based on C++ SDK

To create an application based on the C++ SDK, at first you need to build static/shared Kaa libraries from the generated SDK and then link your application to those libraries. You can either do it manually or create some build script to automate the building process (see the Example section).

Example

To quickly start with the Kaa IoT platform, you can download one of the Kaa demo applications from the Kaa Sandbox and run it on the Artik board. In this example, we use the Notification demo from the Kaa Sandbox.

After downloading the application to your host machine, you will need to build it and then copy libraries and the application to the device. For copying files to the device you can use, for example, the scp utility. 

The instructions on how to build and run the application are the following:

  1. Find the IP address assigned to the Artik WiFi interface.

    Artik
    ifconfig wlan0|grep 'inet'|cut -d: -f2|awk '{print $2}'
  2. Build the Notification demo.

    Host machine
    tar -zxf notification_demo.tar.gz
    cd CppNotificationDemo/libs/kaa
    tar -zxf kaa-client-sdk-p1-c1-n2-l1.tar.gz
    mkdir build && cd build
    cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/artik.cmake ..
    make
     
    cd ../../..
    mkdir build && cd build
    cp ../libs/kaa/build/libkaacpp* .
    cmake -DAPP_NAME=demo_client -DCMAKE_TOOLCHAIN_FILE=../libs/kaa/toolchains/artik.cmake ..
    make
  3. Copy the demo application and the library to the Artik device from your host machine.

    For the first time, copy the Boost, Avro and Botan libraries

    Host machine
    scp /opt/gcc-linaro-arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr/lib/libboost_*.so* [email protected]<put ip address here>:/usr/lib
    scp /opt/gcc-linaro-arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr/lib/libbotan*.so* [email protected]<put ip address here>:/usr/lib
    scp /opt/gcc-linaro-arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr/lib/libavrocpp*.so* [email protected]<put ip address here>:/usr/lib

    Then copy the application and the Kaa library

    Host machine
    scp demo_client libkaacpp.so [email protected]<put ip address here>:

 


Copyright © 2014-2015, CyberVision, Inc.

  • No labels