ESP8266 GCC SDK

From ElectroDragon Wiki

Building the toolchain

As root

apt-get install git autoconf build-essential gperf bison flex texinfo libtool libncurses5-dev wget gawk
mkdir /opt/Espressif
chown $username /opt/Espressif (replace $username with the name of the local user)

as local user

/opt/Espressif
git clone -b lx106 git://github.com/jcmvbkbc/crosstool-NG.git 
cd crosstool-NG
./bootstrap && ./configure --prefix=`pwd` && make && make install
./ct-ng xtensa-lx106-elf
./ct-ng build

Setting up the SDK

wget -O /opt/Espressif/ESP8266_SDK/lib/libc.a https://github.com/esp8266/esp8266-wiki/raw/master/libs/libc.a
wget -O /opt/Espressif/ESP8266_SDK/lib/libhal.a https://github.com/esp8266/esp8266-wiki/raw/master/libs/libhal.a
  • Add header/inlcude files:
wget -O /opt/Espressif/include.tgz https://github.com/esp8266/esp8266-wiki/raw/master/include.tgz
cd /opt/Espressif/
tar -xvzf include.tgz

Making the ESP tool

cd ~
wget https://github.com/esp8266/esp8266-wiki/raw/master/deb/src/esptool_0.0.2.orig.tar.gz
tar -xvzf esptool_0.0.2.orig.tar.gz
sudo cp esptool/esptool /usr/bin

Make/compile the AT Example

comment the line #include user_config.h from /opt/Espressif/ESP8266_SDK/include/osapi.h

cd ~
mkdir esp_sources
cd esp_sources
  • copy the example at from SDK
cp -R /opt/Espressif/ESP8266_SDK/examples/at at
cd at 
  • get the make file
wget -O Makefile https://gist.githubusercontent.com/zarya/7e1a08160bf3b7ac220f/raw/a58ed9a1243dece92b671062bb16555844b326ab/gistfile1.mak
make

will finallly get in seconds: (/home/xman/esp_sources/at/firmware)

FW firmware/0x00000.bin
FW firmware/0x40000.bin

Install python and relevant

  • Install python 2.7
apt-get install python
tar -xvzf pyserial-2.7.tar.gz
cd pyserial-2.7
python setup.py install

Flash

wget https://github.com/themadinventor/esptool/blob/master/esptool.py
esptool.py --port /dev/tty.usbmodem0E102EE1 write_flash 0x00000 0x00000.bin
esptool.py --port /dev/tty.usbmodem0E102EE1 write_flash 0x40000 0x40000.bin