To create the dierectoy and install the toolchain you must be “root”.
#For PowerPC: wget https://share.netmodule.com/router/public/toolchain/netbox-ppc/toolchain-ppc-4.8-linaro-x86_64.tar.bz2 mkdir /opt/toolchain tar -xvf toolchain-ppc-4.8-linaro-x86_64.tar.bz2 -C /opt/toolchain export PATH=$PATH:/opt/toolchain/bin
Donwload curl: →https://curl.haxx.se/download.html
tar –xvf curl-7.52.1.tar.gz cd curl-7.52.1 export PATH=$PATH:/opt/toolchain/bin export STAGING_DIR=/opt/toolchain export CPPFLAGS="-I/opt/toolchain/include" export AR=powerpc-openwrt-linux-ar export AS=powerpc-openwrt-linux-as export LD=powerpc-openwrt-linux-ld export RANLIB=powerpc-openwrt-linux-ranlib export CC=powerpc-openwrt-linux-gcc export NM=powerpc-openwrt-linux-nm ./configure --target=powerpc-openwrt-linux --host=powerpc-openwrt-linux --disable-nls --disable-debug --disable-ares --enable-shared --enable-static --disable-manual --without-ca-bundle --without-nss --without-libmetalink --without-librtmp --enable-ipv6 --without-axtls --without-cyassl make sudo make install
Cumulocity C++ Library is an asynchronous, event-driven networking library to ease your development for connecting to the Cumulocity cloud. The library uses Cumulocity's self invented SmartREST protocol for M2M communication which targets any device that are capable of running embedded Linux.
Link to download the latest version
wget https://bitbucket.org/m2m/cumulocity-sdk-c/get/d627781f3afa.zip unzip d627781f3afa.zip cd m2m-cumulocity-sdk-c-d627781f3afa
Create an init.mk file, and define specific macros CPPFLAGS, CXXFLAGS and LDFLAGS, LDLIBS and CXX for cross-compiling.
CXX:=/opt/toolchain/bin/powerpc-openwrt-linux-g++ CPPFLAGS:= -I/usr/local/include CXXFLAGS:=-Wall -pedantic -Wextra LDFLAGS:= -L/usr/local/lib LDLIBS:=-lcurl –lrt
If you have defined init.mk now you have to create the makefile.
cp Makefile.template Makefile
Download the NetModule Cumulocity agent:netmodulecumulocityagent.tar.gz
tar -xvzf netmodulecumulocityagent.tar.gz cd netmoduleCumulocityAgent
Move the content of src and include folders to the src and include folders of the SDK.
cp src/* m2m-cumulocity-sdk-c-d627781f3afa/src/ cp include/* m2m-cumulocity-sdk-c-d627781f3afa/include/
Edit the configfile (c8yAgent.conf) and add your cumulocity domain and your credentials path. Move the file to the router.
scp c8yAgent.conf <user>@<host>:/etc/c8yAgent.conf
We have to do this, because the toolchain don't support the function to_string(). include myString.h in the follow files:
We need also to put this line #define CLOCK_MONOTONIC_COARSE 6 in the follow files:
And this line #define CLOCK_REALTIME_COARSE 5 in the follow file:
Now we have to add two header files:
Now we can build the cumulocity SDK for NetModule Agent within the SDK directory.
export STAGING_DIR=/opt/toolchain make #If you want, you can delete all and rebuild again: make clean make
Now go to the src folder to build NetModule Agent.
make
If all this steps was successful, then we can move the files to the router. We need the src/main and the srtemplate.txt. With scp we can move it to the router.
scp main <user>@<host>:<directory>/main
No we can make a SSH connection to the router and start the agent.
./main
If the agent is runing then you can add your NetModule router to Cumulocity. For this you need the serial no of the Router. First go to the Device management and then go to Registration. Put the serial no of the router in the text field Device ID and klick Register device. Now you have to accept the router. If you go to All devices you can see the new device.