Skip to content

Commit 6d76cb3

Browse files
author
Amanda Butler
authored
Merge pull request #518 from geky/fs-fat
Added FAT file system documentation
2 parents b86a50c + 63416ef commit 6d76cb3

File tree

2 files changed

+50
-6
lines changed

2 files changed

+50
-6
lines changed

docs/reference/api/storage/FATFileSystem.md

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,42 @@
22

33
<span class="images">![](https://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/class_f_a_t_file_system.png)<span>FATFileSystem class hierarchy</span></span>
44

5-
[Add description here.]
5+
The FAT file system is an established disk-oriented file system that you can find on Mbed OS, Windows, Linux and Mac OS X. Due to its age and popularity, the FAT file system has become the standard for portable storage, such as flash drivers and SD cards.
6+
7+
- **Portable** - Due to its nearly universal support across operating systems, the FAT file system provides access to storage from both the embedded system and your PC.
8+
9+
- **Embedded** - Built on the ChanFS project, the FAT file system is optimized for embedded systems.
10+
11+
For additional information, please see the [storage overview page](/docs/development/reference/storage.html#declaring-a-file-system).
12+
13+
### Use cases
14+
15+
The main reason to use the FAT file system is its usefulness on portable storage. Because of this, most applications using FAT in conjunction with an SD card.
16+
17+
The first step to using the FAT file system is formatting storage with FAT. You can do this on a PC with the native format command or on Mbed OS with the `format` function.
18+
19+
<span class="notes">**Note:** The FAT file system requires at minimum 256 erase blocks. You can find the number of blocks on a block device by dividing the block device's size by its erase size.</span>
20+
21+
The FAT file system supports external flash; however, it must allocate a full erase block for internal operations, which can become large for some forms of flash. If RAM consumption becomes a problem, we suggest switching to LittleFileSystem. The Mbed OS file system APIs make switching file systems a straightforward task. One common strategy is to use the FAT file system for debugging and switch to LittleFileSystem when the application becomes stable.
22+
23+
### Usage
24+
25+
Instantiate the `FATFileSystem` class with a block device and file path.
26+
27+
The API that this presents is the standard Mbed OS file system API. Once declared, Mbed OS provides the retargeting layer for the standard C library.
28+
29+
You can swap the FAT file system in place with other Mbed OS file systems, which is a good method for prototyping applications.
630

731
### FATFileSystem class reference
832

933
[![View code](https://www.mbed.com/embed/?type=library)](http://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/class_f_a_t_file_system.html)
1034

1135
### FATFileSystem example
1236

13-
[Add example here.]
37+
[![View code](https://www.mbed.com/embed/?url=https://github.com/armmbed/mbed-os-example-filesystem)](https://os.mbed.com/teams/mbed-os-examples/code/mbed-os-example-filesystem/file/adaa6c01d727/main.cpp/)
38+
39+
### Related content
40+
41+
- [Storage configuration](configuration-storage.html).
42+
- [LittleFileSystem](littlefilesystem.html).
43+
- [Storage overview](/docs/development/reference/storage.html#declaring-a-file-system).

docs/reference/api/storage/storage.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,23 @@ The `fopen` function is similar to the open function above but associates a stre
1919

2020
#### Types of file systems
2121

22-
- [**LittleFileSystem**](https://os.mbed.com/docs/development/reference/littlefilesystem.html) - The little file system (LittleFS) is a fail-safe file system we designed for embedded systems, specifically for microcontrollers that use flash storage.
22+
- [**LittleFileSystem**](littlefilesystem.html) - The little file system (LittleFS) is a fail-safe file system we designed for embedded systems, specifically for microcontrollers that use flash storage.
2323

2424
- **Bounded RAM/ROM** - This file system works with a limited amount of memory. It avoids recursion and limits dynamic memory to configurable buffers.
2525

2626
- **Power-loss resilient** - We designed this for operating systems that may have random power failures. It has strong copy-on-write guarantees and keeps storage on disk in a valid state.
2727

2828
- **Wear leveling** - Because the most common form of embedded storage is erodible flash memories, this file system provides a form of dynamic wear leveling for systems that cannot fit a full flash translation layer.
2929

30-
- **FATFileSystem** - The FAT file system is a well-known file system that you can find on almost every system, including PCs. The Mbed OS implementation of the FAT file system is based on ChanFS and is optimized for small embedded systems.
30+
- [**FATFileSystem**](fatfilesystem.html) - The FAT file system is an established disk-oriented file system that you can find on most operating systems, including Windows, Linux, Mac OS X and Mbed OS.
3131

32-
- **Portable** - Almost every operating system supports the FAT file system, which is the most common file system found on portable storage, such as SD cards and flash drives. The FAT file system is the easiest way to support access from a PC.
32+
- **Portable** - Due to its support across operating systems, the FAT file system provides access to storage from both the embedded system and your PC.
33+
34+
- **Embedded** - Built on the ChanFS project, the FAT file system is optimized for embedded systems.
3335

3436
The [BlockDevice](https://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/class_block_device.html) class provides the underlying API for representing block-based storage that you can use to back a file system. Mbed OS provides standard interfaces for the more common storage media, and you can extend the BlockDevice class to provide support for unsupported storage.
3537

36-
Additionally, two utility block devices give you better control over storage allocation. The [slicing block device](https://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/class_slicing_block_device.html) allows you to partition storage into smaller block devices that you can use independently, and the [chaining block device](https://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/class_chaining_block_device.html) allows you to chain multiple block devices together and extend the usable amount of storage.
38+
Additionally, two utility block devices give you better control over storage allocation. The [SlicingBlockDevice](https://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/class_slicing_block_device.html) allows you to partition storage into smaller block devices that you can use independently, and the [ChainingBlockDevice](https://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/class_chaining_block_device.html) allows you to chain multiple block devices together and extend the usable amount of storage.
3739

3840
<span class="notes">**Note:** Some file systems may provide a format function for cleanly initializing a file system on an underlying block device or require external tools to set up the file system before the first use.</span>
3941

@@ -63,6 +65,18 @@ We optimized this file system to work with a limited amount of RAM and ROM. It a
6365

6466
The "little" in the little file system comes from the focus on both keeping resource usage low and keeping the scope self-contained. Aside from the three targeted issues above, there is a heavy restriction against bloat in this software module. Instead, we push additional features to separate layers in the BlockDevice API that drives the Mbed OS storage stack. This gives Mbed OS a tool for remaining flexible as technology used by IoT devices develops.
6567

68+
#### The FATFileSystem
69+
70+
The FAT file system is an established disk-oriented file system that you can find on Mbed OS, Windows, Linux and Mac OS X. Due to its age and popularity, the FAT file system has become the standard for portable storage, such as flash drives and SD cards.
71+
72+
##### Portable
73+
74+
The primary feature of the FAT file system is its portability. With support across PC operating systems, the FAT file system lets you access storage from both the embedded system your PC. This gives users a way to get information onto and off of the device.
75+
76+
##### Embedded
77+
78+
The Mbed OS FAT file system is built on the ChanFS project. It is optimized for embedded systems and is one of the smallest FAT file system implementations.
79+
6680
### Partitioning
6781

6882
Partitioning allows you to split a block device among multiple storage users such that the split is portable across multiple systems. Partitioning also allows you to have multiple file systems that you can mount on one disk from both Mbed OS devices and host computers. The primary partitioning scheme that Mbed OS supports is the Master Boot Record (MBR).

0 commit comments

Comments
 (0)