https://github.com/esp8266/esp8266-wiki/wiki/Toolchain
Instead of just downloading binaries for libc.a and libhal.a I actually build those packages from the sources specified. What I'd really like to do however, is download source releases for tools like crosstool-NG and newlib, and apply patches. Does anyone have any suggestions for that?
Anyway, for what it is worth, here is my script. I'm running it on ubuntu 14.04, so ymmv. Let me know if you have any suggestions for improvement.
ESP_HOME=$PWD/Espressif
mkdir -p $ESP_HOME
function install_compiler {
cd $ESP_HOME
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
chmod -R u+w $ESP_HOME/crosstool-NG/builds/xtensa-lx106-elf
export PATH=$ESP_HOME/crosstool-NG/builds/xtensa-lx106-elf/bin:$PATH
}
function install_sdk {
cd $ESP_HOME
#mkdir ESP8266_SDK
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 -o 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 $ESP_HOME/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 .
}
#function install_libhal {
#cd $ESP_HOME/ESP8266_SDK
#wget -O lib/libhal.a https://github.com/esp8266/esp8266-wiki/raw/master/libs/libhal.a
#}
#function install_includes {
#cd $ESP_HOME/ESP8266_SDK
#wget -O include.tgz https://github.com/esp8266/esp8266-wiki/raw/master/include.tgz
#tar -xvzf include.tgz
#}
#function install_libc {
#cd $ESP_HOME/ESP8266_SDK
#wget -O lib/libc.a https://github.com/esp8266/esp8266-wiki/raw/master/libs/libc.a
#}
function install_libhal {
cd $ESP_HOME
git clone https://github.com/tommie/lx106-hal.git
cd lx106-hal
autoreconf -i
mkdir build
cd build
../configure --host=xtensa-lx106-elf --prefix=$ESP_HOME/crosstool-NG/builds/xtensa-lx106-elf/xtensa-lx106-elf/sysroot/usr
make
make install
}
function install_libc {
cd $ESP_HOME
git clone -b xtensa https://github.com/jcmvbkbc/newlib-xtensa.git
cd newlib-xtensa/newlib
export CC=xtensa-lx106-elf-gcc
./configure --build=xtensa-lx106-elf --prefix=$ESP_HOME/crosstool-NG/builds/xtensa-lx106-elf/xtensa-lx106-elf/sysroot/usr
make
make install
export CC=
export CFLAGS=
}
function install_esp_image_tool {
cd $ESP_HOME
wget -O esptool_0.0.2.orig.tar.gz 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
cd esptool
make clean && make
ln -s $ESP_HOME/esptool/esptool $ESP_HOME/crosstool-NG/builds/xtensa-lx106-elf/bin/
}
function install_esp_upload_tool {
cd $ESP_HOME
git clone https://github.com/themadinventor/esptool esptool-py
ln -s $ESP_HOME/esptool-py/esptool.py crosstool-NG/builds/xtensa-lx106-elf/bin/
}
install_compiler
install_sdk
install_libhal
#install_includes
install_libc
install_esp_image_tool
install_esp_upload_tool
cd $ESP_HOME/ESP8266_SDK/IoT_Demo
make