Porting iotivity constrained to arduino
The port target the arduino AVR(Mega2560)and ARM architectures, mostly arduino SAMD(arduino MKRZERO, though andy SAMD board should work) as well as the arduino Due. Though most feature should be supported on SAMD boards, use the arduino Due for more stable deployment of secuirty features. The ipadapter for network requirement is based around the Wiznet w5500 shield, dependant arduino C++ libraries were adapted by providing C wrappers. an SD card is used to provide pesistant storage for security build.this is made available via the C adapter libarduino-sdfat
Preparing Arduino Cores and Tools
I updated socket.cpp based on the mainline iotivity_1_2(arduino adapter) comment regarding the fix required on the socket.cpp code for the udp receive method the patch is arduino_socket.patch. apply this patch to your socket.cpp file.
The iotivity constrained logging system is not directly compatible with arduino at it is. More, it needs to handle different architecture. a library is provided for this as libarduino-serial. Still one need to patch the oc_log.h to declare the the different logging methods.
The arduino Time library target C++ code, though adding attribute like extern C or _cplusplus, it uses method overloading that is not acceptable from C perspective. i provide a basic tweak to make it usable. one can write a C++ class around it a provide a cleaner C wrapper or just make it plain C.
Build tools
Arduino Makefile(https://github.com/sudar/Arduino-Makefile) Used to compile and upload the hex file to the arduino board. this is will be downloaded and patched, accordingly to adapt for the iotivity constained stack compilation.
Arduino sdk (https://github.com/arduino/ArduinoCore-avr.git) , one can just provide a path to the local arduino IDE, maybe sparse check the corresponding development file from arduino github Note: this must be install manually.
Arduino libraries
-Time library (https://github.com/PaulStoffregen/Time) (oc_clock.c method)
Ethernet2 library(https://github.com/adafruit/Ethernet2) (ipadapter.c methods)
pseudo random number generator(https://github.com/leomil72/pRNG) (oc_random.c method) Note: For the ARM ARCH, the Due , we make use on the internal random module(TRNG), although for the SAMD, one can provide n efficient PRNG for those, at the moment we making use of the utility from the SAMD core stdlib.
Arduino FAT16/FAT32 Library (https://github.com/greiman/SdFat.git) (oc_storage.c method)
Note: Arduino sdk depends on the building platform thus one will need to define the path to arduino-home(arduino core, libraries… path) in the setup.mk manually. For ARM board(SAM/SAMD), intall toolchain and cores via the Arduino IDE(see picture): arm_tools_cores.PNG
COMMENTS