Micro Disk is an application to generate a micro disk images for SD cards. This is a special minimal file system for embedded projects with very low available resources. Using this file system you can provide large amounts of data from a attached SD card. The file system is strictly read-only, it is not meant to modify the SD card.
The SD card library used in the Cat Protector project uses this format to save a number of sound files on the SD card.
Update 2017-03-06: Released version 1.1.0 of the software with an option to generate images for older non-HC SD cards.
File System Features
- File directory with ASCII file names.
- Single file list which can store any number of files.
- For each file, a name, the start block and the size in bytes is stored.
- All files are stored in sequential blocks which makes reading simple and fast.
- All files are aligned to the 512 byte blocks for a SD card.
Here screenshots of the Mac and Windows version of the tool.
- LuckyResistor Micro Disk 1.1.0 Mac
- LuckyResistor Micro Disk 1.1.0 Windows
The usage of the tools is very simple:
- Start the Micro Disk tool.
- Add files using the “Add File” button, or the “Add File…” menu entry. You can select and add multiple files.
- Change the identifier of the files how they should be named in the image.
- Click on the “Generate…” button, or select “Generate…” in the menu to create a disk image from the files in the list.
- Select a file name and directory and click on “Save”.
Now you have an image file. You can copy the image file on a SD card, similar like a Raspberry Pi operating system, as explained in this great documentation:
Old non-HC SD Cards
If you generate an image for an old non-HC SD card, please check the option below the file list to make this images compatible with some software.
Micro Disk Format
The micro disk format is an open format which you can use and adapt in your own projects.
Each disk image starts with the four “magic” bytes 0x48, 0x43, 0x44, 0x49 which are the ASCII text “
The file directory can contain any number of file entries. Each entry starts with a four byte, little endian integer which points to the start block of the data of the file. Next is a four byte, little endian integer with the file size in bytes. After this one byte with the length of the file name follows. The length must not be zero. After the byte with the length, the bytes for the file name follow. There are no restrictions about the file name, but it should be as short as possible and ideally encoded as ASCII text.
This structure is repeated for each file entry. At the end of the file directory, there are four zero bytes. Because this would be the start block of the next entry, you just can check for a zero start block which marks the end.
The directory can span any number of blocks. After the end of the directory padding bytes follow until the end of the current block.
File data always starts at a new block. The data is written sequentially over the following blocks. At the end, any remaining bytes of the block are filled with zero bytes. This is also true for the last block of the image.
This is repeated for every file on the disk.
You can find the sources of the application on GitHub:
The sources are licensed under the GNU General Public License version 3.
1 thought on “Micro Disk”