Fat Recs

2007-12-09 02:04:13 PM
Well, this was a fun project, and I pulled my remaining hair out.
I have the flash memory working pretty good. It's keeping good track of the
files so far (now) and allows the user to retrieve the desired files. The
user (on the remote end) never knows any difference. Telnet, Ftp are fooled
as well for directory listings.
I still have to test the sector changes when one sector gets full. It
"should" work, but building up 64k of logs multiple times is fun. I may
just create a large buffer to simulate some large logs and write it a few
times to speed up the testing.
One thing for sure I have to add in is some error checking for the writes.
I currently make sure the file is written before I update the FAT, but
since I can only write to the same spot once without erasing I have to
figure out the best way to handle an error writing.
If I can't write a file to Block 1, then I should skip straight to block 2,
write the file then update the FAT. I don't want to erase block 1 until
block 2 is full because I will loose a lot of historic data.
I will most likely add a verify fucntion that will see if the file I just
wrote is okay. If not, I will try to write it again in a different spot,
then update the FAT record with the new start pos and len.