Skip to content

Commit

Permalink
Merge pull request #5625 from OTAkeys/pr/spiffs
Browse files Browse the repository at this point in the history
pkg: add SPIFFS support
  • Loading branch information
Joakim Nohlgård authored Mar 31, 2017
2 parents a5ef3d6 + 4cb3232 commit f4dd0a3
Show file tree
Hide file tree
Showing 15 changed files with 1,620 additions and 11 deletions.
7 changes: 7 additions & 0 deletions Makefile.dep
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,13 @@ ifneq (,$(filter sock_dns,$(USEMODULE)))
USEMODULE += sock_util
endif

ifneq (,$(filter spiffs,$(USEMODULE)))
USEPKG += spiffs
USEMODULE += vfs
USEMODULE += spiffs_fs
USEMODULE += mtd
endif

# include package dependencies
-include $(USEPKG:%=$(RIOTPKG)/%/Makefile.dep)

Expand Down
25 changes: 25 additions & 0 deletions boards/native/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,31 @@ void _native_LED_RED_TOGGLE(void);
extern mtd_dev_t *mtd0;
#endif

#ifdef MODULE_SPIFFS
#define SPIFFS_READ_ONLY 0
#define SPIFFS_SINGLETON 0

#define SPIFFS_HAL_CALLBACK_EXTRA 1

#define SPIFFS_CACHE 1

#if SPIFFS_SINGLETON == 1
#define SPIFFS_CFG_PHYS_SZ(ignore) (0x800000)

#define SPIFFS_CFG_PHYS_ERASE_SZ(ignore) (4096)

#define SPIFFS_CFG_PHYS_ADDR(ignore) (0)

#define SPIFFS_CFG_LOG_PAGE_SZ(ignore) (256)

#define SPIFFS_CFG_LOG_BLOCK_SZ(ignore) (4096)
#endif

#if SPIFFS_HAL_CALLBACK_EXTRA == 0
#define SPIFFS_MTD_DEV (MTD_0)
#endif
#endif

#ifdef __cplusplus
}
#endif
Expand Down
19 changes: 19 additions & 0 deletions pkg/spiffs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
PKG_NAME=spiffs
PKG_URL=https://github.com/pellepl/spiffs.git
PKG_VERSION=39937743fbbec4b82308ee08332bf9180408d23b
PKG_BUILDDIR ?= $(PKGDIRBASE)/$(PKG_NAME)

CFLAGS += -std=c11

.PHONY: all

all: git-download
@mkdir -p "$(PKG_BUILDDIR)/riotbuild"
@cp $(PKG_BUILDDIR)/src/*.c $(PKG_BUILDDIR)/src/*.h $(PKG_BUILDDIR)/riotbuild

@echo 'MODULE:=spiffs' > $(PKG_BUILDDIR)/riotbuild/Makefile
@echo 'include $$(RIOTBASE)/Makefile.base' >> $(PKG_BUILDDIR)/riotbuild/Makefile

"$(MAKE)" -C $(PKG_BUILDDIR)/riotbuild

include $(RIOTBASE)/pkg/pkg.mk
6 changes: 6 additions & 0 deletions pkg/spiffs/Makefile.include
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
INCLUDES += -I$(RIOTPKG)/spiffs/include
INCLUDES += -I$(PKGDIRBASE)/spiffs/riotbuild/

ifneq (,$(filter spiffs_fs,$(USEMODULE)))
DIRS += $(RIOTBASE)/pkg/spiffs/fs
endif
3 changes: 3 additions & 0 deletions pkg/spiffs/fs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
MODULE := spiffs_fs

include $(RIOTBASE)/Makefile.base
Loading

0 comments on commit f4dd0a3

Please sign in to comment.