File System Component  Version 5.0
MDK-Professional Middleware for Devices with Flash File System
 All Data Structures Files Functions Variables Enumerations Enumerator Macros Groups Pages
Theory of Operation

Table of Contents

The File System Component provides functions to create, save, read, and modify files. The Retarget Interface of the ARM C/C++ compiler run-time library allows the usage of ANSI C standard file I/O functions. The File System Component is designed for Cortex-M processor-based devices and requires an CMSIS-RTOS compliant real-time operating system for thread-safe operation.

The File System Component uses two different file systems depending on the media type:

Using the File System

The File System Component requires a CMSIS-RTOS compliant RTOS to be present and can not be used with the MicroLIB library, due to missing functions required for file operations. The following picture shows the File System's structure from a developer's perspective.

fs_structure.png
File System Component Structure

System, File Management

System and file management functions are used to to manage the File System and have operations such as file formatting, creating, finding, renaming, etc.

Standard File I/O

Standard I/O functions perform input and output operations on files, such as reading, writing, printing, etc.

ARM Standard Run-Time Library

Represents the standard C library with functions to manage data in files.

File_Config.c

This configuration file determines general characteristics for all media.

File_Config_xxx_0.h

The drive configuration files (File_Config_MC_0.h, File_Config_NAND_0.h, File_Config_USB_0.h, File_Config_NOR_0.h, and File_Config_RAM.h) define the media type characteristics.

File System Core

It handles low-level input and output file operations. These operations are retargetted within the Core itself. Depending on the present configuration files in a project, the File System Core detects the appropriate file system: FAT or EFS. Also, the core implements a NAND Flash Translation Layer (NAND Layer).

IOC - FAT Media API

Using the IOC API, media with FAT file system can be accessed in raw sectors.

FAT, EFS Media

SD/SDHC/MMC memory cards, NAND Flash devices, USB memory sticks, and RAM disks are supported by the FAT file system. The Embedded File System is supported for NOR/SPI Flash devices.

Drivers

The File System Core accesses the drives through the device drivers that are part of the device family pack. For every drive a dedicated driver is in place.

The configuration steps and files that are needed to create applications for the different devices are explained here:

Drive

The File System Component supports various memory and storage devices that are assigned to a drive.

fs_types.png
File System Component: Media types and Drives

All available drives are defined with the RTE Component Selection. A drive is passed as string to System Routines and may be part of a filename. The system allows you to configure a default drive that is used when no drive is specified as part of the filename.

Drive File System Drive Type
"F:" or "F0:"EFS NOR or SPI Flash drive 0
"F1:" EFS NOR or SPI Flash drive 1
"R:" or "R0:"FAT RAM drive
"M:" or "M0:"FAT Memory Card (SD, SDHC, MMC) drive 0
"M1:" FAT Memory Card (SD, SDHC, MMC) drive 1
"U:" or "U0:"FAT USB Memory Stick drive 0
"U1:" FAT USB Memory Stick drive 1
"N:" or "N0:"FAT NAND Flash drive 0
"N1:" FAT NAND Flash drive 1
Note
In a project, a Default System Drive needs to be declared. This can be done in the configuration file of every drive type (for example in the File_Config_MC_0.h file for SD/SDHC/MMC drives). This default system drive is used for File System functions that are invoked with the "" string.