SPIFFS integration¶
RIOT integration of SPIFFS.
The RIOT integration of SPIFFS follows the SPIFFS wiki: https://github.com/pellepl/spiffs/wiki/Integrate-spiffs#integrating-spiffs
The RIOT integration uses by default the SPIFFS_HAL_CALLBACK_EXTRA
option and needs a mtd
device, passed as spiffs_fs.h::spiffs_desc::dev
.
If one disable SPIFFS_HAL_CALLBACK_EXTRA
, the mtd device is passed through the SPIFFS_MTD_DEV
macro as a mtd_dev_t
pointer.
Note that only one filesystem can be used if SPIFFS_HAL_CALLBACK_EXTRA
is disabled.
SPIFFS_SINGLETON
is disabled by default, the memory layout is retrieved from the mtd
device used. If SPIFFS_SINGLETON
is enabled, the proper SPIFFS variables must be set (see from SPIFFS).
The default integration enable SPIFFS_CACHE
and uses the macro SPIFFS_FS_CACHE_SIZE
as cache size.
SPIFFS_LOCK
and SPIFFS_UNLOCK
are also defined in the RIOT custom to use spiffs_lock()
and spiffs_unlock()
-
SPIFFS_FS_CACHE_SIZE
¶ the size of the cache buffer
1
(512)
Ignored if cache is disabled in build config. One cache page will be slightly larger than the logical page size. The more ram, the more cache pages, the quicker the system.
-
SPIFFS_FS_WORK_SIZE
¶ The size of the work buffer.
1
(512)
A ram memory buffer being double the size of the logical page size This buffer is used extensively by the spiffs stack. If logical page size is 256, this buffer must be 512 bytes.
-
SPIFFS_FS_FD_SPACE_SIZE
¶ the size of the file descriptor buffer
1
(4 * 32)
A file descriptor normally is around 32 bytes depending on the build config - the bigger the buffer, the more file descriptors are available.
-
struct spiffs_desc
spiffs_desc_t
¶ This contains everything needed to run an instance of SPIFFS.
-
const vfs_file_system_t
spiffs_file_system
¶ The SPIFFS vfs driver, a pointer to a spiffs_desc_t must be provided as vfs_mountp::private_data.
-
void
spiffs_lock
(struct spiffs_t * fs)¶ SPIFFS lock function.
This function must be used by
SPIFFS_LOCK
to lock the file system using thespiffs_fs.h::spiffs_desc::lock
.Parameters
fs: spiffs descriptor
-
void
spiffs_unlock
(struct spiffs_t * fs)¶ SPIFFS unlock function.
This function must be used by
SPIFFS_UNLOCK
to lock the file system using thespiffs_fs.h::spiffs_desc::lock
.Parameters
fs: spiffs descriptor
-
SPIFFS_DIR_SIZE
¶ Size of the buffer needed for directory.
1
(12)
-
struct
spiffs_desc
¶ This contains everything needed to run an instance of SPIFFS.
-
spiffs
fs
¶ The SPIFFS struct.
-
uint8_t
work
()¶ SPIFFS work buffer.
-
uint8_t
fd_space
()¶ SPIFFS file descriptor cache.
-
uint8_t
cache
()¶ SPIFFS cache.
-
spiffs_config
config
¶ SPIFFS config, filled at mount time depending on the underlying mtdi_dev_t
dev
.
-
uint32_t
base_addr
¶ Base address of partition.
-
uint32_t
block_count
¶ Number of blocks in current partition, if 0, the mtd number of sector is used.
-
spiffs