Pages: [1]   Go Down
Author Topic: SD/FAT library with the smallest possible code size  (Read 727 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
God Member
*****
Karma: 27
Posts: 829
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

0
Offline Offline
Edison Member
*
Karma: 67
Posts: 1675
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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.

http://code.google.com/p/fat16lib/downloads/list.

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.
Logged

Offline Offline
God Member
*****
Karma: 27
Posts: 829
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

0
Offline Offline
Edison Member
*
Karma: 67
Posts: 1675
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 24
embedded
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I vote for the openForRead!
Logged

Pages: [1]   Go Up
Jump to: