• I've spent the past couple of hours looking at the FAT32 filesystem to use the "internal" esp8266 flash. The characteristics of the serial NOR flash chips are: 4KB block size with the ability to write 256 byte pages (but only erase full blocks). The amount of flash available is 1MB to 3MB for 2MB to 4MB flash chips, and ~32KB for 1MB flash chips (and nothing for the 512KB flash chips).

    The problem I'm hitting with the FAT32 implementation is that it really assumes that 512 byte sectors are writable and erasable individually, which is not the case here. Setting the FAT sector size to 4096 would make things work, but then that's the smallest file size, which means that a 1MB filesystem could only support about 200 files and a 32KB filesystem would be a no-go. Write will be really slow because each sector write will consist of an erase followed by a write. On the RAM front the whole thing may blow up 'cause buffers will be 4096 bytes and there just isn't room for even 2 buffers.

    One alternative might be to implement sector remapping, i.e., what a wear-leveling controller does, but I don't think we really want to do that. Another alternative is to use a filesystem that is designed for NOR flash, such as SPIFFS: https://github.com/pellepl/spiffs. The same issue will come up to use the 2MB flash on the emw3165, as far as I can tell.

    I may just implement the 4096 sector size FAT32 on the esp8266, but I believe the better solution would be to implement spiffs. Thoughts?

About

Avatar for tve @tve started