Direct flash access from filesystem

Andrzej Kaczmarek

Hi all,

I'm porting NFFS (Newtron Flash File System) from Mynewt to Zephyr. The original fs implementation has direct access to flash, i.e. it will read, write and erase data to/from flash directly using flash HAL. But existing fs implementation in Zephyr (FAT12) is using disk subsystem to access flash so I wanted to do the same in NFFS, however it does not seem to be useful here because:
- NFFS needs byte-level access to flash - disk subsystem allows sector-level access only
- NFFS takes case of erasing sectors itself, when required - disk subsystem does this during writes

​So does it make sense to try to adjust NFFS and/or disk subsystem to work together? ​Or it's actually better to let NFFS access flash directly, just as it does in Mynewt? I opt for the latter as it makes porting quite easy. The NFFS partition would be defined in DTS so this is the only area NFFS code can access. Also all flash operations are extracted to glue layer so they can be implemented in a different ways in future, for example if one needs to have NFFS in RAM (which disk subsystem would allow) for some reason this won't be a problem.


​Best regards,

Join to automatically receive all group messages.