mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
boards/native: auto-init file system
This commit is contained in:
parent
ae06265de0
commit
7cc67610ce
@ -20,8 +20,58 @@
|
||||
|
||||
#ifdef MODULE_MTD
|
||||
#include "mtd_native.h"
|
||||
|
||||
mtd_native_dev_t mtd0_dev = {
|
||||
.dev = {
|
||||
.driver = &native_flash_driver,
|
||||
.sector_count = MTD_SECTOR_NUM,
|
||||
.pages_per_sector = MTD_SECTOR_SIZE / MTD_PAGE_SIZE,
|
||||
.page_size = MTD_PAGE_SIZE,
|
||||
},
|
||||
.fname = MTD_NATIVE_FILENAME,
|
||||
};
|
||||
|
||||
mtd_dev_t *mtd0 = (mtd_dev_t *)&mtd0_dev;
|
||||
#endif
|
||||
|
||||
#ifdef MODULE_VFS
|
||||
#include "vfs.h"
|
||||
|
||||
/*
|
||||
* On `native` we define auto-mounts for every file system.
|
||||
*
|
||||
* A 'real' board would typically always use the same file system to avoid
|
||||
* data loss when re-formatting, but since `native` is for testing only we
|
||||
* provide all file system definitions here.
|
||||
*/
|
||||
|
||||
/* littlefs support */
|
||||
#if defined(MODULE_LITTLEFS)
|
||||
|
||||
#include "fs/littlefs_fs.h"
|
||||
VFS_AUTO_MOUNT(littlefs, VFS_MTD(mtd0_dev), "/", 0);
|
||||
|
||||
/* littlefs2 support */
|
||||
#elif defined(MODULE_LITTLEFS2)
|
||||
|
||||
#include "fs/littlefs2_fs.h"
|
||||
VFS_AUTO_MOUNT(littlefs2, VFS_MTD(mtd0_dev), "/", 0);
|
||||
|
||||
/* spiffs support */
|
||||
#elif defined(MODULE_SPIFFS)
|
||||
|
||||
#include "fs/spiffs_fs.h"
|
||||
VFS_AUTO_MOUNT(spiffs, VFS_MTD(mtd0_dev), "/", 0);
|
||||
|
||||
/* FAT support */
|
||||
#elif defined(MODULE_FATFS_VFS)
|
||||
|
||||
#include "fs/fatfs.h"
|
||||
VFS_AUTO_MOUNT(fatfs, VFS_MTD(mtd0_dev), "/", 0);
|
||||
|
||||
#endif
|
||||
#endif /* MODULE_VFS */
|
||||
|
||||
/**
|
||||
* Nothing to initialize at the moment.
|
||||
* Turns the red LED on and the green LED off.
|
||||
@ -33,17 +83,3 @@ void board_init(void)
|
||||
|
||||
puts("RIOT native board initialized.");
|
||||
}
|
||||
|
||||
#ifdef MODULE_MTD
|
||||
static mtd_native_dev_t mtd0_dev = {
|
||||
.dev = {
|
||||
.driver = &native_flash_driver,
|
||||
.sector_count = MTD_SECTOR_NUM,
|
||||
.pages_per_sector = MTD_SECTOR_SIZE / MTD_PAGE_SIZE,
|
||||
.page_size = MTD_PAGE_SIZE,
|
||||
},
|
||||
.fname = MTD_NATIVE_FILENAME,
|
||||
};
|
||||
|
||||
mtd_dev_t *mtd0 = (mtd_dev_t *)&mtd0_dev;
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user