File System Component
Version 6.16.6
MDK Middleware for Devices with Flash File System
|
This section describes the resource requirements of the File System component. The actual requirements depend on the features used in the application. Therefore, the numbers provided here are guidelines only and the actual numbers may differ.
The File System component receives events sent from the interrupt service routine (ISR) of the drivers of the different drives. The stack requirements for the ISR are typically less than 512 Bytes. The stack requirements for ISR are configured in the startup_device.s file located under the Device component class.
Option (under section Stack Configuration) | Increase Value by |
---|---|
Stack Size (in Bytes) | + 512 for Driver of a Drive |
Heap is used by memory allocation functions. It is also configured in the startup_device.s file located under the Device component class. For every simultaneously opened file, you need to configure 512 + 96 Bytes of additional heap. If you wish to have three files open simultaneously, you need to configure an additional heap size of 3 x (512 + 96) Bytes.
Option (under section Heap Configuration) | Increase Value by |
---|---|
Heap Size (in Bytes) | + (512 + 96) for each open file |
Although the File System component requires a CMSIS-RTOS to be present, it is not creating any additional threads.
Using CMSIS-RTOS RTX v5
The calling thread can no longer be main
but can be a thread with a default stack size (dynamic memory) or a thread with a complete stack or only stack size provided using osThreadAttr_t
structure (static or dynamic memory).
Using CMSIS-RTOS RTX v4
For proper operation, you need to add a certain amount of thread stack size to the calling thread. This calling thread can be the main
thread, a thread with a default stack size or a thread with a user provided stack size. For the additional required stack size, please refer to the following table:
Drive Type | Value |
---|---|
RAM | min. 0.6 kBytes |
MCI | min. 0.7 kBytes + MCI Driver |
NAND | min. 1.3 kBytes + NAND Driver |
NOR | min. 0.4 kBytes + Flash Driver |
USB | min. 1.1 kBytes + USB Driver |
The thread requirements need to be reflected in the CMSIS-RTOS configuration. Refer to the Reference section of for further details.
For , the threads requirements are configured in the file located under the CMSIS component class:
Option (under section Thread Configuration) | Increase Value by |
---|---|
Default Thread stack size [bytes] | Stack size from table above |
or | |
Main Thread stack size [bytes] | Stack size from table above |
or | |
Total stack size [bytes]for threads with user-provided stack size | Stack size from table above |
Additionally, you may also need to adjust the number of mutex objects required by the C stdio library. Total number of mutex objects required for proper operation is as follows:
Using CMSIS-RTOS RTX v5
Memory for mutex objects is allocated from the dynamic memory pool (RTX_Config.h - System Configuration - Global Dynamic Memory size [bytes]). The size of dynamic memory pool must be configured so that the control blocks for the mutexes mentioned above fit inside. The size of a control block for a mutex depends on the RTOS2 implementation. For RTX5 can be found in rtx_os.h and is equal to the size of osRtxMutex_t
.
Using CMSIS-RTOS RTX v4
The number of mutex objects required by stdio library is configured in the file located under the CMSIS component class.
Definition (under section Standard library system mutexes) | Set value to |
---|---|
OS_MUTEXCNT | 5 + 1 for each open file |
The following table shows the memory requirements for read-only (Flash) and read-write (RAM) memory. These numbers may be used to estimate the total size requirements of the application, but the actual numbers depend on compiler optimizations and target processor and may be therefore slightly different.
Component | RO Memory [Bytes] | RW Memory (Data) [Bytes] |
---|---|---|
C stdio Library | < 5.0 k | < 0.3 k |
::File System:Core Common | < 3.5 k | 0 |
::File System:Core EFS (Embedded File System) | < 6.0 k | < 0.4 k |
::File System:Core FAT with SFN (Short File Name) | < 13.0 k | 1.2 k |
::File System:Core FAT with LFN (Long File Name) | < 14.4 k | 1.2 k |
::File System:Core FAT Name caching | 1.6 k | 48 * FAT Name Cache Size (configured in FS_Config_Drive_n.h) |
::File System:Core FAT Journaling | 0.7 k | 0.5 k (configured in FS_Config_Drive_n.h) |
::File System:Drive:Memory Card (FAT) | 2.7 k | < 0.2 k + Drive Cache Size (configured in FS_Config_MC_n.h) |
::File System:Drive:NAND (FAT) | < 10.6 k | < 0.7 k + Drive Cache Size + Page Caching + Block Indexing (configured in FS_Config_NAND_n.h) |
::File System:Drive:NOR (EFS) | < 0.1 k | < 0.1 k |
::File System:Drive:RAM (FAT) | < 0.2 k | < 0.2 k |
::File System:Drive:USB (FAT) | < 0.6 k | < 0.2 k + Drive Cache Size (configured in FS_Config_USB_n.h) |
MCI Driver | 1 .. 4 k | 0.1 .. 2 k |
NAND Driver | 0.5 .. 4 k | 0.1 .. 4 k |
Flash Driver | < 2 k | < 0.1 k |