diff --git a/Makefile b/Makefile index b101aae..003f6c6 100644 --- a/Makefile +++ b/Makefile @@ -22,8 +22,11 @@ SDK_EXTRA_LIBS ?= /opt/Espressif/arch/lib SDK_BASE ?= /opt/Espressif/ESP8266_SDK #Esptool.py path and port -ESPTOOL ?= esptool.py +ESPTOOL ?= esptool ESPPORT ?= /dev/ttyUSB0 +#ESPDELAY indicates seconds to wait between flashing the two binary images +ESPDELAY ?= 3 +ESPBAUD ?= 115200 # name for the target project TARGET = httpd @@ -72,7 +75,6 @@ LD := $(XTENSA_TOOLS_ROOT)/xtensa-lx106-elf-gcc #### #### no user configurable options below here #### -FW_TOOL ?= /usr/bin/esptool SRC_DIR := $(MODULES) BUILD_DIR := $(addprefix $(BUILD_BASE)/,$(MODULES)) @@ -117,11 +119,11 @@ all: checkdirs $(TARGET_OUT) $(FW_FILE_1) $(FW_FILE_2) $(FW_FILE_1): $(TARGET_OUT) firmware $(vecho) "FW $@" - $(Q) $(FW_TOOL) -eo $(TARGET_OUT) $(FW_FILE_1_ARGS) + $(Q) $(ESPTOOL) -eo $(TARGET_OUT) $(FW_FILE_1_ARGS) $(FW_FILE_2): $(TARGET_OUT) firmware $(vecho) "FW $@" - $(Q) $(FW_TOOL) -eo $(TARGET_OUT) $(FW_FILE_2_ARGS) + $(Q) $(ESPTOOL) -eo $(TARGET_OUT) $(FW_FILE_2_ARGS) $(TARGET_OUT): $(APP_AR) $(vecho) "LD $@" @@ -140,9 +142,10 @@ firmware: $(Q) mkdir -p $@ flash: $(FW_FILE_1) $(FW_FILE_2) - -$(ESPTOOL) --port $(ESPPORT) write_flash 0x00000 firmware/0x00000.bin - sleep 3 - -$(ESPTOOL) --port $(ESPPORT) write_flash 0x40000 firmware/0x40000.bin + $(Q) $(ESPTOOL) -cp $(ESPPORT) -cb $(ESPBAUD) -ca 0x00000 -cf firmware/0x00000.bin -v + $(Q) [ $(ESPDELAY) -ne 0 ] && echo "Please put the ESP in bootloader mode..." + $(Q) sleep $(ESPDELAY) + $(Q) $(ESPTOOL) -cp $(ESPPORT) -cb $(ESPBAUD) -ca 0x40000 -cf firmware/0x40000.bin -v webpages.espfs: html/ mkespfsimage/mkespfsimage cd html; find | ../mkespfsimage/mkespfsimage > ../webpages.espfs; cd .. @@ -152,7 +155,7 @@ mkespfsimage/mkespfsimage: mkespfsimage/ htmlflash: webpages.espfs if [ $$(stat -c '%s' webpages.espfs) -gt $$(( 0x2E000 )) ]; then echo "webpages.espfs too big!"; false; fi - -$(ESPTOOL) --port $(ESPPORT) write_flash 0x12000 webpages.espfs + $(ESPTOOL) -cp $(ESPPORT) -cb $(ESPBAUD) -ca 0x12000 -cf webpages.espfs -v clean: $(Q) rm -f $(APP_AR)