Skip to content

Commit

Permalink
Support Tizen RT
Browse files Browse the repository at this point in the history
Signed-off-by: Boojin Kim <boojin.kim@samsung.com>
  • Loading branch information
bboo81 committed Dec 30, 2016
1 parent 9c315d2 commit 3d0ec69
Show file tree
Hide file tree
Showing 11 changed files with 206 additions and 0 deletions.
47 changes: 47 additions & 0 deletions build_all/tizenRT/Make.defs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
-include $(TOPDIR)/.config
-include $(TOPDIR)/Make.defs

AZURE_CLIENT_DIR = $(AZURE_DIR)/iothub_client
AZURE_SERIAL_DIR = $(AZURE_DIR)/serializer
AZURE_UTIL_DIR = $(AZURE_DIR)/c-utility

CSRCS += $(AZURE_DIR)/certs/certs.c
CSRCS += $(AZURE_DIR)/parson/parson.c

CSRCS += $(AZURE_CLIENT_DIR)/src/blob.c $(AZURE_CLIENT_DIR)/src/iothub_client.c \
$(AZURE_CLIENT_DIR)/src/iothub_message.c $(AZURE_CLIENT_DIR)/src/iothubtransport.c \
$(AZURE_CLIENT_DIR)/src/iothub_client_ll.c $(AZURE_CLIENT_DIR)/src/iothubtransporthttp.c \
$(AZURE_CLIENT_DIR)/src/version.c $(AZURE_CLIENT_DIR)/src/iothub_client_ll_uploadtoblob.c

CSRCS += $(AZURE_UTIL_DIR)/src/base64.c $(AZURE_UTIL_DIR)/src/buffer.c \
$(AZURE_UTIL_DIR)/src/connection_string_parser.c $(AZURE_UTIL_DIR)/src/consolelogger.c \
$(AZURE_UTIL_DIR)/src/constbuffer.c $(AZURE_UTIL_DIR)/src/constmap.c \
$(AZURE_UTIL_DIR)/src/crt_abstractions.c $(AZURE_UTIL_DIR)/src/doublylinkedlist.c \
$(AZURE_UTIL_DIR)/src/gballoc.c $(AZURE_UTIL_DIR)/src/gb_stdio.c \
$(AZURE_UTIL_DIR)/src/gb_time.c $(AZURE_UTIL_DIR)/src/hmac.c \
$(AZURE_UTIL_DIR)/src/hmacsha256.c $(AZURE_UTIL_DIR)/src/httpapiex.c \
$(AZURE_UTIL_DIR)/src/httpapiexsas.c $(AZURE_UTIL_DIR)/src/httpheaders.c \
$(AZURE_UTIL_DIR)/src/map.c $(AZURE_UTIL_DIR)/src/optionhandler.c \
$(AZURE_UTIL_DIR)/src/sastoken.c $(AZURE_UTIL_DIR)/src/sha1.c \
$(AZURE_UTIL_DIR)/src/sha224.c $(AZURE_UTIL_DIR)/src/sha384-512.c \
$(AZURE_UTIL_DIR)/src/singlylinkedlist.c $(AZURE_UTIL_DIR)/src/strings.c \
$(AZURE_UTIL_DIR)/src/string_tokenizer.c $(AZURE_UTIL_DIR)/src/urlencode.c \
$(AZURE_UTIL_DIR)/src/usha.c $(AZURE_UTIL_DIR)/src/vector.c $(AZURE_UTIL_DIR)/src/xlogging.c \
$(AZURE_UTIL_DIR)/src/xio.c

CSRCS += $(AZURE_UTIL_DIR)/adapters/agenttime.c $(AZURE_UTIL_DIR)/adapters/condition_pthreads.c \
$(AZURE_UTIL_DIR)/adapters/threadapi_pthreads.c $(AZURE_UTIL_DIR)/adapters/lock_pthreads.c \
$(AZURE_UTIL_DIR)/adapters/platform_tizenrt.c $(AZURE_UTIL_DIR)/adapters/uniqueid_linux.c \
$(AZURE_UTIL_DIR)/adapters/socketio_berkeley.c $(AZURE_UTIL_DIR)/adapters/tlsio_mbedtls.c \
$(AZURE_UTIL_DIR)/adapters/tickcounter_linux.c $(AZURE_UTIL_DIR)/adapters/httpapi_compact.c

CSRCS += $(wildcard $(AZURE_SERIAL_DIR)/src/*.c)

ifeq ($(CONFIG_CLOUD_AZURE_SAMPLES),y)
CSRCS += $(AZURE_CLIENT_DIR)/samples/iothub_client_sample_http/iothub_client_sample_http.c
CSRCS += $(AZURE_SERIAL_DIR)/samples/simplesample_http/simplesample_http.c
endif

CFLAGS += -I$(AZURE_DIR)/c-utility/inc -I$(AZURE_DIR)/serializer/inc \
-I$(AZURE_DIR)/iothub_client/inc -I$(AZURE_DIR)/parson -I$(AZURE_DIR)/certs
CFLAGS += -DWITH_POSIX -DTIZENRT -DMBED_BUILD_TIMESTAMP -DUSE_MBED_TLS -std=c99 -w
39 changes: 39 additions & 0 deletions build_all/tizenRT/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
-include $(TOPDIR)/Make.defs

DEPPATH = --dep-path .
VPATH = .
CSRCS =

AZURE_DIR = ${shell pwd}/../..

include Make.defs

COBJS = $(CSRCS:.c=$(OBJEXT))

OBJS = $(COBJS)

BIN = libazure$(LIBEXT)

all: $(BIN)

$(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)

$(BIN): $(OBJS)
$(call ARCHIVE, $@, $(OBJS))

.depend: Makefile $(SRCS)
$(Q) $(MKDEP) $(DEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
$(Q) touch $@

depend: .depend

clean:
$(call DELFILE, $(BIN))
$(call CLEAN, $(AZURE_DIR))

distclean: clean
$(call DELFILE, Make.dep)
$(call DELFILE, .depend)

-include Make.dep
Binary file added doc/media/tizenRT1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/media/tizenRT2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/media/tizenRT3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/media/tizenRT4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/media/tizenRT5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/media/tizenRT6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/media/tizenRT7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/media/tizenRT8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
120 changes: 120 additions & 0 deletions doc/tizenRT_s5jt200_get_started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
Run a simple C sample on s5tj200 device running Tizen RT
---

# Table of Contents

- [Introduction](#Introduction)
- [Step 1: Prerequisites](#Step-1-Prerequisites)
- [Step 2: Prepare your Device](#Step-2-PrepareDevice)
- [Step 3: Build and Run the Sample](#Step-3-Build)

<a name="Introduction"></a>
# Introduction

**About this document**

This document describes the steps for connecting an [Tizen RT-enabled s5jt200](http://www.samsung.com/semiconductor/minisite/Exynos/w/) device to Azure IoT Hub. This multi-step process includes:
- Configuring Azure IoT Hub
- Registering your IoT device
- Build and deploy Azure IoT SDK on device

<a name="Step-1-Prerequisites"></a>
# Step 1: Prerequisites

You should have the following items ready before beginning the process:

- Prepare [azure-iot-sdk-c](https://github.com/Azure/azure-iot-sdk-c) to MS Azure IoT services
- [Setup your IoT hub](https://github.com/Azure/azure-iot-sdks/blob/master/doc/setup_iothub.md)
- [Provision your device and get its credentials](https://github.com/Azure/azure-iot-sdks/blob/master/doc/manage_iot_hub.md)

<a name="Step-2-PrepareDevice"></a>
# Step 2: Prepare your Device

s5jt200 is a IoT device with Wi-Fi connectivity. s5jt200 can communicate Azure IoThub with Wi-Fi connection.

- Prepare [SIDK_S5JT200](http://meritech.co.kr/eng/products/ap_dp.php) HW platform with s5jt200
- Prepare [Software and development environment](https://git.tizen.org/cgit/rtos/tinyara/)

After unboxing your HW platform, Please do the followings:

- Install the [ARM compile toolchain](https://launchpad.net/gcc-arm-embedded/4.9/4.9-2015-q3-update) and add your environment about cross compiler path likes
```ruby
export CROSSDEV=/toolchain/gcc-arm-none-eabi-4_9-2015q3/bin/arm-none-eabi-
```

- Get source cdoe in your machine.
```ruby
git clone git://git.tizen.org/rtos/tinyara
```

- Config and compile for SIDK_S5JT200.
```ruby
cd tinyara/os/tools
./configure.sh sidk_s5jt200/sidk_tash
cd ..
make
```

- Install OpenOCD and FTDI chip drivers.
When you first connect sidk board using USB , there isn’t correct driver.You need to install FT2232 IC driver following below instruction.
- Copy openocd directory (build\configs\sidk_s5jt200\openocd) to your windows PC.
- Install FTDI chip drivers for your environment.
- If you properly install the driver, then you can see USB Serial Port on windows device manager.

![usbport](media/tizenRT4.png).

<a name="Step-3-Build"></a>
# Step3: Build and Fusing the samples

## Build Tizen RT with azure-iot-sdk-c

- Download the azure-iot-sdk-c.
```ruby
git clone --recursive https://github.com/Azure/azure-iot-sdk-c.git
cd azure-iot-sdk-c
git submodule init
git submodule update
```
- Open iothub_client/samples/iothub_client_sample_http/iothub_client_sample_http.c on azure-iot-sdk-c and replace "[device connection string]" with the device connection string that you obtained in Step 1.

- Configure Tizen RT to support Azure cloud with 'make menuconfig'.
```ruby
cd tinyara/os
make menuconfig
```

- Set your azure-iot-sdk-c path.
- Go to 'Build Configuration' and set your azure-iot-sdk-c path on 'cloud directory'.

![setpath](media/tizenRT1.png)

- Enable azure-iot-sdk-c.
- Go to 'Application Configuration' and select 'cloud'.
- If you want to run Azure samples like iothub_client_sample_http and simplesample_http, select 'Azure cloud samples'.

![enablecloud](media/tizenRT2.png)

- Enable built-in cloud application.
- Go to 'Application Configuration' and 'Examples' and select 'cloud test'.
- If you want to run Azure samples with sensor devices on HW platform, select 'cloud test with sensor'. And then write the device connection string that you obtained in Step 1 on 'azure device connection string'

![enablecloud](media/tizenRT3.png)

- Execute 'make' after configuration. Then you can see libazure.a on os/libraries directory.

## Fusing OS image

- Plug the USB cable on board.
You can check two USB serial ports. First port is for USB download and second port is for serial.
- Execute flash.bat on openocd directory. It erases flash memory and writes new image.

![pusing](media/tizenRT7.png)

## Run samples
- Execute console application likes putty. Configure it with 115200 baud rate and then run it with serial session.

![putty](media/tizenRT5.png)

- Reset board and write 'cloud azure-iothub-client' on console application to run azure sample.

![exec](media/tizenRT8.png)

0 comments on commit 3d0ec69

Please sign in to comment.