diff options
| author | 陈迎春 <[email protected]> | 2022-06-02 06:58:28 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-06-02 06:58:28 +0800 |
| commit | 59d31566114cb7ce4c4f46aef59074fcff840f10 (patch) | |
| tree | e9e80d03e0a36f481aa454f7add2c1cfc12483df | |
| parent | 1d6347796d82f58ef9c5f23b4913aa92c053a7b7 (diff) | |
[bsp/qemu-vexpress-a9] add remount operation to avoid dfs_mout fail (#6018)
| -rw-r--r-- | bsp/qemu-vexpress-a9/applications/mnt.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/bsp/qemu-vexpress-a9/applications/mnt.c b/bsp/qemu-vexpress-a9/applications/mnt.c index 524c495f2f..3eca7f06a9 100644 --- a/bsp/qemu-vexpress-a9/applications/mnt.c +++ b/bsp/qemu-vexpress-a9/applications/mnt.c @@ -10,6 +10,10 @@ #include <rtthread.h> +#define DBG_TAG "FileSystem" +#define DBG_LVL DBG_INFO +#include <rtdbg.h> + #ifdef RT_USING_DFS #include <dfs_fs.h> @@ -19,10 +23,25 @@ int mnt_init(void) if (dfs_mount("sd0", "/", "elm", 0, 0) == 0) { - rt_kprintf("file system initialization done!\n"); + LOG_I("file system initialization done!\n"); + return 0; } + else + { + LOG_W("[sd0] File System on SD ('sd0') initialization failed!"); + LOG_W("[sd0] Try to format and re-mount..."); + if (dfs_mkfs("elm", "sd0") == 0) + { + if (dfs_mount("sd0", "/", "elm", 0, 0) == 0) + { + LOG_I("[sd0] File System on SD ('sd0') initialized!"); + return 0; + } + } - return 0; + LOG_E("[sd0] File System on SD ('sd0') initialization failed!"); + return -1; + } } INIT_ENV_EXPORT(mnt_init); #endif |
