mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-02-28 03:47:11 +08:00
use ELM FatFs as FAT file system.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@406 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
c53033b881
commit
034166dfb9
@ -24,67 +24,38 @@
|
|||||||
#include <dfs_init.h>
|
#include <dfs_init.h>
|
||||||
/* dfs filesystem:EFS filesystem init */
|
/* dfs filesystem:EFS filesystem init */
|
||||||
#include <dfs_efs.h>
|
#include <dfs_efs.h>
|
||||||
|
/* dfs filesystem:ELM FatFs filesystem init */
|
||||||
|
#include <dfs_elm.h>
|
||||||
/* dfs Filesystem APIs */
|
/* dfs Filesystem APIs */
|
||||||
#include <dfs_fs.h>
|
#include <dfs_fs.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* filesystem test */
|
|
||||||
#include <dfs_posix.h>
|
|
||||||
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<DIR>\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)
|
void rt_init_thread_entry(void* parameter)
|
||||||
{
|
{
|
||||||
/* Filesystem Initialization */
|
/* Filesystem Initialization */
|
||||||
#ifdef RT_USING_DFS
|
#ifdef RT_USING_DFS
|
||||||
{
|
{
|
||||||
/* init the device filesystem */
|
/* init the device filesystem */
|
||||||
dfs_init();
|
dfs_init();
|
||||||
/* init the efsl filesystam*/
|
#ifdef RT_USING_DFS_EFSL
|
||||||
efsl_init();
|
/* init the efsl filesystam*/
|
||||||
|
efsl_init();
|
||||||
|
|
||||||
/* mount sd card fat partition 1 as root directory */
|
/* mount sd card fat partition 1 as root directory */
|
||||||
if (dfs_mount("sd0", "/", "efs", 0, 0) == 0)
|
if (dfs_mount("sd0", "/", "efs", 0, 0) == 0)
|
||||||
{
|
rt_kprintf("File System initialized!\n");
|
||||||
rt_kprintf("File System initialized!\n");
|
else
|
||||||
ls_root();
|
rt_kprintf("File System init failed!\n");
|
||||||
}
|
#elif defined(RT_USING_DFS_ELMFAT)
|
||||||
else
|
/* init the elm FAT filesystam*/
|
||||||
rt_kprintf("File System init failed!\n");
|
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
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -66,22 +66,12 @@ File 5,2,<..\..\libcpu\arm\stm32\fault_rvds.S><fault_rvds.S>
|
|||||||
File 5,2,<..\..\libcpu\arm\stm32\start_rvds.s><start_rvds.s>
|
File 5,2,<..\..\libcpu\arm\stm32\start_rvds.s><start_rvds.s>
|
||||||
File 5,1,<..\..\libcpu\arm\stm32\serial.c><serial.c>
|
File 5,1,<..\..\libcpu\arm\stm32\serial.c><serial.c>
|
||||||
File 6,1,<..\..\filesystem\dfs\src\dfs_util.c><dfs_util.c>
|
File 6,1,<..\..\filesystem\dfs\src\dfs_util.c><dfs_util.c>
|
||||||
File 6,1,<..\..\filesystem\dfs\src\dfs_cache.c><dfs_cache.c>
|
|
||||||
File 6,1,<..\..\filesystem\dfs\src\dfs_fs.c><dfs_fs.c>
|
File 6,1,<..\..\filesystem\dfs\src\dfs_fs.c><dfs_fs.c>
|
||||||
File 6,1,<..\..\filesystem\dfs\src\dfs_init.c><dfs_init.c>
|
File 6,1,<..\..\filesystem\dfs\src\dfs_init.c><dfs_init.c>
|
||||||
File 6,1,<..\..\filesystem\dfs\src\dfs_posix.c><dfs_posix.c>
|
File 6,1,<..\..\filesystem\dfs\src\dfs_posix.c><dfs_posix.c>
|
||||||
File 6,1,<..\..\filesystem\dfs\src\dfs_raw.c><dfs_raw.c>
|
File 6,1,<..\..\filesystem\dfs\src\dfs_raw.c><dfs_raw.c>
|
||||||
File 6,1,<..\..\filesystem\dfs\filesystems\efsl\src\base\plibc.c><plibc.c>
|
File 6,1,<..\..\filesystem\dfs\filesystems\elmfat\dfs_elm.c><dfs_elm.c>
|
||||||
File 6,1,<..\..\filesystem\dfs\filesystems\efsl\src\base\efs.c><efs.c>
|
File 6,1,<..\..\filesystem\dfs\filesystems\elmfat\ff.c><ff.c>
|
||||||
File 6,1,<..\..\filesystem\dfs\filesystems\efsl\src\base\extract.c><extract.c>
|
|
||||||
File 6,1,<..\..\filesystem\dfs\filesystems\efsl\src\base\partition.c><partition.c>
|
|
||||||
File 6,1,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\ui.c><ui.c>
|
|
||||||
File 6,1,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\dir.c><dir.c>
|
|
||||||
File 6,1,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\fat.c><fat.c>
|
|
||||||
File 6,1,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\file.c><file.c>
|
|
||||||
File 6,1,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\fs.c><fs.c>
|
|
||||||
File 6,1,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\ls.c><ls.c>
|
|
||||||
File 6,1,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\time.c><time.c>
|
|
||||||
|
|
||||||
|
|
||||||
Options 1,0,0 // Target 'RT-Thread STM32'
|
Options 1,0,0 // Target 'RT-Thread STM32'
|
||||||
@ -142,7 +132,7 @@ Options 1,0,0 // Target 'RT-Thread STM32'
|
|||||||
ADSCMISC ()
|
ADSCMISC ()
|
||||||
ADSCDEFN (USE_STDPERIPH_DRIVER, STM32F10X_HD,)
|
ADSCDEFN (USE_STDPERIPH_DRIVER, STM32F10X_HD,)
|
||||||
ADSCUDEF ()
|
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 }
|
ADSASFLG { 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
|
||||||
ADSAMISC ()
|
ADSAMISC ()
|
||||||
ADSADEFN ()
|
ADSADEFN ()
|
||||||
|
@ -287,9 +287,6 @@
|
|||||||
<state>$PROJ_DIR$\..\..\libcpu\arm\stm32</state>
|
<state>$PROJ_DIR$\..\..\libcpu\arm\stm32</state>
|
||||||
<state>$PROJ_DIR$\..\..\filesystem\dfs</state>
|
<state>$PROJ_DIR$\..\..\filesystem\dfs</state>
|
||||||
<state>$PROJ_DIR$\..\..\filesystem\dfs\include</state>
|
<state>$PROJ_DIR$\..\..\filesystem\dfs\include</state>
|
||||||
<state>$PROJ_DIR$\..\..\filesystem\dfs\filesystems\efsl\src\include</state>
|
|
||||||
<state>$PROJ_DIR$\..\..\filesystem\dfs\filesystems\efsl\src\base\include</state>
|
|
||||||
<state>$PROJ_DIR$\..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\include</state>
|
|
||||||
</option>
|
</option>
|
||||||
<option>
|
<option>
|
||||||
<name>CCStdIncCheck</name>
|
<name>CCStdIncCheck</name>
|
||||||
@ -1086,9 +1083,6 @@
|
|||||||
<state>$PROJ_DIR$\..\..\libcpu\arm\stm32</state>
|
<state>$PROJ_DIR$\..\..\libcpu\arm\stm32</state>
|
||||||
<state>$PROJ_DIR$\..\..\filesystem\dfs</state>
|
<state>$PROJ_DIR$\..\..\filesystem\dfs</state>
|
||||||
<state>$PROJ_DIR$\..\..\filesystem\dfs\include</state>
|
<state>$PROJ_DIR$\..\..\filesystem\dfs\include</state>
|
||||||
<state>$PROJ_DIR$\..\..\filesystem\dfs\filesystems\efsl\src\include</state>
|
|
||||||
<state>$PROJ_DIR$\..\..\filesystem\dfs\filesystems\efsl\src\base\include</state>
|
|
||||||
<state>$PROJ_DIR$\..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\include</state>
|
|
||||||
</option>
|
</option>
|
||||||
<option>
|
<option>
|
||||||
<name>CCStdIncCheck</name>
|
<name>CCStdIncCheck</name>
|
||||||
@ -1611,7 +1605,7 @@
|
|||||||
<group>
|
<group>
|
||||||
<name>Filesystem</name>
|
<name>Filesystem</name>
|
||||||
<file>
|
<file>
|
||||||
<name>$PROJ_DIR$\..\..\filesystem\dfs\src\dfs_cache.c</name>
|
<name>$PROJ_DIR$\..\..\filesystem\dfs\filesystems\elmfat\dfs_elm.c</name>
|
||||||
</file>
|
</file>
|
||||||
<file>
|
<file>
|
||||||
<name>$PROJ_DIR$\..\..\filesystem\dfs\src\dfs_fs.c</name>
|
<name>$PROJ_DIR$\..\..\filesystem\dfs\src\dfs_fs.c</name>
|
||||||
@ -1629,37 +1623,7 @@
|
|||||||
<name>$PROJ_DIR$\..\..\filesystem\dfs\src\dfs_util.c</name>
|
<name>$PROJ_DIR$\..\..\filesystem\dfs\src\dfs_util.c</name>
|
||||||
</file>
|
</file>
|
||||||
<file>
|
<file>
|
||||||
<name>$PROJ_DIR$\..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\dir.c</name>
|
<name>$PROJ_DIR$\..\..\filesystem\dfs\filesystems\elmfat\ff.c</name>
|
||||||
</file>
|
|
||||||
<file>
|
|
||||||
<name>$PROJ_DIR$\..\..\filesystem\dfs\filesystems\efsl\src\base\efs.c</name>
|
|
||||||
</file>
|
|
||||||
<file>
|
|
||||||
<name>$PROJ_DIR$\..\..\filesystem\dfs\filesystems\efsl\src\base\extract.c</name>
|
|
||||||
</file>
|
|
||||||
<file>
|
|
||||||
<name>$PROJ_DIR$\..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\fat.c</name>
|
|
||||||
</file>
|
|
||||||
<file>
|
|
||||||
<name>$PROJ_DIR$\..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\file.c</name>
|
|
||||||
</file>
|
|
||||||
<file>
|
|
||||||
<name>$PROJ_DIR$\..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\fs.c</name>
|
|
||||||
</file>
|
|
||||||
<file>
|
|
||||||
<name>$PROJ_DIR$\..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\ls.c</name>
|
|
||||||
</file>
|
|
||||||
<file>
|
|
||||||
<name>$PROJ_DIR$\..\..\filesystem\dfs\filesystems\efsl\src\base\partition.c</name>
|
|
||||||
</file>
|
|
||||||
<file>
|
|
||||||
<name>$PROJ_DIR$\..\..\filesystem\dfs\filesystems\efsl\src\base\plibc.c</name>
|
|
||||||
</file>
|
|
||||||
<file>
|
|
||||||
<name>$PROJ_DIR$\..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\time.c</name>
|
|
||||||
</file>
|
|
||||||
<file>
|
|
||||||
<name>$PROJ_DIR$\..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\ui.c</name>
|
|
||||||
</file>
|
</file>
|
||||||
</group>
|
</group>
|
||||||
<group>
|
<group>
|
||||||
|
@ -65,10 +65,18 @@
|
|||||||
/* the buffer size of console*/
|
/* the buffer size of console*/
|
||||||
#define RT_CONSOLEBUF_SIZE 128
|
#define RT_CONSOLEBUF_SIZE 128
|
||||||
|
|
||||||
|
/* SECTION: FinSH shell options */
|
||||||
|
/* Using FinSH as Shell*/
|
||||||
|
/* #define RT_USING_FINSH */
|
||||||
|
/* Using symbol table */
|
||||||
|
#define FINSH_USING_SYMTAB
|
||||||
|
#define FINSH_USING_DESCRIPTION
|
||||||
|
|
||||||
/* SECTION: device filesystem */
|
/* SECTION: device filesystem */
|
||||||
#define RT_USING_DFS
|
#define RT_USING_DFS
|
||||||
#define RT_USING_DFS_EFSL
|
/* #define RT_USING_DFS_EFSL */
|
||||||
/* #define RT_USING_DFS_ELMFAT */
|
#define RT_USING_DFS_ELMFAT
|
||||||
|
#define RT_DFS_ELM_WORD_ACCESS
|
||||||
|
|
||||||
/* the max number of mounted filesystem */
|
/* the max number of mounted filesystem */
|
||||||
#define DFS_FILESYSTEMS_MAX 2
|
#define DFS_FILESYSTEMS_MAX 2
|
||||||
|
Loading…
x
Reference in New Issue
Block a user