The phyCORE-i.MX7 SOM brings out a 4 bit wide MMC data bus to the microSD connector X11. This guide will walk through reading and writing to devices connected here.
In order to make the microSD connector available, you will have to first boot into Linux from eMMC. See Flashing and Booting From eMMC for more information.
Step-by-Step Guide
When an external SD Card is inserted, it will be mounted automatically and will also be available as /dev/mmcblk0 in Linux when booting from eMMC.
Write to the SD Card
You can use basic Linux commands to create and write files to the SD card. Below is an example:
Target (Linux)
echo "Hello World" > ~/test.txt
cp ~/test.txt /run/media/mmcblk0p1
CODE
Read from the SD Card
To read what was just written to the SD card in the previous example, use the following command:
Target (Linux)
cp /run/media/mmcblk0p1/test.txt ~/read.txt
CODE
To check that the file read (read.txt) is the same that was written (test.txt) you can use md5sum to compare and verify the data transfer was successful:
Target (Linux)
md5sum ~/test.txt && md5sum ~/read.txt
CODE
The above command will generate a long and seemingly random string of characters for both files. This long string is called a "hash" and it uniquely identifies the files. If the hash for both files match then you can be confident that both files (down to each bit) are identical.
Unmount the SD Card
Before unplugging the device from the development kit, make sure to unmount it. You can do this by running the following command:
Target (Linux)
umount /run/media/mmcblk0p*
CODE