I posted a new SdFat beta with full support for Long File Names here GitHub - greiman/SdFat-beta: Beta SdFat for test of new features.
Long File Name support is optional so I decided to compare the size of SD.h with the new SdFat.
I used a simple program that creates a file, wtite a line to the file, and closes the file. Here is the test program.
// Program to compare the size of SdFat with the SD.h library.
// Select the test library by commenting out one of the following two lines.
// #include <SD.h>
#include <SdFat.h>
// SD chip select pin.
const uint8_t SD_CS_PIN = SS;
#ifdef __SD_H__
File file;
#else // __SD_H__
SdFat SD;
SdFile file;
#endif // __SD_H__
void setup() {
Serial.begin(9600);
while (!Serial) {} // wait for Leonardo
if (!SD.begin(SD_CS_PIN)) {
Serial.println("begin failed");
return;
}
#ifdef __SD_H__
file = SD.open("SFN_file.txt", FILE_WRITE);
#else // __SD_H__
file.open("LFN_file.txt", O_RDWR | O_CREAT);
#endif // __SD_H__
file.println("Hello");
file.close();
Serial.println("Done");
}
//------------------------------------------------------------------------------
void loop() {}
Here are the sizes using 1.0.6 with an Uno.
SD.h SFN 13,286 bytes
SdFat LFN 11,112 bytes (SD.h program is 19% larger)
SdFat SFN 9,670 bytes (SD.h program is 37% larger)
So, if you don't need LFN, SD.h is 37% larger. You can use LFN and SdFat is still smaller.
SdFat now has a comparability mode API so converting from SD.h to SdFat is easy.
Here are some other features of the new SdFat.
Replaced the core SdFat code with FatLib, a generic FAT12/FAT16/FAT32
library. This may result in some backward compatibility problems.Added SdFatSoftSpi, a software SPI template class. See the SofwareSpi
example.Added SdFatLibSpi, a class that uses the Arduino SPI.h library.
Allow simultaneous use of hardware and software SPI with multiple cards.
See the ThreeCard example.Added the "File" class for compatibility with the Arduino SD.h library
Added StreamParseInt example to demonstrate the SD.h API.