diff --git a/cpu/esp_common/Makefile.dep b/cpu/esp_common/Makefile.dep index 567412fdce..021d0ebda9 100644 --- a/cpu/esp_common/Makefile.dep +++ b/cpu/esp_common/Makefile.dep @@ -66,6 +66,11 @@ ifneq (,$(filter 4 5,$(LOG_LEVEL))) USEMODULE += esp_log_startup endif +# default to using littlefs2 on the SPI flash +ifneq (,$(filter vfs_default,$(USEMODULE))) + USEMODULE += littlefs2 +endif + # each device has SPI flash memory, but it has to be enabled explicitly ifneq (,$(filter esp_spiffs,$(USEMODULE))) USEMODULE += spiffs diff --git a/cpu/esp_common/periph/flash.c b/cpu/esp_common/periph/flash.c index ff1851692f..2a648b1a5b 100644 --- a/cpu/esp_common/periph/flash.c +++ b/cpu/esp_common/periph/flash.c @@ -63,6 +63,11 @@ mtd_dev_t* mtd0 = 0; static mtd_dev_t _flash_dev; static mtd_desc_t _flash_driver; +#ifdef MODULE_VFS_DEFAULT +#include "vfs_default.h" +VFS_AUTO_MOUNT(littlefs2, { .dev = &_flash_dev }, VFS_DEFAULT_NVM(0), 0); +#endif + #ifdef MCU_ESP8266 /* for source code compatibility with ESP32 SDK */