We ran into a problem of FlashDisk files’ disappearance on Colibri T20 BSP 2.4b2.
If a file/folder is created on the FlashDisk 500-1000 ms before a coldboot, it won’t remain on the flash after boot is completed. If delay is 1500 ms, the files/folders do remain.
Tegra T20 doesn’t have an eMMC. It has a raw NAND. So all flash handling done by WinCE itself. And trim is not applicable here. The file system uses a cached write sequence. So when your application writes to flash it writes it to ram. A thread in the background writes the ram sectors to flash. Another thread is also responsible for garbage collection and sector wear levelling.
The 2.4 BSP has a FlushTimeout set to 500ms plus mentioned thread needs some time to do its job. It has a low priority and a high CPU load can delay it.
What is your use case? Can you reboot a system after 1.5 sec delay after write?
Certainly, we can add some delay. However if it’s possible, we would like not to depend on an unreliable timeout, but to call some flushing function before resetting.
WinCE has two level of cache - FS cash and Disk cache. The FSSCTL_FLUSH_BUFFERS works by flushing FS level caches and data will be moved to a Disk subsystem level. So you need to use IOCTL_DISK_FLUSH_CACHE after that.