3 ms·
FAT is enjoyable! I spent a rather insane summer on a personal project to implement a FAT16 interface speaking the SD protocol to an SD card over an SPI bus....
by Twisol 7y ago
FAT is enjoyable! I spent a rather insane summer on a personal project to implement a FAT16 interface speaking the SD protocol to an SD card over an SPI bus.... from scratch. I think I had five spec documents open simultaneously at one point, spanning the stack from FAT to the microprocessor I was using.
It was insane, but I learned an incredible amount from it. Would recommend, even if you focus only on FAT.
- gmueckl 7y agoCool project! Doing things like that from scratch can teach a lot. Was your implementation able to write to the SD card, too? This seems like the much hard part to me because you need to do implement the data structure changes and block allocations for files. Reading from a file system often boils down to following the right offsets until you get to file content, at least in journal-less file systems.
- Twisol 7y agoYeah, writing was supported too. Absolutely was the harder part, since you have to worry about allocating new segments for your directories as your filesystem grows. Ironically, looking at my code now, it seems like I never got around to actually writing file contents. I seem to have stopped after finishing the overall FAT16 filesystem structure traversal and mutation. The SD card module was a little simpler, because I only really needed to implement flows for the commands involved in initialization and single-block reads and writes. The SD card presents a block-oriented storage interface, but it doesn’t really care what you’re storing otherwise.