Ubiquitous/RT_Thread/:add romfs file system ,including SD and FLASH directory

This commit is contained in:
chunyexixiaoyu 2021-12-14 11:05:35 +08:00
parent 6816dc023a
commit d71c5fcd2f
2 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,20 @@
#include <rtthread.h>
#if defined RT_USING_DFS && defined RT_USING_DFS_ROMFS
#include <dfs_fs.h>
#include "dfs_romfs.h"
int mnt_init(void)
{
if (dfs_mount(RT_NULL, "/", "rom", 0, &(romfs_root)) == 0)
{
rt_kprintf("ROM file system initializated!\n");
}
else
{
rt_kprintf("ROM file system initializate failed!\n");
}
return 0;
}
INIT_ENV_EXPORT(mnt_init);
#endif

View File

@ -0,0 +1,13 @@
/* Generated by mkromfs. Edit with caution. */
#include <rtthread.h>
#include <dfs_romfs.h>
#ifdef RT_USING_DFS_ROMFS
static const struct romfs_dirent _romfs_root[] = {
{ROMFS_DIRENT_DIR, "FLASH", RT_NULL, 0},
{ROMFS_DIRENT_DIR, "SD", RT_NULL, 0}
};
const struct romfs_dirent romfs_root = {
ROMFS_DIRENT_DIR, "/", (rt_uint8_t *)_romfs_root, sizeof(_romfs_root)/sizeof(_romfs_root[0])
};
#endif