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

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 consists of two different file systems, placed on top of different layers, depending on the media type:

Using the File System

The File System Component integrates with the ARM Standard Run-Time Library and requires a CMSIS-RTOS compliant RTOS. It cannot be used with the ARM MicroLIB library since this library does not provide the hooks for I/O file handling.

The following picture shows the File System's structure from a developer's perspective.

File System Component Structure
  • System, File Management: functions that manage the File System and provide operation to format a drive and manage files and directories.
  • Standard File I/O: functions to perform input and output operations on files, such as read, write, and seek.
  • ARM Standard Run-Time Library: is the ARM Compiler standard C library with functions to manage file.
  • FS_Config.c: configuration file for general characteristics of the file system.
  • FS_Config_xxx_n.h: configuration file for the characteristics of each drive or media(MC, NAND, NOR, RAM, or USB memory sticks).
  • File System Core: handles low-level input and output file operations (some are re-targeted to use the ARM Standard Run-Time Library). Depending on configuration settings, it uses the appropriate file system (FAT or EFS) and implements the NAND Flash Translation Layer.
  • IOC - FAT Media API: are I/O Control Interface Routines for the FAT file system to access physical sectors.
  • FAT, EFS Media: the FAT file system supports Memory Cards (MC), NAND Flash, and USB memory sticks, and RAM disks. The Embedded File System (EFS) supports NOR Flash devices.
  • Drivers The File System Core accesses the drives via CMSIS-Drivers that are typically part of the Device Family Pack. Every drive uses dedicated driver.

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

Drives, Memory Devices and Drivers

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

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 current drive that is used when no drive is specified as part of the filename.

The file system type is automatically chosen depending on the drive type (which correlates to a certain memory device). Some drives may use different interfaces that will be covered by appropriate CMSIS-Drivers. The following table shows the relationship between drive - memory device - and driver/interface:

Drive File System Drive Type CMSIS-Driver/Interface
"F:" or "F0:"EFS NOR Flash drive 0 (Memory Bus or
"F1:" EFS NOR Flash drive 1 (Memory Bus or
"R:" or "R0:"FAT RAM drive N/A
"M:" or "M0:"FAT Memory Card drive 0 or
"M1:" FAT Memory Card drive 1 or
"U:" or "U0:"FAT USB Memory Stick drive 0
"U1:" FAT USB Memory Stick drive 1
"N:" or "N0:"FAT NAND Flash drive 0 (Memory Bus)
"N1:" FAT NAND Flash drive 1 (Memory Bus)
  • NOR Flash is typically connected over Memory Bus or SPI. For using a NOR Flash drive, a Flash driver is required which encapsulates either the Memory Bus interface or SPI (in which case an SPI driver required in addition).
  • The Middleware Component contains example drivers for Flash devices that can be used to implement other device drivers if required. The examples are: AM29x800BB/M29W640FB (Flash with 16-bit memory bus interface), S29GL064Nx2 (Flash with 32-bit memory bus interface), and AT45DB642D (Flash with SPI interface using an SPI driver).
  • Other drives (memory card, USB memory device, NAND Flash) require appropriate CMSIS-Driver for the microcontroller device. If no suitable CMSIS-Driver is available for your selected device, you may create the required Flash interface driver. Refer to the for details.
  • Currently, using NAND Flash devices with SPI interface (Serial NAND) is not supported.

Current Drive

The Current Drive defines the drive used when the filename itself does not specify the drive or when functions that expect a drive are called with an empty ("") string.

An Initial Current Drive is defined in the FS_Config.c configuration file and is used at startup to set the Current Drive. The Current Drive can be changed during run-time using the function fchdrive.