Commit 10d58be8 authored by Harish Kumara M's avatar Harish Kumara M Committed by Uze Choi

TizenRT:Updated the latest commit changes

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: default avatarpilli manikanta <p.manikanta@partner.samsung.com>
Signed-off-by: default avatarHarish Kumara M <h.marappa@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/26729Reviewed-by: default avatarAbhishek Pandey <abhi.siso@samsung.com>
Tested-by: default avatarIoTivity Jenkins <jenkins-daemon@iotivity.org>
Reviewed-by: default avatarUze Choi <uzchoi@samsung.com>
parent 15fc55dc
......@@ -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)
......
......@@ -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;
}
......
......@@ -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
############# 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
#!/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 ..
......@@ -368,12 +368,33 @@ st_connect_wifi(const char *ssid, const char *pwd)
return 0;
}
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)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment