mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-17 02:23:49 +01:00
Merge pull request #17643 from benpicco/vfs_default
sys/vfs: add vfs_default, configure default fs for same54-xpro
This commit is contained in:
commit
78e4f6b557
@ -14,4 +14,10 @@ ifneq (,$(filter periph_can,$(FEATURES_USED)))
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# default to using littlefs2 on the virtual flash
|
||||||
|
ifneq (,$(filter vfs_default,$(USEMODULE)))
|
||||||
|
USEPKG += littlefs2
|
||||||
|
USEMODULE += mtd
|
||||||
|
endif
|
||||||
|
|
||||||
USEMODULE += native_drivers
|
USEMODULE += native_drivers
|
||||||
|
|||||||
@ -49,25 +49,25 @@ mtd_dev_t *mtd0 = &mtd0_dev.base;
|
|||||||
#if defined(MODULE_LITTLEFS)
|
#if defined(MODULE_LITTLEFS)
|
||||||
|
|
||||||
#include "fs/littlefs_fs.h"
|
#include "fs/littlefs_fs.h"
|
||||||
VFS_AUTO_MOUNT(littlefs, VFS_MTD(mtd0_dev), "/", 0);
|
VFS_AUTO_MOUNT(littlefs, VFS_MTD(mtd0_dev), "/nvm", 0);
|
||||||
|
|
||||||
/* littlefs2 support */
|
/* littlefs2 support */
|
||||||
#elif defined(MODULE_LITTLEFS2)
|
#elif defined(MODULE_LITTLEFS2)
|
||||||
|
|
||||||
#include "fs/littlefs2_fs.h"
|
#include "fs/littlefs2_fs.h"
|
||||||
VFS_AUTO_MOUNT(littlefs2, VFS_MTD(mtd0_dev), "/", 0);
|
VFS_AUTO_MOUNT(littlefs2, VFS_MTD(mtd0_dev), "/nvm", 0);
|
||||||
|
|
||||||
/* spiffs support */
|
/* spiffs support */
|
||||||
#elif defined(MODULE_SPIFFS)
|
#elif defined(MODULE_SPIFFS)
|
||||||
|
|
||||||
#include "fs/spiffs_fs.h"
|
#include "fs/spiffs_fs.h"
|
||||||
VFS_AUTO_MOUNT(spiffs, VFS_MTD(mtd0_dev), "/", 0);
|
VFS_AUTO_MOUNT(spiffs, VFS_MTD(mtd0_dev), "/nvm", 0);
|
||||||
|
|
||||||
/* FAT support */
|
/* FAT support */
|
||||||
#elif defined(MODULE_FATFS_VFS)
|
#elif defined(MODULE_FATFS_VFS)
|
||||||
|
|
||||||
#include "fs/fatfs.h"
|
#include "fs/fatfs.h"
|
||||||
VFS_AUTO_MOUNT(fatfs, VFS_MTD(mtd0_dev), "/", 0);
|
VFS_AUTO_MOUNT(fatfs, VFS_MTD(mtd0_dev), "/nvm", 0);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif /* MODULE_VFS */
|
#endif /* MODULE_VFS */
|
||||||
|
|||||||
@ -16,3 +16,9 @@ endif
|
|||||||
ifneq (,$(filter netdev_default,$(USEMODULE)))
|
ifneq (,$(filter netdev_default,$(USEMODULE)))
|
||||||
USEMODULE += sam0_eth
|
USEMODULE += sam0_eth
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# default to using littlefs2 on the external flash
|
||||||
|
ifneq (,$(filter vfs_default,$(USEMODULE)))
|
||||||
|
USEPKG += littlefs2
|
||||||
|
USEMODULE += mtd
|
||||||
|
endif
|
||||||
|
|||||||
@ -61,6 +61,11 @@ static mtd_at24cxxx_t at24mac_dev = {
|
|||||||
.params = at24cxxx_params,
|
.params = at24cxxx_params,
|
||||||
};
|
};
|
||||||
mtd_dev_t *mtd1 = (mtd_dev_t *)&at24mac_dev;
|
mtd_dev_t *mtd1 = (mtd_dev_t *)&at24mac_dev;
|
||||||
|
|
||||||
|
#ifdef MODULE_VFS_DEFAULT
|
||||||
|
#include "fs/littlefs2_fs.h"
|
||||||
|
VFS_AUTO_MOUNT(littlefs2, VFS_MTD(same54_nor_dev), "/nvm", 0);
|
||||||
|
#endif
|
||||||
#endif /* MODULE_MTD */
|
#endif /* MODULE_MTD */
|
||||||
|
|
||||||
void board_init(void)
|
void board_init(void)
|
||||||
|
|||||||
@ -30,8 +30,6 @@ USEMODULE += mtd
|
|||||||
|
|
||||||
# Use VFS
|
# Use VFS
|
||||||
USEMODULE += vfs
|
USEMODULE += vfs
|
||||||
# the example demonstrates manual file system mounting, disable auto-mount
|
|
||||||
DISABLE_MODULE += vfs_auto_mount
|
|
||||||
|
|
||||||
# Use a file system
|
# Use a file system
|
||||||
# USEMODULE += littlefs
|
# USEMODULE += littlefs
|
||||||
|
|||||||
@ -217,8 +217,39 @@ PSEUDOMODULES += suit_transport_%
|
|||||||
PSEUDOMODULES += suit_storage_%
|
PSEUDOMODULES += suit_storage_%
|
||||||
PSEUDOMODULES += sys_bus_%
|
PSEUDOMODULES += sys_bus_%
|
||||||
PSEUDOMODULES += vdd_lc_filter_%
|
PSEUDOMODULES += vdd_lc_filter_%
|
||||||
|
## @defgroup pseudomodule_vfs_auto_format vfs_auto_format
|
||||||
|
## @brief Format mount points at startup unless they can be mounted
|
||||||
|
##
|
||||||
|
## When this module is active, mount points configured through the @ref
|
||||||
|
## pseudomodule_vfs_auto_mount module that can not be mounted at startup are
|
||||||
|
## formatted and, if that operation is successful, attempted to mount again.
|
||||||
|
##
|
||||||
|
## Beware that this may be a harmful procedure in case a bug that corrupts a
|
||||||
|
## filesystem coincides with a bug that sends the device into a reboot loop.
|
||||||
PSEUDOMODULES += vfs_auto_format
|
PSEUDOMODULES += vfs_auto_format
|
||||||
|
|
||||||
|
## @defgroup pseudomodule_vfs_auto_mount vfs_auto_mount
|
||||||
|
## @brief Mount file systems at startup
|
||||||
|
##
|
||||||
|
## When this module is active, mount points specified through
|
||||||
|
## @ref VFS_AUTO_MOUNT are mounted at their designated mount points at startup.
|
||||||
|
## These mount points can be specified by the application, or are provided by
|
||||||
|
## some boards if the @ref pseudomodule_vfs_default module is active.
|
||||||
PSEUDOMODULES += vfs_auto_mount
|
PSEUDOMODULES += vfs_auto_mount
|
||||||
|
|
||||||
|
## @defgroup pseudomodule_vfs_default vfs_default
|
||||||
|
## @brief Enable default assignments of a board's devices to VFS mount points
|
||||||
|
##
|
||||||
|
## When this module is active, boards with additional flash storage will
|
||||||
|
## automatically mount (and possibly format, if @ref
|
||||||
|
## pseudomodule_vfs_auto_format is enabled) their flash devices with a file
|
||||||
|
## system that is common for that board (or at least common for this board
|
||||||
|
## within RIOT).
|
||||||
|
##
|
||||||
|
## Boards will generally mount to `/nvm` unless they have several storage
|
||||||
|
## backends.
|
||||||
|
PSEUDOMODULES += vfs_default
|
||||||
|
|
||||||
PSEUDOMODULES += wakaama_objects_%
|
PSEUDOMODULES += wakaama_objects_%
|
||||||
PSEUDOMODULES += wifi_enterprise
|
PSEUDOMODULES += wifi_enterprise
|
||||||
PSEUDOMODULES += xtimer_on_ztimer
|
PSEUDOMODULES += xtimer_on_ztimer
|
||||||
|
|||||||
@ -491,12 +491,16 @@ ifneq (,$(filter devfs,$(USEMODULE)))
|
|||||||
USEMODULE += vfs
|
USEMODULE += vfs
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifneq (,$(filter vfs_default,$(USEMODULE)))
|
||||||
|
USEMODULE += vfs
|
||||||
|
DEFAULT_MODULE += vfs_auto_mount
|
||||||
|
endif
|
||||||
|
|
||||||
ifneq (,$(filter vfs,$(USEMODULE)))
|
ifneq (,$(filter vfs,$(USEMODULE)))
|
||||||
USEMODULE += posix_headers
|
USEMODULE += posix_headers
|
||||||
ifeq (native, $(BOARD))
|
ifeq (native, $(BOARD))
|
||||||
USEMODULE += native_vfs
|
USEMODULE += native_vfs
|
||||||
endif
|
endif
|
||||||
DEFAULT_MODULE += vfs_auto_mount
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq (,$(filter sock_async_event,$(USEMODULE)))
|
ifneq (,$(filter sock_async_event,$(USEMODULE)))
|
||||||
|
|||||||
@ -10,10 +10,14 @@ config MODULE_VFS
|
|||||||
depends on TEST_KCONFIG
|
depends on TEST_KCONFIG
|
||||||
select MODULE_POSIX_HEADERS
|
select MODULE_POSIX_HEADERS
|
||||||
|
|
||||||
|
config MODULE_VFS_DEFAULT
|
||||||
|
bool "Use default (board specific) file systems and mount points"
|
||||||
|
depends on MODULE_VFS
|
||||||
|
imply MODULE_VFS_AUTO_MOUNT
|
||||||
|
|
||||||
config MODULE_VFS_AUTO_MOUNT
|
config MODULE_VFS_AUTO_MOUNT
|
||||||
bool "Automatically mount configured file systems"
|
bool "Automatically mount configured file systems"
|
||||||
depends on MODULE_VFS
|
depends on MODULE_VFS
|
||||||
default y
|
|
||||||
|
|
||||||
config MODULE_VFS_AUTO_FORMAT
|
config MODULE_VFS_AUTO_FORMAT
|
||||||
bool "Automatically format configured file systems if mount fails"
|
bool "Automatically format configured file systems if mount fails"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user