2019-01-22 08:14:47 +00:00
|
|
|
SPIFFSGEN_PY:=$(COMPONENT_PATH)/spiffsgen.py
|
|
|
|
SPIFFSGEN_FLASH_IN_PROJECT=
|
|
|
|
|
|
|
|
ifdef CONFIG_SPIFFS_USE_MAGIC
|
|
|
|
USE_MAGIC = "--use-magic"
|
|
|
|
else
|
|
|
|
USE_MAGIC = ""
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef CONFIG_SPIFFS_USE_MAGIC_LENGTH
|
|
|
|
USE_MAGIC_LEN = "--use-magic-len"
|
|
|
|
else
|
|
|
|
USE_MAGIC_LEN = ""
|
|
|
|
endif
|
|
|
|
|
2019-07-14 14:45:35 +00:00
|
|
|
ifdef CONFIG_SPIFFS_FOLLOW_SYMLINKS
|
|
|
|
FOLLOW_SYMLINKS = "--follow-symlinks"
|
|
|
|
else
|
|
|
|
FOLLOW_SYMLINKS = ""
|
|
|
|
endif
|
|
|
|
|
2019-01-22 08:14:47 +00:00
|
|
|
# spiffs_create_partition_image
|
|
|
|
#
|
|
|
|
# Create a spiffs image of the specified directory on the host during build and optionally
|
|
|
|
# have the created image flashed using `make flash`
|
|
|
|
define spiffs_create_partition_image
|
|
|
|
|
2019-06-21 02:58:00 +00:00
|
|
|
$(1)_bin: $(PARTITION_TABLE_BIN) $(SPIFFS_IMAGE_DEPENDS) | check_python_dependencies
|
2019-05-27 03:07:54 +00:00
|
|
|
partition_size=`$(GET_PART_INFO) \
|
2019-01-22 08:14:47 +00:00
|
|
|
--partition-table-file $(PARTITION_TABLE_BIN) \
|
2019-05-27 03:07:54 +00:00
|
|
|
get_partition_info --partition-name $(1) --info size`; \
|
2019-01-22 08:14:47 +00:00
|
|
|
$(PYTHON) $(SPIFFSGEN_PY) $$$$partition_size $(2) $(BUILD_DIR_BASE)/$(1).bin \
|
|
|
|
--page-size=$(CONFIG_SPIFFS_PAGE_SIZE) \
|
|
|
|
--obj-name-len=$(CONFIG_SPIFFS_OBJ_NAME_LEN) \
|
|
|
|
--meta-len=$(CONFIG_SPIFFS_META_LENGTH) \
|
2019-07-14 14:45:35 +00:00
|
|
|
$(FOLLOW_SYMLINKS) \
|
2019-01-22 08:14:47 +00:00
|
|
|
$(USE_MAGIC) \
|
|
|
|
$(USE_MAGIC_LEN)
|
|
|
|
|
|
|
|
all_binaries: $(1)_bin
|
|
|
|
print_flash_cmd: $(1)_bin
|
|
|
|
|
|
|
|
# Append the created binary to esptool_py args if FLASH_IN_PROJECT is set
|
2019-06-21 02:58:00 +00:00
|
|
|
ifdef SPIFFS_IMAGE_FLASH_IN_PROJECT
|
|
|
|
ifeq ($(SPIFFS_IMAGE_FLASH_IN_PROJECT),1)
|
2019-01-22 08:14:47 +00:00
|
|
|
SPIFFSGEN_FLASH_IN_PROJECT += $(1)
|
|
|
|
endif
|
2019-06-21 02:58:00 +00:00
|
|
|
endif
|
2019-01-22 08:14:47 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
ESPTOOL_ALL_FLASH_ARGS += $(foreach partition,$(SPIFFSGEN_FLASH_IN_PROJECT), \
|
2019-05-27 03:07:54 +00:00
|
|
|
$(shell $(GET_PART_INFO) --partition-table-file $(PARTITION_TABLE_BIN) \
|
2019-07-14 14:45:35 +00:00
|
|
|
get_partition_info --partition-name $(partition) --info offset) $(BUILD_DIR_BASE)/$(partition).bin)
|