-
Notifications
You must be signed in to change notification settings - Fork 3k
Description
Description
- Type: Bugs
- Priority: Major?
Bug
Target
LPC4088
Toolchain:
GCC_ARM - yes
ARM|IAR - untested
Toolchain version:
mbed-cli version:
1.2.2
mbed-os sha:
2b4ff78
Expected behavior
readdir()
returnsNULL
to terminate a directory listing.FATFileSystem
writes files to SD Card at a relatively consistent speed.FATFileSystem
never corrupts the file system on the SD Card.
Actual behavior
- When operating on a directory on a FAT32 volume containing the maximum number of files per directory (65534),
readdir()
never returnsNULL
. - Increasing the number of files in a directory slows down
FATFileSystem
writes. - Under certain cirumstances,
FATFileSystem
(orSDBlockDevice
?) corrupts the file system on the SD Card. (i.e. It can no longer be read byFATFileSystem
, nor by a Windows PC.)
Steps to reproduce
I forked ARMmbed/mbed-os-example-filesystem to create demo code for items 1
and 2
. There are tags (linked below) for each of these. I don't have code to share for 3
yet, but I give details below.
All testing was done with an Embedded Artists' LPC4088 QuickStart Board connected to an LPC4088 Experiment Base Board (EBB). The EBB is used for its SD Card slot. Jumpers are configured to use the SPI interface to the SD Card (per Figure 7 in the EBB user guide (PDF)).
I made a small patch to mbed OS so that GCC_ARM will malloc()
from the LPC4088's external SDRAM like the mbed online compiler does. Demo programs 1
& 2
use megabytes of memory for a HeapBlockDevice
. You should be able to replace this with an SDBlockDevice
to avoid the large memory use and test on another target device, but of course this is slower to run.
Of course, add your choice of Serial
device to output printf()
text.
- bug01-mbed-os-5.7.1-65534-files-dirent-ne-null (1fa0b0b)
- bug02a-mbed-os.5.7.1-write-slowdown-empty-files (6ab378b)
bug02b-mbed-os.5.7.1-write-slowdown-small-files (d891ad3) - Using an 8 GB SD Card, write many files to a directory. After each file write, append text via
fprintf()
to a metadata file in the directory, and a log file in the parent directory.- Circumstance 1: Files are exactly 512 KiB each, written via
fwrite()
. Filesystem is corrupted after writing to the 8160th file. I observed this particular failure mode on at least two units. - Circumstance 2: Files are approximately 7.5 MB each, written via
fprintf()
. Filesystem is corrupted after filling up the volume. Observed on one unit so far.
- Circumstance 1: Files are exactly 512 KiB each, written via