MMC (or SD) questions again

Gene Smith gds at chartertn.net
Mon Jan 12 04:36:31 UTC 2009


Never received any comments on my detailed answers to questions asked 
last week regarding using MMC with shell and fat16 (subj: MMC msdos fs 
corrupt when files copied in shell). So I will ask a different way.

In the shell when I do a cp of a pre-existing file I see a multiple 
write of 4 blocks (512 bytes each) even when the file is very small. I 
assume this is because of the 4 segments per cluster?

Anyhow, I only see the contents of the copied file at the beginning of 
the 4th of the 4 segments that get written. Is that how it would 
normally work when a small file (<20 bytes) is copied? The first 3 
segments contain data that is meaningless (to me) and get written to 
flash, then the 4th gets written and it contains the copied file contents.

Also, after I do the copy I can cat the file. The contents display 
correctly then for some reason I see another write occur. This time it 
is a single segment, not 4. Not sure why cat'ing the file would cause a 
write to the card to occur.

Its seems like if I don't cat the newly copied file, it does not exist 
when rtems is restarted. (Unmount or blksync commands don't seem to 
matter or cause flash writes but cat does.)

If my card is formatted and initialized with data on another system, 
when I move it to the rtems system everything reads ok in the shell. But 
if I write a new file in the shell with cp and cat the file the new file 
shows up ok in rtems until I restart rtems and then the new file is 
corrupt or empty. The original files and directories remain OK.

Can anyone else run an SD or MMC in the shell and copy files OK?

Thanks,
-gene






More information about the users mailing list