GithubHelp home page GithubHelp logo

casuist311 / st-device-sdk-c-ref Goto Github PK

View Code? Open in Web Editor NEW

This project forked from smartthingscommunity/st-device-sdk-c-ref

0.0 1.0 0.0 2.86 MB

Samples using SmartThings Device SDK

License: Apache License 2.0

Shell 9.07% Makefile 1.67% C 89.26%

st-device-sdk-c-ref's Introduction

SmartThings Device SDK Reference

License

The SmartThings Device SDK Reference is the git repository of examples using the core device library that allow device applications to securely connect to the SmartThings Cloud. To facilitate the development of device application in an original chipset SDK, the core device library and the examples were separated into two git repositories. That is, if you want to use the core device library in your original chipset SDK that installed before, you may simply link it to develop a device application in your existing development environment.

It is distributed in source form and written in C99 for the purpose of portability to most platforms. If you want to know the overall workflow of using this SDK, please refer to the Getting Started.

Directory layout

The reference examples git is delivered via the following directory structure :

  • apps : sample device applications for each chipset
  • bsp : original chipset vendor's SDKs as submodules
  • doc : documents
  • iot-core : core device library as submodule
  • output : build outputs will be placed
  • patches : patches to be applied in the original chipset vendor's SDK for resolving some problems
  • tools : scripts to be applied for each chipset

Building a sample device application

Basically, this release builds on the environments of chipset SDKs .

Prerequisites

  • Install the toolchain defined in the chipset SDK used.

    • Example for ESP8266

    • Example for RTL8195

      • Install mbed Microcontroller to use the USB serial port on Windows.

      • Upgrade DAP F/W

        Recommended DAP F/W is the DAP_FW_Ameba_V12_1_3-2M.bin

Build

  1. Clone the source code and submodules. Basically, the SmartThings Device SDK Reference will use ported original chipset vendor's SDKs as submodules in the bsp directory. If a chipset vendor's SDK does not exist as git format, you can manually copy it under the bsp directory.

    • Download the source code via git clone.

    • And then, use setup.sh to clone submodules automatically in the SDK's root directory.

      cd ~
      git clone https://github.com/SmartThingsCommunity/st-device-sdk-c-ref.git
      cd st-device-sdk-c-ref
      ./setup.sh esp8266                       # ./setup.sh {chip_name}
  2. Check the build configuration of a sample device application. If you want to use specific build options, you can modify the build configuration file(e.g. sdkconfig) at the root directory of a sample device application. But, if possible, we recommend that you configure them with make menuconfig. Please use the command the below.

    • The build configuration example of switch device for ESP8266.

      cd ~/st-device-sdk-c-ref/apps/esp8266/st_switch
      make menuconfig
    • If you use a default build options, you can skip this step.

  3. Run build.sh in the SDK's root directory. This builds the sample executables and places them in output/{chip_name}/.

    • build

      ./build.sh esp8266 st_switch          # ./build.sh {chip_name} {app_name}

flash & monitor

Serial port needs to be matched to the computer environment for serial port flashing and monitoring.

  • Example for ESP8266
    • Baud rate 115200 for flashing or 74880 for monitoring, Date bit 8, Parity None, Stop bits 1
    • These data are described in the build configuration file(e.g. sdkconfig)
  • Example for RTL8195
    • Baud rate 115200, Date bit 8, Parity None, Stop bits 1

Flashing can be done according to the method supported by chipset SDK.

  • Example for ESP8266

    You can flash the executables into a target device via build.sh with additional option. Actually, you don't need to run ./build.sh esp8266 st_switch before running ./build.sh esp8266 st_switch flash, this will automatically rebuild anything which needs it.

    • options

      • clean : clean previous build outputs

        # ./build.sh {chip_name} {app_name} {options}
        ./build.sh esp8266 st_switch clean
      • flash : download executable binaries to the device

      • monitor : monitor the serial output of device. this option can be used with flash option.

        # ./build.sh {chip_name} {app_name} {options}
        ./build.sh esp8266 st_switch flash monitor
  • Example for RTL8195

    In order to flash, you have to proceed at Windows PC, even if you build the source code for the RTL chipset on Linux.

    • Connect Ameba RTL8195 to Windows PC, you can find removable disk named MBED.
    • Just copy ram_all.bin in output/rtl8195/iotcore_xxx/ram_all.bin to MBED.
    • After copy successfully, please reset Ameba RTL8195 target and monitor

License

This library is licensed under the Apache License Ver2.0.

st-device-sdk-c-ref's People

Contributors

yongsuloh avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.