.ia-secondary-container
This guide explains how to set up the development environment and create applications for ESP8266 on Linux systems (tested on Ubuntu 14.04).
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.
Flash mode
| Run mode
|
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:
sudo apt-get install autoconf libtool libtool-bin bison build-essential gawk git gperf flex texinfo libtool libncurses5-dev libc6-dev-amd64 python-serial libexpat-dev python-setuptools
2. Install ESP RTOS SDK:
export ESPRESSIF_HOME=/opt/Espressif sudo mkdir -p $ESPRESSIF_HOME sudo chown `whoami`:root $ESPRESSIF_HOME cd $ESPRESSIF_HOME export ESP_SDK_HOME=$ESPRESSIF_HOME/esp-rtos-sdk git clone https://github.com/espressif/esp_iot_rtos_sdk.git $ESP_SDK_HOME cd $ESP_SDK_HOME git reset --hard 169a436ce10155015d056eab80345447bfdfade5 wget -O lib/libhal.a https://github.com/esp8266/esp8266-wiki/raw/master/libs/libhal.a cd $ESP_SDK_HOME/include/lwip/arch sed -i "s/#include \"c_types.h\"/\/\/#include \"c_types.h\"/" cc.h
3. Install Xtensa-lx106 GNU toolchain:
cd $ESPRESSIF_HOME git clone -b lx106 git://github.com/jcmvbkbc/crosstool-NG.git cd crosstool-NG ./bootstrap && ./configure --prefix=`pwd` && make && sudo make install ./ct-ng xtensa-lx106-elf ./ct-ng build export PATH=$PATH:$ESPRESSIF_HOME/crosstool-NG/builds/xtensa-lx106-elf/bin
4. Install improved esptool.py:
cd $ESPRESSIF_HOME git clone https://github.com/RostakaGmfun/esptool.git cd esptool sudo python setup.py install
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:
rm -rf build mkdir -p build cd build cmake -DCMAKE_INSTALL_PREFIX=<YOUR_DESTINATION_PATH> -DKAA_PLATFORM=esp8266 -DCMAKE_TOOLCHAIN_FILE=../toolchains/esp8266.cmake .. make install
The C SDK will be installed to the <
YOUR_DESTINATION_PATH>
directory. For more details on building the C SDK, please refer to this page.
user_init()
function.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 irom
segment.
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 irom
segment.
You can find valid linker scripts in the ld
directory of ConfigurationDemo for the ESP8266 platform.
As an example, you can try out ConfigurationDemo. Put generated SDK from Kaa Sandbox into libs/kaa
folder.
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:
./build.sh deploy
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/0x00000.bin
and 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.
Copyright © 2014-2015, CyberVision, Inc.
4 Comments
Abhishek Dwivedi
If https clone fails at,
git clone https:
//github
.com
/RostakaGmfun/esptool
.git
use:
git clone [email protected]:RostakaGmfun/esptool.git
mohammad
could you please help me i have problem after
.
/ct-ng
xtensa-lx106-elf
.
/ct-ng
build
Sudheer Herle
Hi all,
I have a question. It is mentioned in the 'Example' section that I will be prompted for SSID and password during deployment.
But I prefer it to work other way. I want the end user to configure the SSID and password. Is there a way? Should the SSID and password get embedded in the firmware?
Any help will be much appreciated.
Thanks,
Sudheer
Maxim Olender
I not sure that it is a right place to ask and answer questions.
Nevertheless, you can modify application code and ask user for WiFi credentials.
There are no limitations for it neither in Kaa, nor in ESP.
Our sample applications shows simplest way possible and simplest way is to embed SSID and password during build.
Regards,
Max
P.S.
We offer a forum for technical (and often non-technical) Q&A:
https://groups.google.com/forum/#!forum/kaaproject