SmartThings SDK Reference for Direct Connected Devices for C
Easily integrate your Direct Connected Device using the Direct Connected Devices SDK. The SDK manages all MQTT topics and onboarding requirements, freeing you to focus on the Capabilities of your device.
To facilitate development of device applications in an original chipset SDK, the IoT core device library and supporting examples are separated into two git repositories: the IoT core device library and the Direct Connected Devices SDK repository. If you want to use the IoT core device library in your original chipset SDK that you previously installed, link the core device library to develop a device application in your existing development environment.
The Direct Connected Devices SDK is distributed in source form and written in C99 for the purpose of portability to most platforms. For a complete overview of the development process and workflow, please refer to the Direct Connected Devices documentation.
apps
: Contains sample device applications for various chipsets.bsp
: Contains the original chipset vendors' SDKs. If you use a chipset that has already been ported, this vendor's SDK can easily be downloaded as a submodule in this directory through the predefined script setup.py
.doc
: Documentation.iot-core
: Contains the IoT core device library. It can also be downloaded as a submodule in this directory through the predefined script setup.py
.output
: Where build outputs will be placed.patches
: Patches to be applied to the original chipset vendors' SDKs for resolving various problems.tools
: Various scripts to be applied for each chipset.The Direct Connected Devices SDK builds on the environments of each chipset vendor's SDK, providing an all-in-one development package.
Install the toolchain defined in the chipset SDK you use according to the directions below. If no development environment is described for your chipset, it is assumed to only be applicable for 64-bit Ubuntu-based environments.
build.py
, extract the toolchain into the ~/esp/xtensa-lx106-elf/
directory as directed in the Expressif documentation linked above.The Espressif documentation linked above directs you to add the toochain path to your
PATH
environment variable in your~/.profile
. This step not necessary if you use the pre-supplied build scriptbuild.py
- the path is automatically exported when using the build script.
setup.py
build.py
, extract the toolchain to ~/esp/xtensa-esp32-elf/
as directed in the original Expressif documentation.The Espressif documentation linked above directs you to add the toochain path to your
PATH
environment variable in your~/.profile
. This step not necessary if you use the pre-supplied build scriptbuild.py
- the path is automatically exported when using the build script.
For Windows systems:
DAP_FW_Ameba_V12_1_3-2M.bin
.The above steps are applicable for a Windows PC for downloading a binary. You must build the source code on Cygwin or linux for this chipset.
build.py
, set mico config --global MICODER /path_of_the_toolchain
setup.py
.
setup.py
will automatically download the ported original chipset vendor's SDKs as submodules in thebsp
directory through thesetup.py
script. If a chipset vendor's SDK does not exist in git format, you can manually copy it to thebsp
directory. At this time, the IoT Core Device Library will also be downloaded to theiot-core
directory.
$ cd ~
$ git clone https://github.com/SmartThingsCommunity/st-device-sdk-c-ref.git
$ cd st-device-sdk-c-ref
$ python setup.py
Usage: python setup.py [BSP_NAME]
--------------------------------------------------
ex) python setup.py rtl8721c
ex) python setup.py rtl8720c
ex) python setup.py rtl8195
ex) python setup.py esp32_v3.3
ex) python setup.py emw3080
ex) python setup.py emw3166
ex) python setup.py esp8266
ex) python setup.py esp32
ex) python setup.py esp32s2
ex) python setup.py esp32c3
apps
folder). If you want to use specific build options, you can directly modify the build configuration file (e.g. sdkconfig
, sdkconfig.h
) at the root directory of a sample device application. On the Espressif chipset, you can additionally use the menuconfig
option for configuration.If you want to use the default build configuration, you can skip this step.
Note that the
menuconfig
option is only supported on the Espressif chipset.
# python build.py {app_path} {option}
$ cd ~/st-device-sdk-c-ref
$ python build.py apps/esp32/switch_example menuconfig
Run build.py
in the SDK's root directory. This builds the sample executables and places them in output/{chip_name}/
.
$ python build.py apps/esp32/switch_example # python build.py {app_path}
The serial port of your device must to be matched to the computer environment for serial port flashing and monitoring. This data is described in the build configuration file (sdkconfig
)
Chipset | Buad Rate for Flashing | Baud Rate for Monitoring | Data Bit | Parity | Stop Bits |
---|---|---|---|---|---|
ESP8266/ESP32 | 115200 | 74880 | 8 | None | 1 |
RTL8195 | 115200 | 115200 | 8 | None | 1 |
EMW3166 | 9600 (user UART) | 115200 (USB UART) | 8 | None | 1 |
Flashing can be done according to the method outlined by the applicable chipset SDK.
You can flash the executables into a target device via build.py
with additional options.
You do not need to run
python build.py esp32 st_switch
before runningpython build.py esp32 st_switch flash
; this will automatically rebuild anything which needs it.
Available Options:
# python build.py {app_path} {options}
$ python build.py apps/esp32/switch_example clean
# python build.py {app_path} {options}
$ python build.py apps/esp32/switch_example flash monitor
In order to flash the RTL chipset binary, the steps below must be performed on a Windows PC, even if you build the source code on a Linux environment.
MBED
will appear.ram_all.bin
from output/rtl8195/iotcore_xxx/ram_all.bin
to MBED.In order to flash the MXCHIP emw3166 chipset binary, the steps below must be performed on a Windows PC with a terminal that supports Ymodem transmission.
output/emw3166/iotcore_xxx/[email protected]
using Ymodem on your terminal.This library is licensed under the Apache License Ver2.0.