Makefile.projbuild 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. # Generate partition binary
  2. #
  3. .PHONY: blank_ota_data erase_otadata read_otadata
  4. OTATOOL_PY := $(PYTHON) $(COMPONENT_PATH)/otatool.py
  5. PARTTOOL_PY := $(PYTHON) $(IDF_PATH)/components/partition_table/parttool.py
  6. # Generate blank partition file
  7. BLANK_OTA_DATA_FILE = $(BUILD_DIR_BASE)/ota_data_initial.bin
  8. # Copy PARTITION_TABLE_CSV_PATH definition here from $IDF_PATH/components/partition_table/Makefile.projbuild
  9. # to avoid undefined variables warning for PARTITION_TABLE_CSV_PATH
  10. ifndef PARTITION_TABLE_CSV_PATH
  11. PARTITION_TABLE_ROOT := $(call dequote,$(if $(CONFIG_PARTITION_TABLE_CUSTOM),$(PROJECT_PATH),$(IDF_PATH)/components/partition_table))
  12. PARTITION_TABLE_CSV_PATH := $(call dequote,$(abspath $(PARTITION_TABLE_ROOT)/$(call dequote,$(CONFIG_PARTITION_TABLE_FILENAME))))
  13. endif
  14. $(BLANK_OTA_DATA_FILE): partition_table_get_info $(PARTITION_TABLE_CSV_PATH) | check_python_dependencies
  15. $(shell if [ "$(OTA_DATA_OFFSET)" != "" ] && [ "$(OTA_DATA_SIZE)" != "" ]; then \
  16. $(PYTHON) $(IDF_PATH)/components/partition_table/gen_empty_partition.py $(OTA_DATA_SIZE) $(BLANK_OTA_DATA_FILE); \
  17. fi; )
  18. $(eval BLANK_OTA_DATA_FILE = $(shell if [ "$(OTA_DATA_OFFSET)" != "" ] && [ "$(OTA_DATA_SIZE)" != "" ]; then \
  19. echo $(BLANK_OTA_DATA_FILE); else echo " "; fi) )
  20. blank_ota_data: $(BLANK_OTA_DATA_FILE)
  21. # If there is no otadata partition, both OTA_DATA_OFFSET and BLANK_OTA_DATA_FILE
  22. # expand to empty values.
  23. ESPTOOL_ALL_FLASH_ARGS += $(OTA_DATA_OFFSET) $(BLANK_OTA_DATA_FILE)
  24. ESPTOOL_ARGS := --esptool-args port=$(CONFIG_ESPTOOLPY_PORT) baud=$(CONFIG_ESPTOOLPY_BAUD) before=$(CONFIG_ESPTOOLPY_BEFORE) after=$(CONFIG_ESPTOOLPY_AFTER)
  25. erase_otadata: $(PARTITION_TABLE_CSV_PATH) partition_table_get_info | check_python_dependencies
  26. $(OTATOOL_PY) $(ESPTOOL_ARGS) --partition-table-file $(PARTITION_TABLE_CSV_PATH) \
  27. --partition-table-offset $(PARTITION_TABLE_OFFSET) \
  28. erase_otadata
  29. read_otadata: $(PARTITION_TABLE_CSV_PATH) partition_table_get_info | check_python_dependencies
  30. $(OTATOOL_PY) $(ESPTOOL_ARGS) --partition-table-file $(PARTITION_TABLE_CSV_PATH) \
  31. --partition-table-offset $(partition_table_offset) \
  32. read_otadata
  33. all: blank_ota_data
  34. flash: blank_ota_data
  35. ifdef CONFIG_SECURE_FLASH_ENCRYPTION_MODE_DEVELOPMENT
  36. encrypted-flash: blank_ota_data
  37. endif
  38. TMP_DEFINES := $(BUILD_DIR_BASE)/app_update/tmp_cppflags.txt
  39. export TMP_DEFINES
  40. clean:
  41. rm -f $(BLANK_OTA_DATA_FILE)
  42. rm -f $(TMP_DEFINES)