[ARDUINO] [BLE / IP] Fixed broken BLE build and IP crash
authorAbhishek Sharma <ce.abhishek@samsung.com>
Thu, 4 Jun 2015 14:19:41 +0000 (19:49 +0530)
committerErich Keane <erich.keane@intel.com>
Mon, 8 Jun 2015 15:54:58 +0000 (15:54 +0000)
> Fixed broken Arduino BLE build
> Fixed IP crash

Change-Id: I1d367fd9b27a9a39b10d4fba267ca070daacd6e0
Signed-off-by: Abhishek Sharma <ce.abhishek@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/1192
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Erich Keane <erich.keane@intel.com>
arduino.scons
build_common/SConscript
build_common/arduino/SConscript
resource/csdk/connectivity/samples/arduino/casample.cpp

index 2f40e74..ae3b53f 100644 (file)
@@ -45,5 +45,7 @@ if 'RBL_NRF8001' in env.get('SHIELD'):
 env.ImportLib('Time/Time')
 # we have variety of macros for arduino!!
 env.AppendUnique(CPPDEFINES = ['WITH_ARDUINO', '__ARDUINO__'])
+# Set device name to __OIC_DEVICE_NAME__
+env.AppendUnique(CPPDEFINES = ['-D__OIC_DEVICE_NAME__=' + "\'\"" + env.get('DEVICE_NAME') + "\"\'"])
 if env.get('LOGGING'):
        env.AppendUnique(CPPDEFINES = ['TB_LOG'])
index c26e92d..a433095 100755 (executable)
@@ -54,6 +54,9 @@ target_arch = ARGUMENTS.get('TARGET_ARCH', default_arch) # target arch
 # set to 'no', 'false' or 0 for only compilation
 require_upload = ARGUMENTS.get('UPLOAD', False)
 
+# Get the device name. This name can be used as network display name wherever possible
+device_name = ARGUMENTS.get('DEVICE_NAME', "OIC-DEVICE")
+
 if ARGUMENTS.get('TEST'):
        logging_default = False
 else:
@@ -85,6 +88,8 @@ help_vars.Add(EnumVariable('TEST', 'Run unit tests', '0', allowed_values=('0', '
 help_vars.Add(BoolVariable('LOGGING', 'Enable stack logging', logging_default))
 help_vars.Add(BoolVariable('UPLOAD', 'Upload binary ? (For Arduino)', require_upload))
 help_vars.Add(EnumVariable('BUILD_SAMPLE', 'Build with sample', 'ON', allowed_values=('ON', 'OFF')))
+help_vars.AddVariables(('DEVICE_NAME', 'Network display name for device (For Arduino)', device_name, None, None),)
+
 ######################################################################
 # Platform(build target) specific options: SDK/NDK & toolchain
 ######################################################################
index 48f21e1..a086177 100644 (file)
@@ -70,8 +70,15 @@ def __search_files(path, pattern, ondisk=True, source=True, strings=False, recur
 
        matches = []
        for root, dirnames, filenames in os.walk(path):
-               matches.extend(Glob(root + '/' + pattern, ondisk, source, strings))
-
+               # This is a helper function to build Arduino libraries. Scripts are using this function
+               # to add all the files in a folder as compilation targets rather than specifying each
+               # file to compile from a Arduino library folder.
+
+               # Since the function is recursive, it adds even "/library/<library-name>/examples" to the
+               # compilation list. This is an extra overhead as stack is never going to use ".o" generated
+               # for these examples.
+               if 'examples' not in root:
+                       matches.extend(Glob(root + '/' + pattern, ondisk, source, strings))
        return matches
 
 # To make sure the src is built in 'BUILD_DIR' (by default it will be built at
index 4f692d3..8f28fc2 100644 (file)
@@ -373,7 +373,6 @@ void SendRequest()
         CADestroyRemoteEndpoint(endpoint);
     }
 
-    CADestroyToken(token);
     Serial.println("============");
 }