Port of NFFS to Zephyr

Andrzej Kaczmarek


I created a port of NFFS (Newtron Flash File System) for Zephyr - see

NFFS is the filesystem created and used by Apache Mynewt project
(https://mynewt.apache.org/os/modules/fs/nffs/nffs/). It is part of
Mynewt code, but recently there was separate repository created for
NFFS itself. The goal is to have code maintained there independently
of Mynewt so other OS-es can use it and contribute. The code in new
repository was modified a bit in order to make it easier to port to
other OS-es:
- small OS glue layer to abstract memory and flash calls
- expose complete NFFS API, not only fs API (which will be implemented by OS)
- allow to use static buffers instead of heap memory wherever applicable

At the moment it is possible to do simple 1:1 copy of core NFFS code
to Zephyr which is what pull in commit does. The code in Zephyr
repository can be then updated in the same way in case new release of
NFFS is created.

Zephyr specific code includes implementation of OS glue layer and
filesystem API calls using NFFS API:
- memory slabs are used as a replacement for mempools
- flash is accessed directly using flash APIs and not via intermediate
layer like in FAT, since NFFS is a *flash* filesystem and has
knowledge of flash layout
- flash area for NFFS is defined as a partition in device tree - this
is preconfigured for nRF5x DKs if NFFS is enabled
- all parameters of NFFS are configurable using Kconfig to tune memory
usage and performance
- there's no support for fs_truncate() call which is not easily
possible at the moment with NFFS - it will just return ENOTSUP.

I also added some temporary code to Bluetooth subsystem which can
utilize NFFS as a storage so you can check how it works in real world
use case (just note that BT code is not quite nice since it's just for

Best regards,

Join {devel@lists.zephyrproject.org to automatically receive all group messages.