Create SPIFFS image and flash it.

mkspiffs is added to create SPIFFS image from directory with files.
Build process changed to flash SPIFFS image if necessary
This commit is contained in:
sheinz 2016-07-10 01:33:23 +03:00
parent 5c12b7c7e9
commit d25b8b2a55
7 changed files with 352 additions and 1 deletions

View file

@ -0,0 +1,37 @@
# Check if SPIFFS_SIZE defined only if not cleaning
ifneq ($(MAKECMDGOALS),clean)
ifndef SPIFFS_SIZE
define ERROR_MSG
Variable SPIFFS_SIZE is not defined.
Cannot build mkspiffs without SPIFFS_SIZE.
Please specify it in your application Makefile.
endef
$(error $(ERROR_MSG))
endif
endif
SOURCES := spiffs_hydrogen.c
SOURCES += spiffs_cache.c
SOURCES += spiffs_gc.c
SOURCES += spiffs_check.c
SOURCES += spiffs_nucleus.c
SOURCES += mkspiffs.c
OBJECTS := $(SOURCES:.c=.o)
VPATH = ../spiffs/src
CFLAGS += -I..
CFLAGS += -DSPIFFS_BASE_ADDR=0 # for image base addr is start of the image
CFLAGS += -DSPIFFS_SIZE=$(SPIFFS_SIZE)
all: mkspiffs
mkspiffs: $(OBJECTS)
clean:
@rm -f mkspiffs
@rm -f *.o
.PHONY: all clean