Setup environment

The first thing you need to do is set up your programming environment.

Get STDK source code

There are two git repositories for working with the SmartThings SDK. One git repository has the core Internet of Things (IoT) library while the second git repository has example device applications.

Download st-device-sdk-c-ref

You can choose to only download the Refernces Repository from git, if you have already ported your project. The IoT core library is downloaded as a submodule in the reference repository.

From the terminal, navigate to the directory you want the STDK to live and clone it using the following git command:

cd ~
git clone

You can use a script to setup a chipset SDK as follows:

cd ~/st-device-sdk-c-ref
Usage: ./ CHIP_NAME
- - - - - - - - - - - - - - - - - - -
ex) ./ esp8266
ex) ./ esp32
ex) ./ rtl8195
./ esp8266 # ./ {chip_name}

Create device identity

In order for your IoT device to connect to the SmartThings Cloud, there are authentication data files required. To create authentication data, you must know your MNID in the personal information window of Developer Workspace. Please sign in with Samsung Account and check your MNID first.

Open a terminal window and run the following stdk-keygen command to create a Device Identity.

$ cd ~/st-device-sdk-c-ref/iot-core/tools/keygen/linux
i$ ./stdk-keygen -h
usage: stdk-keygen -m MNID [-f firmware_version]
$ ./stdk-keygen -m **** -f V201910       # replace '****' with your MNID
For Device Identity of Developer Workspace,

Serial Number:

Public Key:
$ tree
├── ed25519.pubkey
├── ed25519.seckey
└── output_STDK************
    └── device_info.json

Copy the value between the -------------------- 8< -------------------- and -------------------- >8 -------------------- when you run the command on your computer. You will need to upload that value to the SmartThings Cloud server via Developer Workspace during the next phase.

If you create a device identity with a command line option like the example above, you can get ready to use the device_info.json directly.

Setup toolchain

You must setup a toolchain according to each chipset you selected.

ESP8266 example

For additional information see the following git repositories.

ESP822 supports multiple host environments including Windows, Linux, and macOS. Based on experience, compile times are significantly faster on Linux but it is up to you which environment you prefer to use.

Step 1: Install prerequisites

Get the following packages:

sudo apt-get install gcc git wget make libncurses-dev flex bison
gperf python python-pip python-setuptools python-serial
python-cryptography python-future python-pyparsing

Step 2: Setup toolchain

Get the ESP8266 toolchain for Linux, available on the Expressif website:

Once the file is downloaded, extract it in the ~/esp directory

mkdir -p ~/esp
cd ~/esp
tar -xzf

The above command places the files in the ~/esp/xtensa-lx106-elf/ directory.

export PATH="$PATH:$HOME/esp/xtensa-lx106-elf/bin"

Step 3: Setup path to chipset SDK

The toolchain programs access ESP8266 using the IDF_PATH environment variable. Add it permanently to the user profile file (~/.profile) with the following command.

export IDF_PATH=~/st-device-sdk-c-ref/bsp/esp8266

Step 4: Log off and log on

Log off and log back in to make the .profile changes made in steps 2 and 3 effective. Run the command below to verify that your PATH variable is properly set:

printenv PATH
printenv IDF_PATH

You should see something similar to what is listed below:

$ printenv PATH
$ printenv IDF_PATH