diff --git a/bsp/stm3210/project_filesystem/application.c b/bsp/stm3210/project_filesystem/application.c index 9258aa0449454fa082f04001b174166c34f066b9..698f4a9bf0b0a2d768685671ec59e60fd942b028 100644 --- a/bsp/stm3210/project_filesystem/application.c +++ b/bsp/stm3210/project_filesystem/application.c @@ -24,67 +24,38 @@ #include /* dfs filesystem:EFS filesystem init */ #include +/* dfs filesystem:ELM FatFs filesystem init */ +#include /* dfs Filesystem APIs */ #include #endif -/* filesystem test */ -#include -static char fullpath[256 + 1]; -void ls_root() -{ - DIR *dir; - - dir = opendir("/"); - if (dir != RT_NULL) - { - struct dfs_dirent* dirent; - struct dfs_stat s; - - do - { - dirent = readdir(dir); - if (dirent == RT_NULL) break; - rt_memset(&s, 0, sizeof(struct dfs_stat)); - - /* build full path for each file */ - rt_sprintf(fullpath, "/%s", dirent->d_name); - - stat(fullpath, &s); - if ( s.st_mode & DFS_S_IFDIR ) - { - rt_kprintf("%s\t\t\n", dirent->d_name); - } - else - { - rt_kprintf("%s\t\t%lu\n", dirent->d_name, s.st_size); - } - } while (dirent != RT_NULL); - - closedir(dir); - } - else rt_kprintf("open root directory failed\n"); -} - void rt_init_thread_entry(void* parameter) { /* Filesystem Initialization */ #ifdef RT_USING_DFS { - /* init the device filesystem */ - dfs_init(); - /* init the efsl filesystam*/ - efsl_init(); - - /* mount sd card fat partition 1 as root directory */ - if (dfs_mount("sd0", "/", "efs", 0, 0) == 0) - { - rt_kprintf("File System initialized!\n"); - ls_root(); - } - else - rt_kprintf("File System init failed!\n"); - + /* init the device filesystem */ + dfs_init(); +#ifdef RT_USING_DFS_EFSL + /* init the efsl filesystam*/ + efsl_init(); + + /* mount sd card fat partition 1 as root directory */ + if (dfs_mount("sd0", "/", "efs", 0, 0) == 0) + rt_kprintf("File System initialized!\n"); + else + rt_kprintf("File System init failed!\n"); +#elif defined(RT_USING_DFS_ELMFAT) + /* init the elm FAT filesystam*/ + elm_init(); + + /* mount sd card fat partition 1 as root directory */ + if (dfs_mount("sd0", "/", "elm", 0, 0) == 0) + rt_kprintf("File System initialized!\n"); + else + rt_kprintf("File System init failed!\n"); +#endif } #endif } diff --git a/bsp/stm3210/project_filesystem/project.Uv2 b/bsp/stm3210/project_filesystem/project.Uv2 index d786e7e14d0f95479a0d0989cb146242339976d4..668dc9e6f13dd5379a48c2d043c06e37060322d9 100644 --- a/bsp/stm3210/project_filesystem/project.Uv2 +++ b/bsp/stm3210/project_filesystem/project.Uv2 @@ -66,22 +66,12 @@ File 5,2,<..\..\libcpu\arm\stm32\fault_rvds.S> File 5,2,<..\..\libcpu\arm\stm32\start_rvds.s> File 5,1,<..\..\libcpu\arm\stm32\serial.c> File 6,1,<..\..\filesystem\dfs\src\dfs_util.c> -File 6,1,<..\..\filesystem\dfs\src\dfs_cache.c> File 6,1,<..\..\filesystem\dfs\src\dfs_fs.c> File 6,1,<..\..\filesystem\dfs\src\dfs_init.c> File 6,1,<..\..\filesystem\dfs\src\dfs_posix.c> File 6,1,<..\..\filesystem\dfs\src\dfs_raw.c> -File 6,1,<..\..\filesystem\dfs\filesystems\efsl\src\base\plibc.c> -File 6,1,<..\..\filesystem\dfs\filesystems\efsl\src\base\efs.c> -File 6,1,<..\..\filesystem\dfs\filesystems\efsl\src\base\extract.c> -File 6,1,<..\..\filesystem\dfs\filesystems\efsl\src\base\partition.c> -File 6,1,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\ui.c> -File 6,1,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\dir.c> -File 6,1,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\fat.c> -File 6,1,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\file.c> -File 6,1,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\fs.c> -File 6,1,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\ls.c> -File 6,1,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\time.c> +File 6,1,<..\..\filesystem\dfs\filesystems\elmfat\dfs_elm.c> +File 6,1,<..\..\filesystem\dfs\filesystems\elmfat\ff.c> Options 1,0,0 // Target 'RT-Thread STM32' @@ -142,7 +132,7 @@ Options 1,0,0 // Target 'RT-Thread STM32' ADSCMISC () ADSCDEFN (USE_STDPERIPH_DRIVER, STM32F10X_HD,) ADSCUDEF () - ADSCINCD (.\Libraries\STM32F10x_StdPeriph_Driver\inc;.\Libraries\CMSIS\Core\CM3;..\..\include;.;..\..\libcpu\arm\stm32;..\..\filesystem\dfs;..\..\filesystem\dfs\include;..\..\filesystem\dfs\filesystems\efsl\src\include;..\..\filesystem\dfs\filesystems\efsl\src\base\include;..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\include) + ADSCINCD (.\Libraries\STM32F10x_StdPeriph_Driver\inc;.\Libraries\CMSIS\Core\CM3;..\..\include;.;..\..\libcpu\arm\stm32;..\..\filesystem\dfs;..\..\filesystem\dfs\include;..\..\finsh) ADSASFLG { 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } ADSAMISC () ADSADEFN () diff --git a/bsp/stm3210/project_filesystem/project.ewp b/bsp/stm3210/project_filesystem/project.ewp index 09c35286318db4051e7370261796bf6ae8a7ac03..5bc9e840d687fe09b9ef0d54680e5180772f45ae 100644 --- a/bsp/stm3210/project_filesystem/project.ewp +++ b/bsp/stm3210/project_filesystem/project.ewp @@ -287,9 +287,6 @@ $PROJ_DIR$\..\..\libcpu\arm\stm32 $PROJ_DIR$\..\..\filesystem\dfs $PROJ_DIR$\..\..\filesystem\dfs\include - $PROJ_DIR$\..\..\filesystem\dfs\filesystems\efsl\src\include - $PROJ_DIR$\..\..\filesystem\dfs\filesystems\efsl\src\base\include - $PROJ_DIR$\..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\include