37 lines
1.6 KiB
Makefile
37 lines
1.6 KiB
Makefile
# 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)
|
|
ESPFLASHMODE ?= $(CONFIG_ESPTOOLPY_FLASHMODE)
|
|
ESPFLASHFREQ ?= $(CONFIG_ESPTOOLPY_FLASHFREQ)
|
|
ESPFLASHSIZE ?= $(CONFIG_ESPTOOLPY_FLASHSIZE)
|
|
|
|
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
|
|
ESPTOOLPY_SRC := $(COMPONENT_PATH)/esptool/esptool.py
|
|
ESPTOOLPY := $(PYTHON) $(ESPTOOLPY_SRC) --chip esp32
|
|
ESPTOOLPY_SERIAL := $(ESPTOOLPY) --port $(ESPPORT) --baud $(ESPBAUD)
|
|
|
|
ESPTOOL_FLASH_OPTIONS := --flash_mode $(ESPFLASHMODE) --flash_freq $(ESPFLASHFREQ) --flash_size $(ESPFLASHSIZE)
|
|
|
|
# the no-stub argument is temporary until esptool.py fully supports compressed uploads
|
|
ESPTOOLPY_WRITE_FLASH=$(ESPTOOLPY_SERIAL) write_flash $(if $(CONFIG_ESPTOOLPY_COMPRESSED),-z) $(ESPTOOL_FLASH_OPTIONS)
|
|
|
|
ESPTOOL_ALL_FLASH_ARGS += $(CONFIG_APP_OFFSET) $(APP_BIN)
|
|
|
|
$(APP_BIN): $(APP_ELF) $(ESPTOOLPY_SRC)
|
|
$(Q) $(ESPTOOLPY) elf2image $(ESPTOOL_FLASH_OPTIONS) -o $@ $<
|
|
|
|
flash: all_binaries $(ESPTOOLPY_SRC)
|
|
@echo "Flashing binaries to serial port $(ESPPORT) (app at offset $(CONFIG_APP_OFFSET))..."
|
|
$(Q) $(ESPTOOLPY_WRITE_FLASH) $(ESPTOOL_ALL_FLASH_ARGS)
|
|
|
|
app-flash: $(APP_BIN) $(ESPTOOLPY_SRC)
|
|
@echo "Flashing app to serial port $(ESPPORT), offset $(CONFIG_APP_OFFSET)..."
|
|
$(Q) $(ESPTOOLPY_WRITE_FLASH) $(CONFIG_APP_OFFSET) $(APP_BIN)
|
|
|
|
$(eval $(call SubmoduleCheck,$(ESPTOOLPY_SRC),$(COMPONENT_PATH)/esptool))
|