User Tools

Site Tools


build_iotivity_project_for_arduino

Arduino build instructions

This section explains the steps to build IoTivity project for Arduino as MCU supported hardware.

This section assumes that you have completed the steps in "How to use IoTivity Gerrit" .

Please note that IoTivity project currently only supports following Arduino configurations:

Arduino ATMega 2560 with Ethernet and RedBearLab BLE Shield's

<target_board_value>=mega
<target_arch_value>=avr
<target_transport_value>=BLE | IP    (Select any 1)
<target_shield_value>=ETH            (Only required when  <target_transport_value>=IP)

Arduino Due with Ethernet and RedBearLab BLE Shield's

<target_board_value>=arduino_due_x
<target_arch_value>=arm
<target_transport_value>=BLE | IP    (Select any 1)
<target_shield_value>=ETH            (Only required when  <target_transport_value>=IP)	

Prerequisites for building IoTivity for Arduino

  1. Ubuntu 12.04 or 14.04.
  2. SCons version 2.4.0 or higher. For installation instructions, please refer to: http://www.scons.org/doc/production/HTML/scons-user.html#chap-build-install
    Note: On Windows, install Python 2.x before installing scons.
  3. Arduino device located at port “/dev/ttyACM0”
  4. dos2unix package (e.g. sudo apt-get install dos2unix OR sudo yum install dos2unix)
  5. A working Internet connection. During the process of the SCons build, the build script might download some or all of the following software from these respective sites: (If you use a proxy, be sure to set http_proxy & https_proxy environment variables.)

Build Instructions:

No pre-configuration necessary.

1. Execute the following command at the root of the repository:

scons resource/csdk/stack/samples/arduino/SimpleClientServer/ \
 TARGET_OS=arduino TARGET_ARCH=<target_arch_value> BOARD=<target_board_value> \
 TARGET_TRANSPORT=<target_transport_value> SHIELD=<target_shield_value>

Upload Instructions:

(If the build instructions above were not already ran, then it will automatically run prior to uploading now.)

Note: This upload operation will automatically upload the sample application located at {IOTIVITY_REPO}/resource/csdk/stack/samples/arduino/SimpleClientServer/ocserver/ocserver.cpp to the Arduino device.

1. Execute the following command at the root of the repository:

scons resource/csdk/stack/samples/arduino/SimpleClientServer/ TARGET_OS=arduino \
  TARGET_ARCH=<target_arch_value> BOARD=<target_board_value> \
  TARGET_TRANSPORT=<target_transport_value> SHIELD=<target_shield_value> UPLOAD=true

Note: To see other possible build commands, simply specify “-h” at the end of the scons command. For example:

scons TARGET_OS=arduino TARGET_ARCH=<target_arch_value> BOARD=<target_board_value> -h

Pre-Configurations:

  1. Install package “dos2unix”. (eg. “sudo apt-get install dos2unix”)
  2. Download the appropriate Arduino-1.5.8 variation for your platform. Unzip to location of your choice <ARDUINO_HOME>.
  3. Download the Arduino Time Library and unzip to location <ARDUINO_HOME>/libraries/Time. (For Clarification: Because of nestled/duplicate named directories, you will end up having “DateStrings.cpp” located at “<ARDUINO_HOME>/libraries/Time/Time/DateStrings.cpp”)
  4. Apply dos2unix to file <ARDUINO_HOME>/libraries/Time/Time/DateStrings.cpp. (You can get dos2unix application by issuing “sudo apt-get install dos2unix”.)
  5. Apply patch located at {IOTIVITY_REPO}/resource/csdk/connectivity/lib/arduino/arduino_libraries.patch to location <ARDUINO_HOME>.

If you do not wish to use BLE, then you are finished with pre-configuration and you may skip to “Build Instructions” below.

  1. Download the Red Bear Library and unzip to location <ARDUINO_HOME>/libraries/RBL_nRF8001.
  2. Apply dos2unix to directory “<ARDUINO_HOME>/libraries/RBL_nRF8001/*”
  3. Download Nordic BLE SDK Library and unzip to location <ARDUINO_HOME>/libraries/BLE.
  4. Apply dos2unix to directory “<ARDUINO_HOME>/libraries/BLE/*”

NOTE: BLE is currently only supported for the ATMega target. BLE Support for the Arduino Due is currently unsupported.

Build Instructions:

1. Execute the following command at the root of the repository:

scons resource/csdk/stack/samples/arduino/SimpleClientServer/ \
  TARGET_OS=arduino TARGET_ARCH=<target_arch_value> BOARD=<target_board_value> \
  TARGET_TRANSPORT=<target_transport_value> SHIELD=<target_shield_value>

Upload Instructions:

(If the build command above was not already ran, then it will automatically run prior to uploading now.)

Note: This upload operation will automatically upload the sample application located in “out/ardiuno” directory to the Arduino device.

Source code is located at :

iotivity/resource/csdk/stack/samples/arduino/SimpleClientServer/ocserver/ocserver.cpp 

1. Execute the following command at the root of the repository:

scons resource/csdk/stack/samples/arduino/SimpleClientServer/ \
  TARGET_OS=arduino TARGET_ARCH=<target_arch_value> BOARD=<target_board_value> \
  TARGET_TRANSPORT=<target_transport_value> SHIELD=<target_shield_value> UPLOAD=true

Note: To see other possible build commands, simply specify “-h” at the end of the scons command.

For example:

 scons TARGET_OS=arduino TARGET_ARCH=<target_arch_value> BOARD=<target_board_value> -h

RESOURCES

build_iotivity_project_for_arduino.txt · Last modified: 2017/01/11 14:37 by Phil Coval