Преглед изворни кода

Download pre-built toolchains (#2545)

* Download pre-built toolchains

* Updated to include the platform in the name of the pre-built toolchain

* Download archive into cache/

* Update Travis configuration to use pre-built toolchain via make
Ryan Hartlage пре 5 година
родитељ
комит
8bb41fe93f
4 измењених фајлова са 27 додато и 9 уклоњено
  1. 1 0
      .gitignore
  2. 0 3
      .travis.yml
  3. 26 6
      Makefile
  4. BIN
      tools/esp-open-sdk.tar.xz

+ 1 - 0
.gitignore

@@ -8,6 +8,7 @@ server-ca.crt
 luac.cross
 uz_unzip
 uz_zip
+tools/toolchains/
 
 #ignore Eclipse project files
 .cproject

+ 0 - 3
.travis.yml

@@ -7,9 +7,6 @@ addons:
 cache:
   - directories:
     - cache
-install:
-- tar -Jxvf tools/esp-open-sdk.tar.xz
-- export PATH=$PATH:$PWD/esp-open-sdk/xtensa-lx106-elf/bin
 script:
 - export BUILD_DATE=$(date +%Y%m%d)
 - make EXTRA_CCFLAGS="-DBUILD_DATE='\"'$BUILD_DATE'\"'" all

+ 26 - 6
Makefile

@@ -2,6 +2,8 @@
 #
 .NOTPARALLEL:
 
+TOOLCHAIN_VERSION:=20181106.0
+
 # SDK base version, as released by Espressif
 SDK_BASE_VER:=2.2.1
 
@@ -47,7 +49,7 @@ ifeq ($(OS),Windows_NT)
 		OBJCOPY = xt-objcopy
 		#MAKE = xt-make
 		CCFLAGS += --rename-section .text=.irom0.text --rename-section .literal=.irom0.literal
-	else 
+	else
 		# It is gcc, may be cygwin
 		# Can we use -fdata-sections?
 		CCFLAGS += -ffunction-sections -fno-jump-tables -fdata-sections
@@ -73,11 +75,13 @@ ifeq ($(OS),Windows_NT)
 else
 # We are under other system, may be Linux. Assume using gcc.
 	# Can we use -fdata-sections?
+	PLATFORM:=linux-x86_64
 	ifndef COMPORT
 		ESPPORT = /dev/ttyUSB0
 	else
 		ESPPORT = $(COMPORT)
 	endif
+	export PATH := $(PATH):$(TOP_DIR)/tools/toolchains/esp8266-$(PLATFORM)-$(TOOLCHAIN_VERSION)/bin/
 	CCFLAGS += -ffunction-sections -fno-jump-tables -fdata-sections
 	AR = xtensa-lx106-elf-ar
 	CC = $(WRAPCC) xtensa-lx106-elf-gcc
@@ -145,9 +149,9 @@ endif
 endif
 
 #
-# Note: 
+# Note:
 # https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
-# If you add global optimize options like "-O2" here 
+# If you add global optimize options like "-O2" here
 # they will override "-Os" defined above.
 # "-Os" should be used to reduce code size
 #
@@ -161,7 +165,7 @@ CCFLAGS += 			\
 	-nostdlib       \
 	-mlongcalls	\
 	-mtext-section-literals
-#	-Wall			
+#	-Wall
 
 CFLAGS = $(CCFLAGS) $(DEFINES) $(EXTRA_CCFLAGS) $(STD_CFLAGS) $(INCLUDES)
 DFLAGS = $(CCFLAGS) $(DDEFINES) $(EXTRA_CCFLAGS) $(STD_CFLAGS) $(INCLUDES)
@@ -191,7 +195,7 @@ DEP_LIBS_$(1) = $$(foreach lib,$$(filter %.a,$$(COMPONENTS_$(1))),$$(dir $$(lib)
 DEP_OBJS_$(1) = $$(foreach obj,$$(filter %.o,$$(COMPONENTS_$(1))),$$(dir $$(obj))$$(OBJODIR)/$$(notdir $$(obj)))
 $$(IMAGEODIR)/$(1).out: $$(OBJS) $$(DEP_OBJS_$(1)) $$(DEP_LIBS_$(1)) $$(DEPENDS_$(1))
 	@mkdir -p $$(IMAGEODIR)
-	$$(CC) $$(LDFLAGS) $$(if $$(LINKFLAGS_$(1)),$$(LINKFLAGS_$(1)),$$(LINKFLAGS_DEFAULT) $$(OBJS) $$(DEP_OBJS_$(1)) $$(DEP_LIBS_$(1))) -o $$@ 
+	$$(CC) $$(LDFLAGS) $$(if $$(LINKFLAGS_$(1)),$$(LINKFLAGS_$(1)),$$(LINKFLAGS_DEFAULT) $$(OBJS) $$(DEP_OBJS_$(1)) $$(DEP_LIBS_$(1))) -o $$@
 endef
 
 $(BINODIR)/%.bin: $(IMAGEODIR)/%.out
@@ -204,16 +208,32 @@ $(BINODIR)/%.bin: $(IMAGEODIR)/%.out
 # Should be done in top-level makefile only
 #
 
-all:	sdk_pruned pre_build .subdirs $(OBJS) $(OLIBS) $(OIMAGES) $(OBINS) $(SPECIAL_MKTARGETS)
+all: toolchain sdk_pruned pre_build .subdirs $(OBJS) $(OLIBS) $(OIMAGES) $(OBINS) $(SPECIAL_MKTARGETS)
 
 .PHONY: sdk_extracted
 .PHONY: sdk_patched
 .PHONY: sdk_pruned
+.PHONY: toolchain
 
 sdk_extracted: $(TOP_DIR)/sdk/.extracted-$(SDK_BASE_VER)
 sdk_patched: sdk_extracted $(TOP_DIR)/sdk/.patched-$(SDK_VER)
 sdk_pruned: $(SDK_DIR_DEPENDS) $(TOP_DIR)/sdk/.pruned-$(SDK_VER)
 
+ifeq ($(OS),Windows_NT)
+toolchain:
+else
+toolchain: $(TOP_DIR)/tools/toolchains/esp8266-$(PLATFORM)-$(TOOLCHAIN_VERSION)/bin/xtensa-lx106-elf-gcc
+
+$(TOP_DIR)/tools/toolchains/esp8266-$(PLATFORM)-$(TOOLCHAIN_VERSION)/bin/xtensa-lx106-elf-gcc: $(TOP_DIR)/cache/toolchain-esp8266-$(PLATFORM)-$(TOOLCHAIN_VERSION).tar.xz
+	mkdir -p $(TOP_DIR)/tools/toolchains/
+	tar -xJf $< -C $(TOP_DIR)/tools/toolchains/
+	touch $@
+
+$(TOP_DIR)/cache/toolchain-esp8266-$(PLATFORM)-$(TOOLCHAIN_VERSION).tar.xz:
+	mkdir -p $(TOP_DIR)/cache
+	wget --tries=10 --timeout=15 --waitretry=30 --read-timeout=20 --retry-connrefused https://github.com/jmattsson/esp-toolchains/releases/download/$(PLATFORM)-$(TOOLCHAIN_VERSION)/toolchain-esp8266-$(PLATFORM)-$(TOOLCHAIN_VERSION).tar.xz -O $@ || { rm -f "$@"; exit 1; }
+endif
+
 $(TOP_DIR)/sdk/.extracted-$(SDK_BASE_VER): $(TOP_DIR)/cache/v$(SDK_FILE_VER).zip
 	mkdir -p "$(dir $@)"
 	(cd "$(dir $@)" && rm -fr esp_iot_sdk_v$(SDK_VER) ESP8266_NONOS_SDK-$(SDK_BASE_VER) && unzip $(TOP_DIR)/cache/v$(SDK_FILE_VER).zip ESP8266_NONOS_SDK-$(SDK_BASE_VER)/lib/* ESP8266_NONOS_SDK-$(SDK_BASE_VER)/ld/eagle.rom.addr.v6.ld ESP8266_NONOS_SDK-$(SDK_BASE_VER)/include/* ESP8266_NONOS_SDK-$(SDK_BASE_VER)/bin/esp_init_data_default_v05.bin)

BIN
tools/esp-open-sdk.tar.xz