FAT filesystem using EMMC media
This application shows an example of using the FAT filesystem to access and modify the contents of a eMMC device using contents from SD card.
Description
Following file system operations are performed by this application:
- Application checks if the eMMC card is having Valid File system. If not then it Formats the eMMC card to FAT32
- Application reads a file with name FILE_TOO_LONG_NAME_EXAMPLE_123.JPG in the root directory of SD-card media
- Application then creates a new directory in the root directory of EMMC media with the name Dir1
- Application creates a new file in the directory Dir1 in the eMMC media with name FILE_TOO_LONG_NAME_EXAMPLE_123.JPG
- Application writes the content it read from step 1 into the newly created file
- Application creates a new directory in root directory of the SD Card filesystem
- Application copies the file (by following steps above) from eMMC/Dir1 to sdcard/Dir1
The reason for choosing a JPEG file for test purposes is that the duplicate file, Dir1/FILE_TOO_LONG_NAME_EXAMPLE_123.JPG created by the demonstration could be easily verified for correctness.
If the new file inside Dir1 opens for viewing on the computer and matches to original image, the test is deemed to have passed. Otherwise, if the file does not open (i.e., is corrupted), the test will be considered to have failed.
Downloading and building the application
To clone or download this application from Github, go to the main page of this repository and then click Clone button to clone this repository or download as zip file. This content can also be downloaded using content manager by following these instructions.
Path of the application within the repository is apps/fs/emmc_sdmmc_fat_multi_disk/firmware .
To build the application, refer to the following table and open the project using its IDE.
Project Name | Description |
---|---|
sam_a5d2_xult.X | MPLABX project for SAMA5D2 Xplained Ultra Evaluation Kit |
Setting up AT91Bootstrap loader
To load the application binary onto the target device, we need to use at91bootstrap loader. Refer to the at91bootstrap loader documentation for details on how to configure, build and run bootstrap loader project and use it to bootstrap the application binaries.
Setting up the hardware
The following table shows the target hardware for the application projects.
Project Name | Board |
---|---|
sam_a5d2_xult.X | SAMA5D2 Xplained Ultra Evaluation Kit |
Setting up SAMA5D2 Xplained Ultra Evaluation Kit
Addtional hardware required
- SD Card with FAT32 file system
Setting up the SD Card
- Create a new JPEG file in the SD Card with name FILE_TOO_LONG_NAME_EXAMPLE_123.JPG
Setting up the board
- Insert the SD card into SDMMC slot on the board
- Short jumper JP2 (DEBUG_DIS)
- Connect the Debug USB port on the board to the computer using a micro USB cable
- Jumper JP9 (BOOT_DIS) should be open
Running the Application
- NOTE: To run this demo successfully, on board eMMC device should have a valid FAT partition
- Build the application using its IDE
- The LED is turned ON if there was no error during creating the directory and copying the file into it
Refer to the following table for LED name:
Board | LED Name |
---|---|
SAMA5D2 Xplained Ultra Evaluation Kit | RGB_LED(Green) |