I strongly believe that there is a bug in fcheck. If I create a simple file on S:, fcheck returns that the file system is inconsistent afterwards. Tracing down the problem pointed me to a bug in fs_fcheck.c:
for (bl = 0; bl < fcb->NumSect; bl++) { /* Check all File Blocks for invalid FID and check file pointers for */ /* reasonable values in ascending order. */ adr = fs_adr_sig (bl, fcb); adr = fs_rd_sig (adr, &fa.end); if (fa.end != fcb->InitVal) { sa = ((DEVCONF *)fcb->DevCfg)[bl].bStart; for (prev = 0; ; prev = fa.end) { adr = fs_rd_alloc (adr, &fa); if (fa.end == fcb->InitVal) break; // << this line has to be here!! if (fa.fileID == 0x8000) { /* Error, not existing file ID. */ return (1); } if (fa.end < prev) { /* Error, not ascending allocation pointers. */ return (1); } if ((sa + fa.end) > (adr & ~1)) { /* Error, overlapping file allocation record. */ return (1); } // if (fa.end == fcb->InitVal) break; // << originally, the line was here. // but if 'sa' == 0 (first file on SPI-Flash Drive is at origin '0'), the // check above "if ((sa + fa.end) > (adr & ~1))" fails already, because fa.end == 0xFFFFFFFF!!! } } }
Does anybody else already have had the same problem?