Makefile.projbuild 1.5 KB

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