Makefile.projbuild 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. $(PARTTOOL_PY) --partition-type data --partition-subtype ota --partition-table-file $(PARTITION_TABLE_CSV_PATH) \
  17. -q generate_blank_partition_file --output $(BLANK_OTA_DATA_FILE); \
  18. fi; )
  19. $(eval BLANK_OTA_DATA_FILE = $(shell if [ "$(OTA_DATA_OFFSET)" != "" ] && [ "$(OTA_DATA_SIZE)" != "" ]; then \
  20. echo $(BLANK_OTA_DATA_FILE); else echo " "; fi) )
  21. blank_ota_data: $(BLANK_OTA_DATA_FILE)
  22. # If there is no otadata partition, both OTA_DATA_OFFSET and BLANK_OTA_DATA_FILE
  23. # expand to empty values.
  24. ESPTOOL_ALL_FLASH_ARGS += $(OTA_DATA_OFFSET) $(BLANK_OTA_DATA_FILE)
  25. erase_otadata: $(PARTITION_TABLE_CSV_PATH) partition_table_get_info | check_python_dependencies
  26. $(OTATOOL_PY) --partition-table-file $(PARTITION_TABLE_CSV_PATH) erase_otadata
  27. read_otadata: $(PARTITION_TABLE_CSV_PATH) partition_table_get_info | check_python_dependencies
  28. $(OTATOOL_PY) --partition-table-file $(PARTITION_TABLE_CSV_PATH) read_otadata
  29. erase_ota: erase_otadata
  30. @echo "WARNING: erase_ota is deprecated. Use erase_otadata instead."
  31. all: blank_ota_data
  32. flash: blank_ota_data
  33. TMP_DEFINES := $(BUILD_DIR_BASE)/app_update/tmp_cppflags.txt
  34. export TMP_DEFINES
  35. clean:
  36. rm -f $(BLANK_OTA_DATA_FILE)
  37. rm -f $(TMP_DEFINES)