aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarish Kumara M <h.marappa@samsung.com>2018-08-14 19:40:09 +0530
committerUze Choi <uzchoi@samsung.com>2018-08-14 15:50:30 +0000
commit10d58be82f4aaa72cc92771b1ec6f92d231326a9 (patch)
treec6a98120cb27f9273140c9109846d3a6ce6cd192
parent15fc55dc7bcd3afe83ac5d3f8fc867023444ec33 (diff)
TizenRT:Updated the latest commit changesRel_BL_1.00
fixed the review comments and applying the mbedtls patches added stubbed function for st_wifi_free_scan_list in TizenRT Added the latest commit changes on TizenRT and auto build script for tizenrt. Change-Id: I8fd4c901311c0bbd76854185aa70f558fb069bf3 Signed-off-by: pilli manikanta <p.manikanta@partner.samsung.com> Signed-off-by: Harish Kumara M <h.marappa@samsung.com> Reviewed-on: https://gerrit.iotivity.org/gerrit/26729 Reviewed-by: Abhishek Pandey <abhi.siso@samsung.com> Tested-by: IoTivity Jenkins <jenkins-daemon@iotivity.org> Reviewed-by: Uze Choi <uzchoi@samsung.com>
-rw-r--r--apps/st_app/tizenrt/Makefile32
-rw-r--r--apps/st_app/tizenrt/st_ref_app_tizenrt.c8
-rw-r--r--port/tizenrt/scripts/Makefile159
-rw-r--r--port/tizenrt/scripts/README.txt25
-rw-r--r--port/tizenrt/scripts/prep_build.sh48
-rw-r--r--service/st-app-fw/src/port/tizenrt/st_port.c29
6 files changed, 221 insertions, 80 deletions
diff --git a/apps/st_app/tizenrt/Makefile b/apps/st_app/tizenrt/Makefile
index 85c9ca7..4196716 100644
--- a/apps/st_app/tizenrt/Makefile
+++ b/apps/st_app/tizenrt/Makefile
@@ -52,6 +52,36 @@ CSRCS =
MAINSRC = tizenrt/st_ref_app_tizenrt.c tizenrt/port_tinyara.c
+ifeq ($(CONFIG_IOTLITE_ST_APP_FW),y)
+ ST_DEVICE_DEF= ./json/st_device_def
+ ST_JSON_FILE := $(wildcard ./json/*.json)
+ ST_DEVICE_DEF_HEADER=./tizenrt/st_device_def.h
+ifeq ($(CONFIG_IOTLITE_ARCH), x86_64)
+ JSON_TO_CBOR=$(IOTCON_BASE_DIR)/tools/json/json2cbor
+else
+ JSON_TO_CBOR=$(IOTCON_BASE_DIR)/tools/json/json2cbor_32
+endif
+ HEADER_DIR +=-I./tizenrt/
+endif
+
+prep_st_app_fw_json_present:
+ifneq ("$(wildcard $(ST_DEVICE_DEF_HEADER))","")
+else
+ifneq ("$(wildcard $(ST_JSON_FILE))", "")
+else
+ $(error please use proper json file in apps/st_app/json)
+endif
+ifneq ($(words $(ST_JSON_FILE)), 1)
+ $(error please use 1 json file in apps/st_app/json)
+endif
+endif
+
+prep_st_app_fw_create_device_def:
+ $(info make new st_device_def file using $(ST_JSON_FILE))
+ $(shell $(JSON_TO_CBOR) $(ST_JSON_FILE) > $(ST_DEVICE_DEF))
+ $(shell xxd -i $(ST_DEVICE_DEF) > $(ST_DEVICE_DEF_HEADER))
+ $(shell sed -i 's/_.*st_device_def/st_device_def/g' $(ST_DEVICE_DEF_HEADER))
+
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
MAINOBJ = $(MAINSRC:.c=$(OBJEXT))
@@ -94,7 +124,7 @@ all: .built
$(AOBJS): %$(OBJEXT): %.S
$(call ASSEMBLE, $<, $@)
-$(COBJS) $(MAINOBJ): %$(OBJEXT): %.c
+$(COBJS) $(MAINOBJ): %$(OBJEXT): %.c prep_st_app_fw_json_present prep_st_app_fw_create_device_def
$(call COMPILE, $<, $@)
.built: $(OBJS)
diff --git a/apps/st_app/tizenrt/st_ref_app_tizenrt.c b/apps/st_app/tizenrt/st_ref_app_tizenrt.c
index 8db46ea..5eb7a49 100644
--- a/apps/st_app/tizenrt/st_ref_app_tizenrt.c
+++ b/apps/st_app/tizenrt/st_ref_app_tizenrt.c
@@ -16,6 +16,7 @@
*
****************************************************************************/
+#include "st_device_def.h"
#include "st_manager.h"
#include "st_resource_manager.h"
@@ -143,6 +144,13 @@ stapp_main(void)
if (st_register_resource_handler(get_resource_handler,
set_resource_handler) != ST_ERROR_NONE) {
printf("[ST_APP] st_register_resource_handler failed.\n");
+ st_manager_deinitialize();
+ return -1;
+ }
+
+ if (!st_set_device_profile(st_device_def, st_device_def_len)) {
+ printf("[ST_APP] st_set_device_profile failed.\n");
+ st_manager_deinitialize();
return -1;
}
diff --git a/port/tizenrt/scripts/Makefile b/port/tizenrt/scripts/Makefile
index f386a28..397fb8a 100644
--- a/port/tizenrt/scripts/Makefile
+++ b/port/tizenrt/scripts/Makefile
@@ -40,10 +40,10 @@ DTLS= aes.c aesni.c arc4.c asn1parse.c asn1write.c base64.c
ssl_cache.c ssl_ciphersuites.c ssl_cli.c ssl_cookie.c \
ssl_srv.c ssl_ticket.c ssl_tls.c rsa_internal.c
-DTLSFLAGS=-I $(MBEDTLS_DIR)/include/ -D__OC_RANDOM
+DTLSFLAGS=-I$(MBEDTLS_DIR)/include/ -D__OC_RANDOM
ifeq ($(CONFIG_IOTLITE_DYNAMIC),y)
- EXTRA_CFLAGS += -DOC_DYNAMIC_ALLOCATION
+ CFLAGS += -DOC_DYNAMIC_ALLOCATION
endif
ifeq ($(CONFIG_IOTLITE_SECURE),y)
@@ -66,9 +66,9 @@ else
CSRCS += $(MBEDTLS_DIR)/library/memory_buffer_alloc.c
OSRCS_C += $(MBEDTLS_DIR)/library/memory_buffer_alloc.o
endif
-# CFLAGS += ${DTLSFLAGS}
+ CFLAGS += ${DTLSFLAGS}
OSRCS_C += $(wildcard $(MBEDTLS_DIR)/library/*.o)
- EXTRA_CFLAGS += ${DTLSFLAGS} -DOC_SECURITY
+ CFLAGS += -DOC_SECURITY
VPATH += $(IOTCONS_ROOT_DIR)/security/:$(MBEDTLS_DIR)/library:
endif
@@ -80,34 +80,35 @@ ifeq ($(CONFIG_IOTLITE_RD),y)
CSRCS += iotivity-constrained/service/resource-directory/client/src/rd_client.c
OSRCS_C += iotivity-constrained/service/resource-directory/client/src/rd_client.o
endif
- EXTRA_CFLAGS += -Iiotivity-constrained/service/cloud-access/include \
- -Iiotivity-constrained/service/resource-directory/client/include
+ CFLAGS += -Iiotivity-constrained/service/cloud-access/include \
+ -Iiotivity-constrained/service/resource-directory/client/include
endif
-CSRCS += iotivity-constrained/deps/tinycbor/src/cborencoder.c \
- iotivity-constrained/deps/tinycbor/src/cborencoder_close_container_checked.c \
- iotivity-constrained/deps/tinycbor/src/cborparser.c \
- $(wildcard iotivity-constrained/util/*.c) \
- $(wildcard iotivity-constrained/messaging/coap/*.c) \
- $(wildcard iotivity-constrained/api/*.c) \
- $(wildcard iotivity-constrained/port/tizenrt/*.c)
-
-OSRCS_C += iotivity-constrained/deps/tinycbor/src/cborencoder.o \
- iotivity-constrained/deps/tinycbor/src/cborencoder_close_container_checked.o \
- iotivity-constrained/deps/tinycbor/src/cborparser.o \
- $(wildcard iotivity-constrained/util/*.o) \
- $(wildcard iotivity-constrained/messaging/coap/*.o) \
- $(wildcard iotivity-constrained/api/*.o) \
- $(wildcard iotivity-constrained/port/tizenrt/*.o)
+CSRCS += iotivity-constrained/deps/tinycbor/src/cborencoder.c \
+ iotivity-constrained/deps/tinycbor/src/cborencoder_close_container_checked.c \
+ iotivity-constrained/deps/tinycbor/src/cborparser.c \
+ $(wildcard iotivity-constrained/util/*.c) \
+ $(wildcard iotivity-constrained/messaging/coap/*.c) \
+ $(wildcard iotivity-constrained/api/*.c) \
+ $(wildcard iotivity-constrained/port/tizenrt/*.c)
+
+OSRCS_C += iotivity-constrained/deps/tinycbor/src/cborencoder.o \
+ iotivity-constrained/deps/tinycbor/src/cborencoder_close_container_checked.o \
+ iotivity-constrained/deps/tinycbor/src/cborparser.o \
+ $(wildcard iotivity-constrained/util/*.o) \
+ $(wildcard iotivity-constrained/messaging/coap/*.o) \
+ $(wildcard iotivity-constrained/api/*.o) \
+ $(wildcard iotivity-constrained/port/tizenrt/*.o)
ifeq ($(CONFIG_IOTLITE_EASYSETUP), y)
-CSRCS += $(wildcard iotivity-constrained/service/easy-setup/enrollee/*.c) \
+CSRCS += $(wildcard iotivity-constrained/service/easy-setup/enrollee/*.c) \
$(wildcard iotivity-constrained/service/easy-setup/enrollee/samsung/sc_easysetup.c)
-OSRCS_C += $(wildcard iotivity-constrained/service/easy-setup/enrollee/*.o) \
+OSRCS_C += $(wildcard iotivity-constrained/service/easy-setup/enrollee/*.o) \
$(wildcard iotivity-constrained/service/easy-setup/enrollee/samsung/sc_easysetup.o)
-EXTRA_CFLAGS += -Iiotivity-constrained/service/easy-setup/enrollee/include \
- -Iiotivity-constrained/service/easy-setup/enrollee \
- -Iiotivity-constrained/service/easy-setup/enrollee/include
+CFLAGS += -Iiotivity-constrained/service/easy-setup/enrollee/include \
+ -Iiotivity-constrained/service/easy-setup/enrollee \
+ -Iiotivity-constrained/service/easy-setup/enrollee/samsung
+
endif
ifeq ($(CONFIG_IOTLITE_ST_APP_FW),y)
@@ -115,24 +116,18 @@ CSRCS += $(wildcard iotivity-constrained/service/st-app-fw/src/*.c) \
$(wildcard iotivity-constrained/service/st-app-fw/src/port/tizenrt/*.c)
OSRCS_C += $(wildcard iotivity-constrained/service/st-app-fw/src/*.o) \
$(wildcard iotivity-constrained/service/st-app-fw/src/port/tizenrt/*.o)
-EXTRA_CFLAGS += -Iiotivity-constrained/service/st-app-fw/include
-ST_DEVICE_DEF= $(IOTCONS_ROOT_DIR)/service/st-app-fw/json/st_device_def
-ST_JSON_FILE := $(wildcard $(IOTCONS_ROOT_DIR)/service/st-app-fw/json/*.json)
-ST_DEVICE_DEF_HEADER=$(IOTCONS_ROOT_DIR)/service/st-app-fw/include/st_device_def.h
-ifeq ($(CONFIG_IOTLITE_ARCH), x86_64)
-JSON_TO_CBOR=$(IOTCONS_ROOT_DIR)/service/st-app-fw/json/json2cbor
-else
-JSON_TO_CBOR=$(IOTCONS_ROOT_DIR)/service/st-app-fw/json/json2cbor_32
-endif
+CFLAGS += -Iiotivity-constrained/service/st-app-fw/include
endif
ifeq ($(CONFIG_IOTLITE_FOTA),y)
CSRCS += $(wildcard iotivity-constrained/service/fota/src/*.c)
OSRCS_C += $(wildcard iotivity-constrained/service/fota/src/*.o)
-CFLAGS=-Iiotivity-constrained/service/fota/include
+EXTRA_CFLAGS=-Iiotivity-constrained/service/fota/include
endif
CFLAGS += -DST_APP_FW
+CFLAGS += -DWIFI_SCAN_IN_SOFT_AP_SUPPORTED
+
ifeq ($(CONFIG_IOTLITE_IPV4),y)
EXTRA_CFLAGS += -DOC_IPV4
@@ -150,14 +145,29 @@ ifeq ($(CONFIG_WIFI_MANAGER),y)
EXTRA_CFLAGS += -DTIZEN_RT_WIFI_MANAGER
endif
+# AUTH_OPTION = 0 - root ca check is disabled for any TLS connection
+# AUTH_OPTION = 1 - preload manufacturer certificate chain to TLS context & and remove it after OTM
+# AUTH_OPTION = 2 - preload manufacturer certificate chain to TLS context
+#
+# default: AUTH_OPTION = 1
+
+ifndef ($(CONFIG_IOTLITE_AUTH_OPTION),n)
+AUTH_OPTION=1
+endif
+
ifeq ($(CONFIG_IOTLITE_SECURE),y)
-ifneq ($(CONFIG_IOTLITE_AUTH_OPTION),n)
+ifeq ($(CONFIG_IOTLITE_AUTH_OPTION),n)
+#enable mbedtls patch to skip cert verification
+CFLAGS += -DOC_SKIP_CERT
+else
+#preload hardcoded certchain to TLS context
CFLAGS += -DOC_LOAD_CA
-ifeq ($(CONFIG_IOTLITE_AUTH_OPTION),y)
+
+ifeq ($(AUTH_OPTION),1)
+#remove all certchains from TLS context after OTM
CFLAGS += -DOC_UNLOAD_CERT
endif
-else
-CFLAGS += -DOC_SKIP_CERT
+
endif
endif
@@ -178,7 +188,8 @@ CFLAGS += -Itinycbor/src/ \
-Iiotivity-constrained/include \
-Iiotivity-constrained/security \
-Iiotivity-constrained/port \
- -Iiotivity-constrained/port/tizenrt
+ -Iiotivity-constrained/port/tizenrt \
+ -Iiotivity-constrained/util
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
@@ -202,50 +213,14 @@ DEPPATH = --dep-path .
VPATH = $(MBEDTLS_DIR)/library:
-ifeq ($(CONFIG_IOTLITE_SECURE),y)
-MBEDTLS_PATCHES ?= $(sort $(wildcard $(IOTCONS_ROOT_DIR)/patches/*.patch))
-${MBEDTLS_DIR}/.git:
- git submodule update --init ${@D}
-
-$(MBEDTLS_PATCH_FILE): ${MBEDTLS_DIR}/.git ${MBEDTLS_PATCHES}
- if [ -d ${MBEDTLS_DIR} ]; then \
- cd ${MBEDTLS_DIR} && \
- git clean -fdx . && \
- git reset --hard && \
- git fetch && \
- git reset --hard ${DTLS_TAG} && \
- cd -; \
- fi && \
- git submodule update --init && \
- cd ${MBEDTLS_DIR} && \
- for patch in $(MBEDTLS_PATCHES); do patch -r - -s -N -p1 < $${patch} ; done && \
- echo "Patches applied in $^" > ${@F}
-endif
-
-prep_st_app_fw:
-ifneq ("$(wildcard $(ST_DEVICE_DEF_HEADER))","")
-else
-ifneq ("$(wildcard $(ST_JSON_FILE))", "")
-else
- $(error please use proper json file in service/st-app-fw/json)
-endif
-ifneq ($(words $(ST_JSON_FILE)), 1)
- $(error please use 1 json file in service/st-app-fw/json)
-else
- $(info make new st_device_def file using $(ST_JSON_FILE))
- $(shell $(JSON_TO_CBOR) $(ST_JSON_FILE) > $(ST_DEVICE_DEF))
- $(shell xxd -i $(ST_DEVICE_DEF) > $(ST_DEVICE_DEF_HEADER))
- $(shell sed -i 's/_.*st_device_def/st_device_def/g' $(ST_DEVICE_DEF_HEADER))
-endif
-endif
-all: .built
+all: apply_mbedtls_patches .built
.PHONY: depend clean distclean
$(AOBJS): %$(OBJEXT): %.S
$(call ASSEMBLE, $<, $@)
-$(COBJS): %$(OBJEXT): %.c prep_st_app_fw
+$(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
.built: $(OBJS)
@@ -267,4 +242,30 @@ distclean: clean
$(call DELFILE, Make.dep)
$(call DELFILE, .depend)
+ifeq ($(CONFIG_IOTLITE_SECURE),y)
+MBEDTLS_PATCHES ?= $(sort $(wildcard $(IOTCONS_ROOT_DIR)/patches/*.patch))
+ifeq ($(CONFIG_IOTLITE_AUTH_OPTION),n)
+MBEDTLS_PATCHES += $(sort $(wildcard $(IOTCONS_ROOT_DIR)/patches/*.off))
+${MBEDTLS_DIR}/.git:
+ git submodule update --init ${@D}
+endif
+
+$(MBEDTLS_PATCH_FILE): ${MBEDTLS_DIR}/.git ${MBEDTLS_PATCHES}
+ if [ -d ${MBEDTLS_DIR} ]; then \
+ cd ${MBEDTLS_DIR} && \
+ git clean -fdx . && \
+ git reset --hard && \
+ git fetch && \
+ git reset --hard ${DTLS_TAG} && \
+ cd ../..; \
+ fi && \
+ git submodule update --init && \
+ cd ${MBEDTLS_DIR} && \
+ for patch in $(MBEDTLS_PATCHES); do patch -r - -s -N -p1 < $${patch} ; done && \
+ echo "Patches applied in $^" > $(MBEDTLS_PATCH_FILE)
+endif
+
+apply_mbedtls_patches: $(MBEDTLS_PATCH_FILE)
+ echo "Patches applied in mbedtls direcotry"
+
-include Make.dep
diff --git a/port/tizenrt/scripts/README.txt b/port/tizenrt/scripts/README.txt
new file mode 100644
index 0000000..0b676f4
--- /dev/null
+++ b/port/tizenrt/scripts/README.txt
@@ -0,0 +1,25 @@
+############# TizenRT building steps ###################
+
+1. Clone TizneRT from below mentioned link:
+ https://github.com/Samsung/TizenRT/releases (download: 2.0_GBM_M1 stable release)
+
+2. Create new directory with the name "iotivity-constrained" inside the external folder of TizneRT.
+ $ cd external
+ $ mkdir iotivity-constrained
+
+3. Enter newly created "iotivity-constrained" directory.
+ $ cd iotivity-constrained
+
+4. Clone iotivity-constrained code from open source
+ $ git clone --recursive https://gerrit.iotivity.org/gerrit/iotivity-constrained
+
+5. Checkout to samsung branch.
+ $ git branch -a
+ $ git checkout remotes/origin/samsung
+
+6. Run the Shell script from below mentioned directory path
+ $ cd iotivity-constrained/port/tizenrt/scripts
+ $ sh prep_build.sh
+
+7. Enter the "os" directory of TizneRT and run the make.
+ $ make
diff --git a/port/tizenrt/scripts/prep_build.sh b/port/tizenrt/scripts/prep_build.sh
new file mode 100644
index 0000000..33b3fd3
--- /dev/null
+++ b/port/tizenrt/scripts/prep_build.sh
@@ -0,0 +1,48 @@
+#!/bin/bash
+#IoTivity Constrained build procedure on TizenRT
+board=artik053
+config=iotlite
+
+scripts_dir="$(pwd)"
+
+echo $scripts_dir
+
+os_dir=../../../../../../os/
+
+echo $os_dir
+
+constrained_dir=../../../
+
+echo $constrained_dir
+
+external=$os_dir../external
+
+echo $external
+
+apps=$os_dir../apps
+
+echo $apps
+
+echo "$os_dir"
+
+cp -r ../iotlite_apps/ $apps
+
+cp -r $constrained_dir/apps/st_app $apps/iotlite_apps/
+
+cp -r $constrained_dir/apps/st_app/tizenrt/Make* $apps/iotlite_apps/st_app/
+
+cp ./Makefile ../$constrained_dir
+
+cp ./Make.defs ../$constrained_dir
+
+cp -r $constrained_dir/apps/tizenrt/configs/artik053/iotlite/ $os_dir/../build/configs/artik053/
+
+cd $os_dir/tools
+
+echo "================================== \n Only for artik053 board \n"
+
+echo $board
+
+echo $config
+
+./configure.sh $board/$config;cd ..
diff --git a/service/st-app-fw/src/port/tizenrt/st_port.c b/service/st-app-fw/src/port/tizenrt/st_port.c
index a3e3938..1bc83e2 100644
--- a/service/st-app-fw/src/port/tizenrt/st_port.c
+++ b/service/st-app-fw/src/port/tizenrt/st_port.c
@@ -369,11 +369,32 @@ st_connect_wifi(const char *ssid, const char *pwd)
}
void
+st_wifi_free_scan_list(st_wifi_ap_t *ap_list)
+{
+ while (ap_list) {
+ st_wifi_ap_t *del = ap_list;
+ ap_list = ap_list->next;
+
+ free(del->ssid);
+ free(del->mac_addr);
+ free(del->channel);
+ free(del->max_bitrate);
+ free(del->rssi);
+ free(del->enc_type);
+ free(del->sec_type);
+ free(del);
+ }
+}
+
+void
st_wifi_scan(st_wifi_ap_t **ap_list)
{
// oc_abort(__func__);
}
+#ifndef WIFI_SCAN_IN_SOFT_AP_SUPPORTED
+static st_wifi_ap_t *g_ap_scan_list = NULL;
+
void
st_wifi_set_cache(st_wifi_ap_t *scanlist)
{
@@ -386,6 +407,14 @@ st_wifi_get_cache(void)
oc_abort(__func__);
}
+void
+st_wifi_clear_cache(void)
+{
+ st_wifi_free_scan_list(g_ap_scan_list);
+ g_ap_scan_list = NULL;
+}
+#endif
+
static void *
soft_ap_process_routine(void *data)
{