Create portable toolchain

This commit adds changes required for the toolchain to be
portable:

* Toolchain built is now static
* All SDK headers are installed into the toolchain itself
* All blobs from SDK are installed into toolchain itself
* Toolchain directory name is its GNU_TARGET_NAME by default

This also removes the need to specify the -L and -I flags
while building the actual software to include SDK libraries

Signed-off-by: Andrew Andrianov <andrew@ncrmnt.org>
This commit is contained in:
Andrew Andrianov 2014-11-18 15:15:00 +03:00
parent 02a714d459
commit a62293b698

View file

@ -1,5 +1,5 @@
TOP=$(PWD)
TOOLCHAIN=$(TOP)/toolchain
TOOLCHAIN=$(TOP)/xtensa-lx106-elf
all: sdk_patch $(TOOLCHAIN)/lib/libhal.a $(TOOLCHAIN)/bin/xtensa-lx106-elf-gcc
@echo
@ -7,9 +7,7 @@ all: sdk_patch $(TOOLCHAIN)/lib/libhal.a $(TOOLCHAIN)/bin/xtensa-lx106-elf-gcc
@echo
@echo 'export PATH=$(TOOLCHAIN)/bin:$$PATH'
@echo
@echo "Espressif ESP8266 SDK is installed, to use it run compiler as follows:"
@echo
@echo "xtensa-lx106-elf-gcc -I$(TOP)/sdk/include -L$(TOP)/sdk/lib"
@echo "Espressif ESP8266 SDK is installed, additional blobs are installed into the toolchain"
@echo
sdk_patch: sdk/lib/libpp.a
@ -42,11 +40,16 @@ libhal:
$(TOOLCHAIN)/bin/xtensa-lx106-elf-gcc: crosstool-NG/ct-ng
make -C crosstool-NG -f ../Makefile toolchain
toolchain:
toolchain: esp_iot_sdk_v0.9.2/.dir
./ct-ng xtensa-lx106-elf
sed -r -i.org s%CT_PREFIX_DIR=.*%CT_PREFIX_DIR="$(TOOLCHAIN)"% .config
sed -r -i s%CT_INSTALL_DIR_RO=y%"#"CT_INSTALL_DIR_RO=y% .config
echo CT_STATIC_TOOLCHAIN=y >> .config
./ct-ng build
@echo "Installing additional SDK headers"
@cp -Rfv sdk/include/* $(TOOLCHAIN)/xtensa-lx106-elf/usr/include/
@echo "Installing additional SDK blobs"
@cp -Rfv sdk/lib/* $(TOOLCHAIN)/xtensa-lx106-elf/lib/
crosstool-NG/ct-ng: crosstool-NG/bootstrap
make -C crosstool-NG -f ../Makefile ct-ng