2018-06-25 06:53:10 +00:00
|
|
|
# Generate partition binary
|
|
|
|
#
|
2018-11-15 21:01:41 +00:00
|
|
|
.PHONY: blank_ota_data erase_otadata read_otadata
|
2018-06-25 06:53:10 +00:00
|
|
|
|
2018-11-15 21:01:41 +00:00
|
|
|
OTATOOL_PY := $(PYTHON) $(COMPONENT_PATH)/otatool.py
|
|
|
|
PARTTOOL_PY := $(PYTHON) $(IDF_PATH)/components/partition_table/parttool.py
|
2018-08-22 08:51:36 +00:00
|
|
|
|
2018-11-15 21:01:41 +00:00
|
|
|
# Generate blank partition file
|
|
|
|
BLANK_OTA_DATA_FILE = $(BUILD_DIR_BASE)/ota_data_initial.bin
|
2018-08-22 08:51:36 +00:00
|
|
|
|
2019-03-27 13:02:55 +00:00
|
|
|
# Copy PARTITION_TABLE_CSV_PATH definition here from $IDF_PATH/components/partition_table/Makefile.projbuild
|
|
|
|
# to avoid undefined variables warning for PARTITION_TABLE_CSV_PATH
|
|
|
|
ifndef PARTITION_TABLE_CSV_PATH
|
|
|
|
PARTITION_TABLE_ROOT := $(call dequote,$(if $(CONFIG_PARTITION_TABLE_CUSTOM),$(PROJECT_PATH),$(IDF_PATH)/components/partition_table))
|
|
|
|
PARTITION_TABLE_CSV_PATH := $(call dequote,$(abspath $(PARTITION_TABLE_ROOT)/$(call dequote,$(CONFIG_PARTITION_TABLE_FILENAME))))
|
|
|
|
endif
|
|
|
|
|
|
|
|
$(BLANK_OTA_DATA_FILE): partition_table_get_info $(PARTITION_TABLE_CSV_PATH) | check_python_dependencies
|
2018-12-03 10:11:13 +00:00
|
|
|
$(shell if [ "$(OTA_DATA_OFFSET)" != "" ] && [ "$(OTA_DATA_SIZE)" != "" ]; then \
|
2019-05-27 03:08:28 +00:00
|
|
|
$(PYTHON) $(IDF_PATH)/components/partition_table/gen_empty_partition.py $(OTA_DATA_SIZE) $(BLANK_OTA_DATA_FILE); \
|
2018-11-15 21:01:41 +00:00
|
|
|
fi; )
|
2018-12-03 10:11:13 +00:00
|
|
|
$(eval BLANK_OTA_DATA_FILE = $(shell if [ "$(OTA_DATA_OFFSET)" != "" ] && [ "$(OTA_DATA_SIZE)" != "" ]; then \
|
2018-11-15 21:01:41 +00:00
|
|
|
echo $(BLANK_OTA_DATA_FILE); else echo " "; fi) )
|
2018-08-22 08:51:36 +00:00
|
|
|
|
2018-11-15 21:01:41 +00:00
|
|
|
blank_ota_data: $(BLANK_OTA_DATA_FILE)
|
2018-08-22 08:51:36 +00:00
|
|
|
|
2018-06-25 06:53:10 +00:00
|
|
|
# If there is no otadata partition, both OTA_DATA_OFFSET and BLANK_OTA_DATA_FILE
|
|
|
|
# expand to empty values.
|
|
|
|
ESPTOOL_ALL_FLASH_ARGS += $(OTA_DATA_OFFSET) $(BLANK_OTA_DATA_FILE)
|
|
|
|
|
2019-03-28 06:08:32 +00:00
|
|
|
ESPTOOL_ARGS := --esptool-args port=$(CONFIG_ESPTOOLPY_PORT) baud=$(CONFIG_ESPTOOLPY_BAUD) before=$(CONFIG_ESPTOOLPY_BEFORE) after=$(CONFIG_ESPTOOLPY_AFTER)
|
|
|
|
|
2019-03-27 13:02:55 +00:00
|
|
|
erase_otadata: $(PARTITION_TABLE_CSV_PATH) partition_table_get_info | check_python_dependencies
|
2019-03-28 06:08:32 +00:00
|
|
|
$(OTATOOL_PY) $(ESPTOOL_ARGS) --partition-table-file $(PARTITION_TABLE_CSV_PATH) \
|
2019-06-04 07:49:55 +00:00
|
|
|
--partition-table-offset $(PARTITION_TABLE_OFFSET) \
|
|
|
|
erase_otadata
|
2018-08-22 08:51:36 +00:00
|
|
|
|
2019-03-27 13:02:55 +00:00
|
|
|
read_otadata: $(PARTITION_TABLE_CSV_PATH) partition_table_get_info | check_python_dependencies
|
2019-03-28 06:08:32 +00:00
|
|
|
$(OTATOOL_PY) $(ESPTOOL_ARGS) --partition-table-file $(PARTITION_TABLE_CSV_PATH) \
|
2019-06-04 07:49:55 +00:00
|
|
|
--partition-table-offset $(partition_table_offset) \
|
|
|
|
read_otadata
|
2018-06-25 06:53:10 +00:00
|
|
|
|
2018-11-15 21:01:41 +00:00
|
|
|
erase_ota: erase_otadata
|
|
|
|
@echo "WARNING: erase_ota is deprecated. Use erase_otadata instead."
|
2018-06-25 06:53:10 +00:00
|
|
|
|
|
|
|
all: blank_ota_data
|
|
|
|
flash: blank_ota_data
|
2019-01-21 14:14:56 +00:00
|
|
|
ifdef CONFIG_SECURE_FLASH_ENCRYPTION_MODE_DEVELOPMENT
|
|
|
|
encrypted-flash: blank_ota_data
|
|
|
|
endif
|
2018-06-25 06:53:10 +00:00
|
|
|
|
2018-10-05 12:29:07 +00:00
|
|
|
TMP_DEFINES := $(BUILD_DIR_BASE)/app_update/tmp_cppflags.txt
|
|
|
|
export TMP_DEFINES
|
|
|
|
|
2018-06-25 06:53:10 +00:00
|
|
|
clean:
|
2018-10-05 12:29:07 +00:00
|
|
|
rm -f $(BLANK_OTA_DATA_FILE)
|
|
|
|
rm -f $(TMP_DEFINES)
|