All Projects → Spxg → fat32

Spxg / fat32

Licence: MIT license
[New Version] This is FAT32 FileSystem Library, which is #![no_std] and does not use alloc.

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to fat32

Littlefs
A little fail-safe filesystem designed for microcontrollers
Stars: ✭ 2,488 (+9852%)
Mutual labels:  embedded, filesystem
littlefs2
Idiomatic Rust API for littlefs
Stars: ✭ 19 (-24%)
Mutual labels:  embedded, filesystem
libDaisy
Hardware Library for the Daisy Audio Platform
Stars: ✭ 164 (+556%)
Mutual labels:  embedded
lv lib split jpg
JPG decoder for LVGL
Stars: ✭ 22 (-12%)
Mutual labels:  embedded
mish
A no-std libm implementation in Rust
Stars: ✭ 14 (-44%)
Mutual labels:  embedded
rauc-hawkbit-updater
The RAUC hawkBit updater is a simple commandline tool/daemon that runs on your target and interfaces between RAUC and hawkBit's DDI API.
Stars: ✭ 40 (+60%)
Mutual labels:  embedded
dockage
embedded document/json store
Stars: ✭ 20 (-20%)
Mutual labels:  embedded
apfs
Package apfs implements an Apple File System(apfs) bindings for Go
Stars: ✭ 30 (+20%)
Mutual labels:  filesystem
utilities
Utilities add-in for the Casio Prizm (fx-CG 10 and 20)
Stars: ✭ 34 (+36%)
Mutual labels:  embedded
BootProg
FAT12/16/32 Bootsector for .COMs/.EXEs
Stars: ✭ 74 (+196%)
Mutual labels:  fat32
flysystem-sync
Filesystem sync using Flysystem project.
Stars: ✭ 26 (+4%)
Mutual labels:  filesystem
ModernOperatingSystems AndrewTanenbaum
My notes after reading 'Modern Operating Systems' book by Andrew Tanenbaum and Herbert Bos.
Stars: ✭ 71 (+184%)
Mutual labels:  filesystem
gcsfs
Google Cloud Storage filesystem for PyFilesystem2
Stars: ✭ 36 (+44%)
Mutual labels:  filesystem
micropython-micropower
Support for building ultra low power systems based on the Pyboard (1.x and D series).
Stars: ✭ 44 (+76%)
Mutual labels:  embedded
rebuild
Zero-dependency, reproducible build environments
Stars: ✭ 48 (+92%)
Mutual labels:  embedded
CapableRobot USBHub Driver
www.crowdsupply.com/capable-robot-components/programmable-usb-hub
Stars: ✭ 17 (-32%)
Mutual labels:  embedded
MeowDB.js
Database in JSON (Node.JS Library)
Stars: ✭ 12 (-52%)
Mutual labels:  filesystem
ansible-role-glusterfs
Ansible Role - GlusterFS
Stars: ✭ 95 (+280%)
Mutual labels:  filesystem
w1-gpio-cl
Command line configured kernel mode 1-wire bus master driver. w1-gpio standard Linux module enhancement/substitution.
Stars: ✭ 17 (-32%)
Mutual labels:  embedded
vk-music-fs
FUSE file system for VK audios
Stars: ✭ 34 (+36%)
Mutual labels:  filesystem

News

This crate has stopped updating, please use rust-fatfs.

FAT32 FileSystem Library

crates.io version

This is FAT32 FileSystem Library, which is #![no_std] and does not use alloc.

Test passed with sdio_sdhc and WindowsAPI.

Supported Features

  • Read
  • Create File AND Dir
  • Write(OverWritten and Append)
  • Delete File AND DIR

Questions

My Device Support std, Can I Use This Crate?

Of course you can, but I don't recommend it. You should use std::fs::File OR other crates.

Why Do You Write This Crate?

In order to support devices and environment which don't have std, like

  • Embedded Device
  • Bootloader

Have More Examples?

How To Test (Only Windows)

  • EDIT mount() function in lib.rs, change disk like \\\\.\\E:
  • cargo test

How To Use

You need make your library implement BlockDevice trait:

pub trait BlockDevice {
    type Error;
    fn read(&self, buf: &mut [u8], address: usize, number_of_blocks: usize) -> Result<(), Self::Error>;
    fn write(&self, buf: &[u8], address: usize, number_of_blocks: usize) -> Result<(), Self::Error>;
}

For example, I use my another library sdio_sdhc to implement:

impl BlockDevice for Card {
    type Error = CmdError;

    fn read(&self, buf: &mut [u8], address: usize, number_of_blocks: usize) -> Result<(), Self::Error> {
        if number_of_blocks == 1 {
            self.read_block(buf, address as u32)?
        } else {
            self.read_multi_blocks(buf, address as u32, number_of_blocks as u32)?
        }

        Ok(())
    }

    fn write(&self, buf: &[u8], address: usize, number_of_blocks: usize) -> Result<(), Self::Error> {
        if number_of_blocks == 1 {
            self.write_block(buf, address as u32)?
        } else {
            self.write_multi_blocks(buf, address as u32, number_of_blocks as u32)?
        }

        Ok(())
    }
}

Now sdio_sdhc library supported fat32 filesystem. Then, add fat32 library to your application

# if no feature config, the BUFFER_SIZE is 512 Bytes
fat32 = "0.2"

If your card block is other size, like 1024 Bytes

[dependencies.fat32]
version = "0.2"
default-features = false
features = ["1024"]

Then, you can do some tests

// Card from sdio_sdhc crate
let card = Card::init().unwrap();
// Volume from fat32 crate
let cont = Volume::new(card);
// cd root dir
let mut root = cont.root_dir();
// create file named test.txt
root.create_file("test.txt").unwrap();
// open file
let mut file = root.open_file("test.txt").unwrap();
// write buffer to file
file.write(&[80; 1234]).unwrap();

If all goes well, the file was created with 1234 Bytes in root dir.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].