summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbernard.xiong <[email protected]>2010-02-11 15:55:46 +0000
committerbernard.xiong <[email protected]>2010-02-11 15:55:46 +0000
commit034166dfb9fa985f4a7f0c75c29902bbc6c21bf8 (patch)
tree921b892275c0cd0e46085c9824fd8f7cdde1620b
parentc53033b881dbfe8a863d35f830eb2a8a50d1a353 (diff)
use ELM FatFs as FAT file system.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@406 bbd45198-f89e-11dd-88c7-29a3b14d5316
-rw-r--r--bsp/stm3210/project_filesystem/application.c71
-rw-r--r--bsp/stm3210/project_filesystem/project.Uv216
-rw-r--r--bsp/stm3210/project_filesystem/project.ewp40
-rw-r--r--bsp/stm3210/project_filesystem/rtconfig.h12
4 files changed, 36 insertions, 103 deletions
diff --git a/bsp/stm3210/project_filesystem/application.c b/bsp/stm3210/project_filesystem/application.c
index 9258aa0449..698f4a9bf0 100644
--- a/bsp/stm3210/project_filesystem/application.c
+++ b/bsp/stm3210/project_filesystem/application.c
@@ -24,67 +24,38 @@
#include <dfs_init.h>
/* dfs filesystem:EFS filesystem init */
#include <dfs_efs.h>
+/* dfs filesystem:ELM FatFs filesystem init */
+#include <dfs_elm.h>
/* dfs Filesystem APIs */
#include <dfs_fs.h>
#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)
{
/* Filesystem Initialization */
#ifdef RT_USING_DFS
{
- /* init the device filesystem */
- dfs_init();
- /* init the efsl filesystam*/
- efsl_init();
+ /* 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");
- ls_root();
- }
- else
- rt_kprintf("File System init failed!\n");
+ /* 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 d786e7e14d..668dc9e6f1 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><fault_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 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_init.c><dfs_init.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\filesystems\efsl\src\base\plibc.c><plibc.c>
-File 6,1,<..\..\filesystem\dfs\filesystems\efsl\src\base\efs.c><efs.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>
+File 6,1,<..\..\filesystem\dfs\filesystems\elmfat\dfs_elm.c><dfs_elm.c>
+File 6,1,<..\..\filesystem\dfs\filesystems\elmfat\ff.c><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 09c3528631..5bc9e840d6 100644
--- a/bsp/stm3210/project_filesystem/project.ewp
+++ b/bsp/stm3210/project_filesystem/project.ewp
@@ -287,9 +287,6 @@
<state>$PROJ_DIR$\..\..\libcpu\arm\stm32</state>
<state>$PROJ_DIR$\..\..\filesystem\dfs</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>
<name>CCStdIncCheck</name>
@@ -1086,9 +1083,6 @@
<state>$PROJ_DIR$\..\..\libcpu\arm\stm32</state>
<state>$PROJ_DIR$\..\..\filesystem\dfs</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>
<name>CCStdIncCheck</name>
@@ -1611,7 +1605,7 @@
<group>
<name>Filesystem</name>
<file>
- <name>$PROJ_DIR$\..\..\filesystem\dfs\src\dfs_cache.c</name>
+ <name>$PROJ_DIR$\..\..\filesystem\dfs\filesystems\elmfat\dfs_elm.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\filesystem\dfs\src\dfs_fs.c</name>
@@ -1629,37 +1623,7 @@
<name>$PROJ_DIR$\..\..\filesystem\dfs\src\dfs_util.c</name>
</file>
<file>
- <name>$PROJ_DIR$\..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\dir.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>
+ <name>$PROJ_DIR$\..\..\filesystem\dfs\filesystems\elmfat\ff.c</name>
</file>
</group>
<group>
diff --git a/bsp/stm3210/project_filesystem/rtconfig.h b/bsp/stm3210/project_filesystem/rtconfig.h
index d97832256e..ae5f1f2745 100644
--- a/bsp/stm3210/project_filesystem/rtconfig.h
+++ b/bsp/stm3210/project_filesystem/rtconfig.h
@@ -65,10 +65,18 @@
/* the buffer size of console*/
#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 */
#define RT_USING_DFS
-#define RT_USING_DFS_EFSL
-/* #define RT_USING_DFS_ELMFAT */
+/* #define RT_USING_DFS_EFSL */
+#define RT_USING_DFS_ELMFAT
+#define RT_DFS_ELM_WORD_ACCESS
/* the max number of mounted filesystem */
#define DFS_FILESYSTEMS_MAX 2