1SPIFFSGEN_PY:=$(COMPONENT_PATH)/spiffsgen.py 2SPIFFSGEN_FLASH_IN_PROJECT= 3 4ifdef CONFIG_SPIFFS_USE_MAGIC 5USE_MAGIC := "--use-magic" 6else 7USE_MAGIC := 8endif 9 10ifdef CONFIG_SPIFFS_USE_MAGIC_LENGTH 11USE_MAGIC_LEN := "--use-magic-len" 12else 13USE_MAGIC_LEN := 14endif 15 16ifdef CONFIG_SPIFFS_FOLLOW_SYMLINKS 17FOLLOW_SYMLINKS := "--follow-symlinks" 18else 19FOLLOW_SYMLINKS := 20endif 21 22# spiffs_create_partition_image 23# 24# Create a spiffs image of the specified directory on the host during build and optionally 25# have the created image flashed using `make flash` 26define spiffs_create_partition_image 27 28$(1)_bin: $(PARTITION_TABLE_BIN) $(SPIFFS_IMAGE_DEPENDS) | check_python_dependencies 29 partition_size=`$(GET_PART_INFO) \ 30 --partition-table-file $(PARTITION_TABLE_BIN) \ 31 get_partition_info --partition-name $(1) --info size`; \ 32 $(PYTHON) $(SPIFFSGEN_PY) $$$$partition_size $(2) $(BUILD_DIR_BASE)/$(1).bin \ 33 --page-size=$(CONFIG_SPIFFS_PAGE_SIZE) \ 34 --obj-name-len=$(CONFIG_SPIFFS_OBJ_NAME_LEN) \ 35 --meta-len=$(CONFIG_SPIFFS_META_LENGTH) \ 36 $(FOLLOW_SYMLINKS) \ 37 $(USE_MAGIC) \ 38 $(USE_MAGIC_LEN) 39 40all_binaries: $(1)_bin 41print_flash_cmd: $(1)_bin 42 43# Append the created binary to esptool_py args if FLASH_IN_PROJECT is set 44ifdef SPIFFS_IMAGE_FLASH_IN_PROJECT 45ifeq ($(SPIFFS_IMAGE_FLASH_IN_PROJECT),1) 46SPIFFSGEN_FLASH_IN_PROJECT += $(1) 47endif 48endif 49endef 50 51ESPTOOL_ALL_FLASH_ARGS += $(foreach partition,$(SPIFFSGEN_FLASH_IN_PROJECT), \ 52$(shell $(GET_PART_INFO) --partition-table-file $(PARTITION_TABLE_BIN) \ 53get_partition_info --partition-name $(partition) --info offset) $(BUILD_DIR_BASE)/$(partition).bin) 54