fatfs v0.05a Feb 03, 2008:
- Added f_truncate(). - Added f_utime(). - Fixed off by one error at FAT sub-type determination. - Fixed btr in f_read() can be mistruncated. - Fixed cached sector is not flushed when create and close without write.
This commit is contained in:
1 parent
36c173e705
commit
e400c8c902
40 files changed
+1238
-750
No files matched your search
+20
-20
@@ -18,30 +18,30 @@
|
||||
<ul>
|
||||
<li>ANSI C<br>
|
||||
The FatFs module is a middleware that written in ANSI C. There is no platform dependence, so long as the compiler is in compliance with ANSI C. However it handles the system portable FAT structures. You must take the <strong>endian</strong> into consideration. This setting is defined in ff.h (tff.h). It must be changed for your platform first or the compiler will abort with an error.</li>
|
||||
<li>Size of char/short/long are 8/16/32 bit and int is 16 bit or greater.<br>
|
||||
<li>Size of char/short/long are 8/16/32-bit and int is 16 or 32 bit.<br>
|
||||
These correspondence are defined in integer.h. This will not be a problem on most compilers. When any conflict of the definitions between the integer.h and existing definitions is occured, you must resolve the confrict with care.</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="para">
|
||||
<h3>Memory Usage (R0.05)</h3>
|
||||
<h3>Memory Usage (R0.05a)</h3>
|
||||
<p>These are the memory usage on some target systems. The memory sizes are in unit of byte, D means number of logical drives and F means number of open files. All samples are optimezed in code size.</p>
|
||||
<table class="lst2">
|
||||
<tr><th></th><th>AVR</th><th>H8/300H</th><th>MSP430</th><th>TLCS-870/C</th><th>V850ES</th><th>SH2</th></tr>
|
||||
<tr><td>Compiler</td><td>gcc</td><td>CH38</td><td>CL430</td><td>CC870C</td><td>CA850</td><td>SHC</td></tr>
|
||||
<tr><td>_MCU_ENDIAN</td><td>1</td><td>2</td><td>2</td><td>1</td><td>1</td><td>2</td></tr>
|
||||
<tr><td>FatFs Code<br>(Standard, R/W cfg.)</td><td>8810</td><td>8880</td><td></td><td></td><td>6418</td><td>7830</td></tr>
|
||||
<tr><td>FatFs Code<br>(Minimum, R/W cfg.)</td><td>5832</td><td>5748</td><td></td><td></td><td>4072</td><td>5366</td></tr>
|
||||
<tr><td>FatFs Code<br>(Standard, R/O cfg.)</td><td>4264</td><td>4110</td><td></td><td></td><td>2990</td><td>3420</td></tr>
|
||||
<tr><td>FatFs Code<br>(Minimum, R/O cfg.)</td><td>3052</td><td>3124</td><td></td><td></td><td>2194</td><td>2634</td></tr>
|
||||
<tr><td>FatFs Work (Static)</td><td>D*2 + 2</td><td>D*4 + 2</td><td></td><td></td><td>D*4 + 2</td><td>D*4 + 2</td></tr>
|
||||
<tr><td>FatFs Work (Dynamic)</td><td>D*554 + F*544</td><td>D*554 + F*550</td><td></td><td></td><td>D*554 + F*550</td><td>D*554 + F*550</td></tr>
|
||||
<tr><td>Tiny-FatFs Code<br>(Standard, R/W cfg.)</td><td>7376</td><td>7274</td><td>6622</td><td>8854</td><td>5670</td><td></td></tr>
|
||||
<tr><td>Tiny-FatFs Code<br>(Minimum, R/W cfg.)</td><td>4866</td><td>4326</td><td>4354</td><td>6176</td><td>3726</td><td></td></tr>
|
||||
<tr><td>Tiny-FatFs Code<br>(Standard, R/O cfg.)</td><td>3654</td><td>3554</td><td>3220</td><td>4358</td><td>2710</td><td></td></tr>
|
||||
<tr><td>Tiny-FatFs Code<br>(Minimum, R/O cfg.)</td><td>2620</td><td>2708</td><td>2402</td><td>3329</td><td>1910</td><td></td></tr>
|
||||
<tr><td>Tiny-FatFs Wrok (Static)</td><td>4</td><td>6</td><td>4</td><td>4</td><td>6</td><td></td></tr>
|
||||
<tr><td>Tiny-FatFs Work (Dynamic)</td><td>544 + F*28</td><td>544 + F*32</td><td>544 + F*28</td><td>544 + F*28</td><td>544 + F*32</td><td></td></tr>
|
||||
<tr><th></th><th>AVR</th><th>H8/300H</th><th>PIC</th><th>MSP430</th><th>TLCS-870/C</th><th>V850ES</th><th>SH2</th></tr>
|
||||
<tr><td>Compiler</td><td>gcc</td><td>CH38</td><td>C30(gcc)</td><td>CL430</td><td>CC870C</td><td>CA850</td><td>SHC</td></tr>
|
||||
<tr><td>_MCU_ENDIAN</td><td>1</td><td>2</td><td>2</td><td>2</td><td>1</td><td>1</td><td>2</td></tr>
|
||||
<tr class="lst3"><td>FatFs Code<br>(Full, R/W)</td><td>9146</td><td>9218</td><td>9155</td><td></td><td></td><td>6662</td><td>7430</td></tr>
|
||||
<tr><td>FatFs Code<br>(Minimum, R/W)</td><td>5824</td><td>5756</td><td>5861</td><td></td><td></td><td>4096</td><td>4710</td></tr>
|
||||
<tr><td>FatFs Code<br>(Full, R/O)</td><td>4268</td><td>4116</td><td>4187</td><td></td><td></td><td>2986</td><td>3382</td></tr>
|
||||
<tr><td>FatFs Code<br>(Minimum, R/O)</td><td>3076</td><td>3134</td><td>3143</td><td></td><td></td><td>2200</td><td>2610</td></tr>
|
||||
<tr><td>FatFs Work (Static)</td><td>D*2+2</td><td>D*4+2</td><td>D*2+2</td><td></td><td></td><td>D*4+2</td><td>D*4+2</td></tr>
|
||||
<tr><td>FatFs Work (Dynamic)</td><td>D*554+F*544</td><td>D*554+F*550</td><td>D*554+F*544</td><td></td><td></td><td>D*554+F*550</td><td>D*554+F*550</td></tr>
|
||||
<tr class="lst3"><td>Tiny-FatFs Code<br>(Full, R/W)</td><td>7566</td><td>7626</td><td>7371</td><td>6894</td><td>9314</td><td>5926</td><td>6580</td></tr>
|
||||
<tr><td>Tiny-FatFs Code<br>(Minimum, R/W)</td><td>4730</td><td>4814</td><td>4683</td><td>4306</td><td>6285</td><td>3670</td><td>4236</td></tr>
|
||||
<tr><td>Tiny-FatFs Code<br>(Full, R/O)</td><td>3564</td><td>3532</td><td>3522</td><td>3226</td><td>4389</td><td>2678</td><td>3022</td></tr>
|
||||
<tr><td>Tiny-FatFs Code<br>(Minimum, R/O)</td><td>2554</td><td>2674</td><td>2595</td><td>2372</td><td>3376</td><td>1856</td><td>2300</td></tr>
|
||||
<tr><td>Tiny-FatFs Wrok (Static)</td><td>4</td><td>6</td><td>4</td><td>4</td><td>4</td><td>6</td><td>6</td></tr>
|
||||
<tr><td>Tiny-FatFs Work (Dynamic)</td><td>544+F*28</td><td>544+F*32</td><td>544+F*28</td><td>544+F*28</td><td>544+F*28</td><td>544+F*32</td><td>544+F*32</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@@ -62,7 +62,7 @@ These correspondence are defined in integer.h. This will not be a problem on mos
|
||||
|
||||
<div class="para">
|
||||
<h3>Performance effective file access</h3>
|
||||
<p>For good performance on reading/writing files on the small embedded system, application program should consider what process is done in the FatFs module. The file data on the disk is transferred by f_read function in following process.</p>
|
||||
<p>For good performance on reading/writing files on the small embedded system, application program should consider what process is done in the FatFs module. The file data on the disk is transferred by f_read function in these sequence.</p>
|
||||
<p>Figure 1. Sector miss-aligned read (short)<br>
|
||||
<img src="../img/f1.png" width="490" height="73">
|
||||
</p>
|
||||
@@ -73,7 +73,7 @@ These correspondence are defined in integer.h. This will not be a problem on mos
|
||||
<img src="../img/f3.png" width="490" height="119">
|
||||
</p>
|
||||
<p>The file I/O buffer means a sector buffer to read/write a partial data on the sector. On the FatFs, member buffer[] in the file object is used. On the Tiny-FatFs, member win[] in the file system object is used.</p>
|
||||
<p>Tiny-FatFs processes all data transfer and access to the FAT/directory with only one sector buffer, so that FAT sector cached into the buffer is lost and it must reloaded at every cluster boundary. FatFs has a FAT/directory buffer separated from file I/O buffer, the frequency of FAT accesses is only 1/341, 1/256 or 1/128 (when cluster is contiguous) compared to Tiny-FatFs. Thus the Tiny-FatFs is sacrificing its performance in compensation for very small memory footprint.</p>
|
||||
<p>Tiny-FatFs processes all file data transfer and access to the FAT/directory with only one sector buffer, so that FAT sector cached into the buffer is lost and it must reloaded at every cluster boundary. FatFs has a FAT/directory buffer separated from file I/O buffer, the frequency of FAT accesses is only 1/341, 1/256 or 1/128 (when cluster is contiguous) compared to Tiny-FatFs. Thus the Tiny-FatFs is sacrificing its performance in compensation for very small memory footprint.</p>
|
||||
<p>Figure 1 shows that partial sector data is transferred via the file I/O buffer. At long data transfer shown in Figure 2, middle of transfer data that aligned to sector boundary is transferred into memory directly. Figure 3 shows that entier transfer data is aligned to the sector boundary. In this case, file I/O buffer is not used. At the unbuffered transfer, maximum extent of sectors are read with disk_read function at a time but it never across cluster boundary even if it is contiguous.</p>
|
||||
<p>Therefore taking effort to sector aligned read/write accesss eliminates memcpy and the read/write performance will be improved. Besides the effect, cached FAT sector is not flushed during read/write access on the Tiny-FatFs, so that it can achieve same performance as FatFs and its small memory footprint simultanesously.</p>
|
||||
</div>
|
||||
@@ -96,7 +96,7 @@ Figure 5. Minimized critical section<br>
|
||||
<li>File data being rewrited is collapted.</li>
|
||||
<li>A file being appended returns initial state.</li>
|
||||
<li>A file created as new is gone.</li>
|
||||
<li>A file created as new or in overwrite remains with length of zero.</li>
|
||||
<li>A file created as new or in overwritten remains with length of zero.</li>
|
||||
<li>Efficiency of disk use gets worse due to lost chain.</li>
|
||||
</ul>
|
||||
<p>Each case does not affect the files that not in write operation. To minimize risk of data loss, the critical section can be minimized like shown in Figure 5 by minimizing the time that file is opened in write mode and using f_sync function properly.</p>
|
||||
|
||||
Reference in new issue
Block a user