Thursday, March 5, 2015

Making your own environment for ESP8266.

If you don't want to use my setup described here, you can make your own setup using your own distribution.

You can make your own environment for compiling your code or the demo code for the ESP8266.

Step 1.

Download ova image  ( lunbuntu 14.04) for VirtualBox or install your preferred Linux distribution.

User is esp8266 and password is  espressif

sudo apt-get install git autoconf build-essential gperf bison flex texinfo libtool libncurses5-dev 

wget gawk libc6-dev python-serial libexpat1-dev

Step 2.

sudo mkdir /opt/Espressif

Step 3.

sudo chown esp8266 /opt/Espressif/

Step 4.

cd /opt/Espressif

Step 5.

git clone -b lx106 git://github.com/jcmvbkbc/crosstool-NG.git

Step 6.

cd crosstool-NG/

./bootstrap && ./configure --prefix=`pwd` && make && make install

Step 7.

./ct-ng xtensa-lx106-elf

Step 8.

./ct-ng build

Note: It takes about 25 minutes !!!!!!!

Step 9.

Edit the .profile file from /home/esp8266 and add the line

PATH="$HOME/bin:/opt/Espressif/crosstool-NG/builds/xtensa-lx106-elf/bin:$PATH"

Step 10.

cd /opt/Espressif

wget -O esp_iot_sdk_v0.9.5_15_01_23.zip https://github.com/esp8266/esp8266-

wiki/raw/master/sdk/esp_iot_sdk_v0.9.5_15_01_23.zip

Note: is the SDK from 23 Jan 2015. Verify if there is a new one.

Step 11.

unzip esp_iot_sdk_v0.9.5_15_01_23.zip 

mv esp_iot_sdk_v0.9.5 ESP8266_SDK/

Step 12.

cd /opt/Espressif/ESP8266_SDK

wget -O lib/libc.a https://github.com/esp8266/esp8266-wiki/raw/master/libs/libc.a

wget -O lib/libhal.a https://github.com/esp8266/esp8266-wiki/raw/master/libs/libhal.a

wget -O include.tgz https://github.com/esp8266/esp8266-wiki/raw/master/include.tgz

tar -xvzf include.tgz

rm include.tgz

Step 13.

cd /opt/Espressif

git clone https://github.com/themadinventor/esptool esptool-py

chown -R esp8266 crosstool-NG/

sudo ln -s $PWD/esptool-py/esptool.py crosstool-NG/builds/xtensa-lx106-elf/bin/

Step 14.

The SDK esp_iot_sdk_v0.9.5_15_01_23.zip has a directory named Document with some pdf files about API, AT commands and release notes.

Step 15. 

Copy the "at" directory from /opt/Espressif/ESP8266_SDK/examples and compile it

cp -R /opt/Espressif/ESP8266_SDK/examples/at /opt/Espressif/ESP8266_SDK/

cd /opt/Espressif/ESP8266_SDK/at

make clean

make 

The result resides in the /opt/Espressif/ESP8266_SDK/bin directory

Flashing the code. Note that the above command is on long line. You can put the command into a file flashEsp, give that file executable rights and use it with ./flashEsp

sudo /opt/Espressif/esptool-py/esptool.py --port /dev/ttyUSB0 write_flash 0x3C000 /opt/Espressif/ESP8266_SDK/bin/blank.bin 0x00000 /opt/Espressif/ESP8266_SDK/bin/eagle.flash.bin 0x40000 /opt/Espressif/ESP8266_SDK/bin/eagle.irom0text.bin OR /opt/Espressif/esptool-py/esptool.py -p /dev/ttyUSB0 write_flash 0x40000 ../bin/eagle.irom0text.bin write_flash 0x00000 ../bin/eagle.flash.bin


I hope I didn't missed any step.



No comments:

Post a Comment