From 80d4072bf4bf6de89f5b922bc4ed98045d4e3c9d Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Fri, 13 Dec 2019 08:05:04 -0600 Subject: [PATCH] boards/sim/sim/sim/src/sim_bringup.cTry to mount /dev/rammtd if CONFIG_FS_LITTLEFS is enabled. --- boards/sim/sim/sim/src/sim_bringup.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/boards/sim/sim/sim/src/sim_bringup.c b/boards/sim/sim/sim/src/sim_bringup.c index e09b7a6ee00..2a52dfccc50 100644 --- a/boards/sim/sim/sim/src/sim_bringup.c +++ b/boards/sim/sim/sim/src/sim_bringup.c @@ -202,6 +202,26 @@ int sim_bringup(void) ret); } +#elif defined(CONFIG_FS_LITTLEFS) + /* Register the MTD driver so that it can be accessed from the VFS */ + + ret = register_mtddriver("/dev/rammtd", mtd, 0755, NULL); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: Failed to register MTD driver: %d\n", + ret); + } + + /* Mount the LittleFS file system */ + + ret = mount("/dev/rammtd", "/mnt/lfs", "littlefs", 0, "autoformat"); + if (ret < 0) + { + syslog(LOG_ERR, + "ERROR: Failed to mount LittleFS at /mnt/lfs: %d\n", + ret); + } + #elif defined(CONFIG_FS_NXFFS) /* Initialize to provide NXFFS on the MTD interface */