fat32rs
Minimal FAT32 client written in #[no_std] Rust.
This is library was designed to operate within some specific constraints imposed by running in an embedded systems environment.
Based on this original Python prototype: fat32py
*The following instructions assumes a Linux or Mac environment
Features
The only features implemented are:
- List the files in the root directory of the drive
- Append to a file on the drive
- Create a new file in the root directory of the drive
- Get a root directory file by name
Setup
All you should need is a working dev environment for Rust with Cargo installed. You can find instructions here.
Running
To run the examples simply run the below:
Note: If you want to read from your own physical drive, you can pass an argument like /dev/diskn which will run against your physical drive.
I recommend using an SDCard. If you plug one into you system, you can see the name for it by listing all the files in your /dev directory:
Tests
You can run tests by running:
This will use a 64MB .img drive preloaded with test files which you can find at ./tests/data/drive.img.
Generating a disk image fixture
This will create an empty .dmg image formatted for FAT32 with the volume name DRIVE.
This will create an empty .dmg image formatted for FAT32 with the volume name DRIVE.
# this output you will need for the next step, will be different for your system
You can now use the disk as normal. If you are using the drive committed in this repo, you will notice it has two files LOG-1 and LOG-2. These are used by the tests. However, you can add or modify the drive as you like, just make sure to update the tests!