Skip to main content

Running pubnub on esp8266

                  I.            Setup esp-open-sdk

a.       Requirements and Dependencies(Debian/Ubuntu)

sudo apt-get install make unrar-free autoconf automake libtool gcc g++ gperf \ 
flex bison texinfo gawk ncurses-dev libexpat-dev python-dev python python-serial \
    sed git unzip bash help2man wget bzip2
sudo apt-get install libtool-bin

b.      Building

git clone --recursive https://github.com/pfalcon/esp-open-sdk.git
cd esp-open-sdk
make

c.       Using the toolchain

sudo echo "export PATH=\$PATH:\%HOME/@localPath/esp-open-sdk/xtensa-lx106-elf/bin" >>  ~/.bashrc
example: sudo echo "export PATH=\$PATH:\$HOME/ws/esp8266/SDK/esp-open-sdk/xtensa-lx106-elf/bin" >> ~/.bashrc
source ~/.bashrc
Test compiler:
xtensa-esp32-elf-gcc -v

d.      Pulling updates


make clean
git pull
git submodule sync
git submodule update --init

                  II.            Building the toolchain

a.       Install needed dependencies (as root)

                                                               i.      32-Bit Debian (Linux)
sudo apt-get install git autoconf build-essential gperf bison flex texinfo libtool libncurses5-dev wget gawk libc6-dev-i386 python-serial libexpat-dev
(replace $customPathwith the name of the local path)
mkdir /@customPath/Espressif

                                                             ii.      64-bit Debian (Linux)
sudo apt-get install git autoconf build-essential gperf bison flex texinfo libtool libncurses5-dev wget gawk libc6-dev-amd64 python-serial libexpat-dev
(replace $customPathwith the name of the local path)
mkdir /@customPath/Espressif

b.      Install the Xtensa crosstool-NG (as local user)


cd /esp-open-sdk/crosstool-NG

./bootstrap
./configure --prefix="$pwd"
make
sudo make install

./ct-ng menuconfig
./ct-ng buildls

PATH=$PWD/builds/xtensa-lx106-elf/bin:$PATH
Document about crosstool-NG
http://crosstool-ng.github.io/docs/

c.       Setting up the Espressif SDK


cd /@customPath/Espressif

wget -O esp_iot_sdk_v0.9.3_14_11_21.zip https://github.com/esp8266/esp8266-wiki/raw/master/sdk/esp_iot_sdk_v0.9.3_14_11_21.zip
wget -O esp_iot_sdk_v0.9.3_14_11_21_patch1.zip https://github.com/esp8266/esp8266-wiki/raw/master/sdk/esp_iot_sdk_v0.9.3_14_11_21_patch1.zip
unzip esp_iot_sdk_v0.9.3_14_11_21.zip
unzip esp_iot_sdk_v0.9.3_14_11_21_patch1.zip
mv esp_iot_sdk_v0.9.3 ESP8266_SDK
mv License ESP8266_SDK
cd /@customPath/Espressif

-          cd /opt/Espressif
-          wget -O esp_iot_sdk_v0.9.3_14_11_21.zip https://github.com/esp8266/esp8266-wiki/raw/master/sdk/esp_iot_sdk_v0.9.3_14_11_21.zip
-          wget -O esp_iot_sdk_v0.9.3_14_11_21_patch1.zip https://github.com/esp8266/esp8266-wiki/raw/master/sdk/esp_iot_sdk_v0.9.3_14_11_21_patch1.zip
-          unzip esp_iot_sdk_v0.9.3_14_11_21.zip
-          unzip esp_iot_sdk_v0.9.3_14_11_21_patch1.zip
-          mv esp_iot_sdk_v0.9.3 ESP8266_SDK
-          mv License ESP8266_SDK/

d.      Patching

-          cd /opt/Espressif/ESP8266_SDK
-          sed -i -e 's/xt-ar/xtensa-lx106-elf-ar/' -e 's/xt-xcc/xtensa-lx106-elf-gcc/' -e 's/xt-objcopy/xtensa-lx106-elf-objcopy/' Makefile
-          mv examples/IoT_Demo .

e.      Installing Xtensa libraries and headers

-          cd /opt/Espressif/ESP8266_SDK
-          tar -xvzf include.tgz

f.        Installing the ESP image tool

-          cd /opt/Espressif
-          wget -O esptool_0.0.2-1_i386.deb https://github.com/esp8266/esp8266-wiki/raw/master/deb/esptool_0.0.2-1_i386.deb
-          dpkg -i esptool_0.0.2-1_i386.deb

g.       Installing the ESP upload tool

-          cd /opt/Espressif
-          git clone https://github.com/themadinventor/esptool esptool-py
-          sudo ln -s $PWD/esptool-py/esptool.py crosstool-NG/builds/xtensa-lx106-elf/bin/

                  III.            Building project

-          cd /opt/Espressif
-          cd source-code-examples/blinky
-          make

                  IV.            Uploading to ESP8266

-
-          Prepare hardware
-          cd /opt/Espressif/source-code-examples/blinky
-          make ESPPORT=/dev/ttyUSB0 flash



Comments