.ia-secondary-container
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).
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.
The following third-party components must be installed before building the C++ SDK.
Install the third-party components as follows:
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
Install zlib & libbz2 (for Avro version higher than 1.7.5).
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
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
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
Install Avro (1.7.5-1.7.7).
The path for the Avro patch is provided below:
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
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
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).
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:
Find the IP address assigned to the Artik WiFi interface.
ifconfig wlan0|grep 'inet'|cut -d: -f2|awk '{print $2}'
Build the Notification demo.
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
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
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
scp demo_client libkaacpp.so [email protected]<put ip address here>: