Go Down

Topic: SD/FAT library with the smallest possible code size (Read 1 time) previous topic - next topic


I am looking for a read-only SD/FAT library that produces the smallest possible code. I need read only and am able to sacrifice some features for code size such as single folder, etc...

Before I start on heavily modifying an existing library, I wondered what others may have stumbled on. Also, is there a configurable library where I can pick and choose features I need? Something like that would be a one-size fits all for me!


Before I start on heavily modifying an existing library

Modifying a library just doesn't work since read and write are so intertwined.  Better to find a small library.

I wrote a very small read only library for an Adafruit Audio shield.  It is included in the WaveHC library http://code.google.com/p/wavehc/downloads/list.  It will be a bit tricky to use it standalone.

Another option is Fat16.  It is a minimal read/write library.  The read example takes about 8 KB total flash and includes Serial so the SD/FAT code is under 6 KB.


I wrote an extremely small SD read program, under 2 KB, as the base for a bootloader.  it is attached to this post (you must be logged in to see it) http://arduino.cc/forum/index.php/topic,89478.msg676133.html#msg676133.


Excellent! Thank you! I will likely need to modify it some for my purposes, but these look like they will make a great base.


If your mods are to reduce code size, be sure to test that your mods actually work.

Many people rip things out of my libraries thinking their app will be smaller and then find little memory has been saved.

I try to implement libraries so only code for used features is linked.

The big problem is open().  Traditionally open is for read, write and file creation.  This causes the minimal size for read to be large since a lot of the write functionality is required for file creation. 

I considered a special openForRead() in SdFat but there have not been many requests for a small read only size.


Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131