This example shows how to manipulate files on a memory drive using the File System Component.
You can mount and format the drive and then perform operations like write, read, rename and delete to manage files and directories on any enabled drive. Example uses serial terminal connection to interact with the user.
Typically one connects the development board to a computer via debug connection that also provides virtual COM port, downloads example application to a board and starts terminal application on computer.
The following picture shows an exemplary connection of the development board and a computer:
The File Demo project is available as part of the File System Reference examples.
Following files implement application-specific logic in the example:
File_Demo.c
contains the main application thread and implementation of commands for user interaction.Configuration files for the software components used in the project are available in the ./RTE/
directory and can be modified by users to adjust the operation of related components.
Following configuration files are provided with this example:
./RTE/File_System/
folder:FS_Config.h
: File System configuration.FS_Config_MC_0.h
: File System Memory Card configuration.FS_Debug.h
: File System Debug configuration../RTE/CMSIS/
folder:RTX_Config.h
and RTX_Config.c
: CMSIS-RTX Configuration files for the RTOS Kernel.When a board layer is added to the project, corresponding configuration files for the board and device components will become available in the local ./Board/
directory.
In order to build the project it shall be extended with a compatible board layer that provides following interfaces as connections:
CMSIS_MCI
: CMSIS-Driver for Memory Card InterfaceCMSIS_VIO
: CMSIS-Driver for Virtual I/O interfaceSTDIN
: Standard Input redirectionSTDOUT
: Standard Output redirectionWorking with MDK-Middleware Examples explains the workflow for accessing, configuring and building an MDK-Middleware example project for your target hardware.
Setup
Board-specific hardware setup such as jumpers, SD card ports, power supply, etc. is documented in the board layer description (README.md
) of your selected target.
Example execution
Open any software terminal emulator application to start interacting with the example running on the Evaluation Board. After resetting the board, you should see something similar like this:
Now you can type help to the command prompt and press enter (make sure that the new line character is also sent after pressing enter). Now something similar to the below image should be printed:
You can now type the listed commands and send arguments directly to the FileSystem API functions.