User Tools

Site Tools


running_sample_codes_in_iotivity_0.9_sdk_on_edison

Running sample codes in Iotivity 0.9 SDK on Edison

Introduction

This is a step-by-step guide to run some samples codes in Iotivity 0.9 on Intel Edison board. This is for developers especially for novices who want to write & test codes for Edison hardware. Edison Yocto image and SDK are built using Ubuntu* LTS 12.04.

Environment

Ubuntu LTS 12.04 64 bit, Intel Edison Arduino Board. Iotivity 0.9 SDK

Setup Edison Board

- Install required packages

    sudo apt-get install build-essential git diffstat gawk chrpath texinfo libtool gcc-multilib
    sudo apt-get install libboost-dev libboost-program-options-dev libexpat1-dev libqt4-core libqt4-gui
    sudo apt-get install dfu-util screen

If you are working on Fedora 20

    sudo yum install gawk make wget tar bzip2 gzip python unzip perl patch diffutils diffstat git cpp gcc gcc-c++ glibc-devel texinfo chrpath ccache perl-Data-Dumper perl-Text-ParseWords perl-Thread-Queue SDL-devel xterm libattr-devel libtool
    sudo yum install screen dfu-util
    sudo yum install boost boost-devel expat-devel openssl-devel 

- Extract downloaded file.

    tar xvf edison-src.tgz

The URL for the Edison SW can be found in the Reference section below

- Build Yocto image for Edison

1) Initialize Yocto build environment
    cd edison-src
    ./device-software/setup.sh --bb_number_thread=X --parallel_make=X 

If you run into random build failures, adjust the number of threads to limit the amount of parallelism used when building.
For example: –bb_number_thread=2 –parallel_make=2 is a safe option for a quad-core machine with 4GB of RAM.

    source poky/oe-init-build-env
    bitbake edison-image

It will take a few hours. If you can’t build all packages successfully, you need to rerun this until it says success.

2) Add ''meta-oic'' to build-machine
    cd edison-src/device-software
    git clone http://git.yoctoproject.org/git/meta-oic
    cd meta-oic
    git checkout
3) Add ''meta-oic'' layer to the build with editing ''bblayer.conf''
    cd ~/edison-src/build/conf

Add the full path of meta-oic in section [BBLAYERS ?= “ \] like below image.

4) Add iotivity package to the build with editing local.conf

Add one line IMAGE_INSTALL_append = ” iotivity-dev“ like below image. Make sure to keep a space between the opening quote and “iotivity-dev” else you will run into an error with bitbake complaining there is no provider of clloaderiotivity

5) Build toolchain
    source poky/oe-init-build-env
    bitbake edison-image -c populate_sdk  

If you see an error that scons is missing, make sure that your version of meta-oic includes this commit: http://git.yoctoproject.org/cgit/cgit.cgi/meta-oic/commit/?id=0c027f163eb57a59021c9b2526d7c271aedad0d5

6) Setup SDK
    ./edison-src/build/tmp/deploy/sdk/poky-edison-eglibc-x86_64-edison-image-core2-32-toolchain-1.6.sh
7) Copy necessary files to toFlash folder
    ./edison-src/device-software/utils/flash/postBuild.sh
8) Flash Yocto image to Edison

Connect Edison and your development system with 2 USB cables and execute below command

    sudo ./edison-src/build/toFlash/flashall.sh
9) Checking the flash process
    sudo screen /dev/ttyUSB0 115200
10) Boot up and Configure Edison

Boot up Edison and configure name, password and wifi

    configure_edison --setup

Build and Execute Iotivity sample codes-OICSensorBoard

- Download Iotivity 0.9 SDK for Linux and build it Getting started Linux part explains well on how to download the SDK and build it.
When you build the SDK code, you need to use either make or scons. Please check if there is a make file or SConstruct in the folder where source codes exist

- Install Cereal library if needed

    git clone https://github.com/USCiLab/cereal.git <src_dir>/extlibs/cereal
    cd <src_dir>/extlibs/cereal
    git reset --hard 7121e91e6ab8c3e6a6516d9d9c3e6804e6f65245
    git apply ../../resource/patches/cereal_gcc46.patch

- Modify SConstruct to point to your iotivity root and libs paths by setting IOTIVITY_ROOT and IOTIVITY_PATH

IOTIVITY_ROOT is the root of oic-resource and IOTIVITY_PATH is the path that contains liboc.so, liboctbstack.so, liboc_logger.so and libcoap.so. Please refer to below image.

- Build edisonserver and edisonclient

    source /opt/poky-edison/1.6.1/environment-setup-core2-32-poky-linux
    unset PYTHONHOME
    scons edisonserver
    scons edisonclient

Test

- copy edisonserver to Edison

    scp edisonserver root@192.168.1.XXX:/home/root

- Execute edisonclient at your development system

    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~~library path
    ./edisonclient

- Execute edisonserver at Edison

    ./edisonserver

The screenshot of running the applications.

Reference

running_sample_codes_in_iotivity_0.9_sdk_on_edison.txt · Last modified: 2016/11/28 15:12 by Phil Coval