2016-08-17 11:08:22 -04:00
|
|
|
# Component support for esptool.py. Doesn't do much by itself,
|
|
|
|
# components have their own flash targets that can use these variables.
|
|
|
|
ESPPORT ?= $(CONFIG_ESPTOOLPY_PORT)
|
|
|
|
ESPBAUD ?= $(CONFIG_ESPTOOLPY_BAUD)
|
2016-09-01 03:47:09 -04:00
|
|
|
ESPFLASHMODE ?= $(CONFIG_ESPTOOLPY_FLASHMODE)
|
2016-09-02 00:29:01 -04:00
|
|
|
ESPFLASHFREQ ?= $(CONFIG_ESPTOOLPY_FLASHFREQ)
|
2016-08-17 11:08:22 -04:00
|
|
|
|
|
|
|
PYTHON ?= $(call dequote,$(CONFIG_PYTHON))
|
|
|
|
|
|
|
|
# two commands that can be used from other components
|
|
|
|
# to invoke esptool.py (with or without serial port args)
|
|
|
|
#
|
|
|
|
# NB: esptool.py lives in the sdk/bin directory not the component directory
|
2016-09-12 03:48:40 -04:00
|
|
|
ESPTOOLPY_SRC := $(COMPONENT_PATH)/esptool/esptool.py
|
|
|
|
ESPTOOLPY := $(PYTHON) $(ESPTOOLPY_SRC) --chip esp32
|
2016-08-17 11:08:22 -04:00
|
|
|
ESPTOOLPY_SERIAL := $(ESPTOOLPY) --port $(ESPPORT) --baud $(ESPBAUD)
|
|
|
|
|
2016-09-01 04:30:57 -04:00
|
|
|
# the no-stub argument is temporary until esptool.py fully supports compressed uploads
|
2016-09-21 03:59:16 -04:00
|
|
|
ESPTOOLPY_WRITE_FLASH=$(ESPTOOLPY_SERIAL) write_flash $(if $(CONFIG_ESPTOOLPY_COMPRESSED),-z) --flash_mode $(ESPFLASHMODE) --flash_freq $(ESPFLASHFREQ)
|
2016-08-22 06:43:47 -04:00
|
|
|
|
2016-08-18 05:11:27 -04:00
|
|
|
ESPTOOL_ALL_FLASH_ARGS += $(CONFIG_APP_OFFSET) $(APP_BIN)
|
2016-08-17 11:08:22 -04:00
|
|
|
|
2016-09-12 03:48:40 -04:00
|
|
|
$(APP_BIN): $(APP_ELF) $(ESPTOOLPY_SRC)
|
2016-09-02 00:29:01 -04:00
|
|
|
$(Q) $(ESPTOOLPY) elf2image --flash_mode $(ESPFLASHMODE) --flash_freq $(ESPFLASHFREQ) -o $@ $<
|
2016-08-17 11:08:22 -04:00
|
|
|
|
2016-09-12 03:48:40 -04:00
|
|
|
flash: all_binaries $(ESPTOOLPY_SRC)
|
2016-08-17 11:08:22 -04:00
|
|
|
@echo "Flashing project app to $(CONFIG_APP_OFFSET)..."
|
2016-08-22 06:43:47 -04:00
|
|
|
$(Q) $(ESPTOOLPY_WRITE_FLASH) $(ESPTOOL_ALL_FLASH_ARGS)
|
2016-08-17 11:08:22 -04:00
|
|
|
|
2016-09-12 03:48:40 -04:00
|
|
|
app-flash: $(APP_BIN) $(ESPTOOLPY_SRC)
|
2016-08-22 06:43:47 -04:00
|
|
|
$(Q) $(ESPTOOLPY_WRITE_FLASH) $(CONFIG_APP_OFFSET) $(APP_BIN)
|
2016-09-12 03:48:40 -04:00
|
|
|
|
|
|
|
$(eval $(call SubmoduleRequiredForFiles,$(ESPTOOLPY_SRC)))
|