fatfs文件系统支持4GB文件。
disk_initialize()等函数是FATFS底层的几个接口,移植实现后,FATFS的 *** 作跟WINDOWS上的文件 *** 作差不多一样,FATFS源代码里有说明文档自己看,不过设备要先挂载,如果原来的设备没有文件系统,还要格式化一下,才能用。
对于FAT16文件系统,可以保存的文件体积最大值是4 GB - 1 byte (2^32 bytes - 1 byte);卷的最大体积是4GB;每个卷上最多可以保存的文件数量是65,536个 (2^16);根目录下可以保存的文件和文件夹数量最大值是512个(如果使用了长文件名,该数字还会键清减小)。
FatFs 提供下面的函数:
f_mount - 注册/注销一个工戚铅作区域(Work Area)
f_open - 打开/创建一个文件
f_close - 关闭一个文件
f_read - 读文件
f_write - 写文件
f_lseek - 移动文件读/写指针
f_truncate - 截断文件稿仔前
f_sync - 冲洗缓冲数据 Flush Cached Data
f_opendir - 打开一个目录
f_readdir - 读取目录条目
f_getfree - 获取空闲簇 Get Free Clusters
当然可以,同时打开多个文件读取或写入都是ok的,无论是FAT文件系统还是UFFS文件系统共,可以写个软件测试一下稍后我写个软蔽神件测试一下,然后再贴出结果
\ | /
- RT - Thread Operating System
/ | \ 1.2.0 build Aug 23 2016
2006 - 2013 Copyright by rt-thread team
----------------------------------------
<boot>Booting...
<袜并档boot>----------- sys info ------------
<boot>rom = 512 KB
<boot>ram = 64 KB @0x20000000
<boot>xram = 512 KB @0x68000000
<boot>heap = 512 KB @0x68000000
<boot>freq = 72 Mhz
<boot>----------- app info ------------
<boot>bin = 161 KB @0x08003000
<boot>mem = 45 KB (static req)
<boot>............................[PASS]
----------------------------------------
<xram>Testing...
<xram>16 bit
<xram>512 KB OK
<xram>............................[PASS]
----------------------------------------
<SPI>Testing...
<SPI>Finding Next...
<SPI>ID = 00BF2541
<i2c>Configuration...
<i2c>............................[PASS]
----------------------------------------
<告乱cat9555>Testing...
<cat9555>EXIO0 @0x40
<cat9555>[cfg = 0x00c0]
init OK!
<cat9555>........................[PASS]
----------------------------------------
<Nand>Testing...
<Nand>ID = 2C,D3,90,A6,64
<Nand>Type = 1024M
<Nand>...........................[PASS]
----------------------------------------
<Nor>Testing...
<Nor>ID = 0001,227E,2221,2201
<Nor>...........................[PASS]
----------------------------------------
<CH374T>Testing...
<CH374T>Detect OK
<CH374T>LibInit OK
<CH374T>.........................[PASS]
----------------------------------------
<RTC>Testing...
<RTC>External Reset occurred
<RTC>No need to configure RTC
<RTC>............................[PASS]
----------------------------------------
<wm89xx>Testing...
<wm89xx>Find chip
<wm89xx>.........................[PASS]
----------------------------------------
<FileSystem>Init...
<FileSystem>Nor FS initialized!
<FileSystem>....................[PASS]
----------------------------------------
os : system memory alloc 1120 bytes
flsh: UFFS consume spare data size 18
os : system memory alloc 41360 bytes
os : system memory alloc 6288 bytes
os : system memory alloc 65536 bytes
tree: found bad block 412
tree: DIR 1, FILE 21, DATA 0
<FileSystem>Nand FS initialized!
<FileSystem>.....................[PASS]
----------------------------------------
<DSP>Testing...
<DSP>...........................[PASS]
----------------------------------------
>>Write /dev/FILE0.TXT ok
>>Write /dev/FILE1.TXT ok
>>Write /dev/FILE2.TXT ok
>>Write /dev/FILE3.TXT ok
>>Write /dev/FILE0.TXT ok
>>Write /dev/FILE1.TXT ok
>>Write /dev/FILE2.TXT ok
>>Write /dev/FILE3.TXT ok
>>Write /dev/FILE0.TXT ok
>>Write /dev/FILE1.TXT ok
>>Write /dev/FILE2.TXT ok
>>Write /dev/FILE3.TXT ok
>>Write /dev/FILE0.TXT ok
>>Write /dev/FILE1.TXT ok
>>Write /dev/FILE2.TXT ok
>>Write /dev/FILE3.TXT ok
>>Write /dev/FILE0.TXT ok
>>Write /dev/FILE1.TXT ok
>>Write /dev/FILE2.TXT ok
>>Write /dev/FILE3.TXT ok
>>Write /dev/FILE0.TXT ok
>>Write /dev/FILE1.TXT ok
>>Write /dev/FILE2.TXT ok
>>Write /dev/FILE3.TXT ok
>>Write /dev/FILE0.TXT ok
>>Write /dev/FILE1.TXT ok
>>Write /dev/FILE2.TXT ok
>>Write /dev/FILE3.TXT ok
>>Write /dev/FILE0.TXT ok
>>Write /dev/FILE1.TXT ok
>>Write /dev/FILE2.TXT ok
>>Write /dev/FILE3.TXT ok
>>Write /dev/FILE0.TXT ok
>>Write /dev/FILE1.TXT ok
>>Write /dev/FILE2.TXT ok
>>Write /dev/FILE3.TXT ok
>>Write /dev/FILE0.TXT ok
>>Write /dev/FILE1.TXT ok
>>Write /dev/FILE2.TXT ok
>>Write /dev/FILE3.TXT ok
finsh>>
finsh>>ls("/dev/")
Directory /dev/:
log <DIR>
devTst 4
NAND_DEMO 4
info_index 26
LOG.TXT 14
TABLE.DYB 35032
list_index 120
FILE0.TXT 100
FILE1.TXT 100
FILE2.TXT 100
FILE3.TXT 100
0, 0x00000000
finsh>>cat("/dev/FILE0.TXT")
1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 0, 0x00000000
finsh>>
如果需要代码可以再贴出来
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)