This guide explains how to set up the development environment and create applications for ESP8266 on Linux systems (tested on Ubuntu 14.04).
Connecting ESP8266 to PC (Linux)
To connect the ESP8266 chip to PC, a 3.3V USB-to-TTL connector is required.
This section guides you through the connection process for the ESP8266-01 module, please refer to the ESP8266 documentation for information about other modules.
Installing required software
Before building the SDK for the ESP8266 platform, you need to install ESP8266 RTOS SDK, Xtensa GCC toolchain, and esptool.py utitlity for uploading firmware.
1. Install prerequisites:
2. Install ESP RTOS SDK:
3. Install Xtensa-lx106 GNU toolchain:
4. Install improved esptool.py:
Creating applications based on C SDK
Building C SDK
To build the C SDK for the ESP8266 platform, you will need to use GNU toolchain for Xtensa (which can be installed from sources as described above).
To create applications based on the C SDK, at first you should build a static library from the generated SDK. To do so, generate the C SDK in Admin UI, then extract the archive,
cd to it and execute the following:
The C SDK will be installed to the
/usr/local/kaa-esp8266/ directory. For more details on building the C SDK, please refer to this page.
Tips & tricks
- According to the ESP8266 SDK programming guide, the user application starts its execution in the
- To make the Kaa SDK work, you should establish network connection through WiFi. For more details on WiFi configuration, please refer to the ESP8266 official documentation.
- To see any output on the serial port, a UART driver is required.
You can use ConfigurationDemo (available in Kaa Sandbox) as an example of the UART and WiFi functionality coupled together with the Kaa endpoint SDK.
The ESP SDK provides a set of linker scripts for different Flash configurations. However, to run a Kaa client, some modifications to those scripts are required.
Basically, there are two sections where code can be placed. The first one is the
.text section, which maps to the
iram segment, and another one is the
.irom0.text section, which maps to the
The issue is that there is not enough space to place the Kaa SDK code in the
iram segment (the
.text section is mapped to the
iram segment by default) . This is why the default SDK linker scripts are modified to force linking the Kaa SDK code to the
You can find valid linker scripts in the
ld directory of ConfigurationDemo for the ESP8266 platform.
Connect ESP8266 to your PC through a USB-to-TTL connector as mentioned above, and execute the following in your terminal from demo root folder:
The deploy command of
build.sh script builds the C SDK for the ESP8266 platform, builds the ConfigurationDemo itself and a platform-dependent glue code for ESP8266 (WiFi connectivity, a UART driver), creates firmware images (
build/0x40000.bin) and, finally, writes these images to Flash at the corresponding addresses. You will be prompted of your WiFi station SSID and password, so that ESP8266 can connect to it.