PicoLittleFsConfigBackend class final
#include <config/pico_littlefs_backend.hpp>
PicoSDK flash backend that stores config section files in LittleFS.
It provides power-loss-tolerant persistence, wear leveling, and atomic rename while keeping ConfigStore independent from hardware details. Partition is always placed at the end of on-chip flash and its size is controlled by CONFIG_LFS_PARTITION_SIZE_BYTES at build time.
Base classes
- class IConfigBackend
- Abstract storage backend used by
ConfigStore.
Public types
- struct FilesystemUsage
- struct Options
- Backend setup options.
Constructors, destructors, conversion operators
- PicoLittleFsConfigBackend()
- Constructs backend with default options.
- PicoLittleFsConfigBackend(const Options& options) explicit
- Constructs backend with explicit flash-layout options.
- ~PicoLittleFsConfigBackend() override
- Unmounts filesystem when mounted.
Public functions
- auto filesystem_usage(FilesystemUsage* out_usage) -> bool
- Returns current LittleFS usage counters for configured partition.
- auto last_error_op() const -> const char*
- Returns short identifier of operation that produced last error.
- auto last_flash_error() const -> int
- Returns last
flash_safe_executereturn code observed by callbacks. - auto last_lfs_error() const -> int
- Returns last LittleFS error code observed by backend operations.
- auto last_mount_recovery_action() const -> const char*
- Returns last mount-recovery action selected by backend policy.
- auto partition_size_bytes() const -> uint32_t
- Returns configured flash partition size in bytes.
- auto read_file(std::string_view relative_path, std::vector<uint8_t>* out_bytes) -> ConfigReadStatus override
- Reads one section payload file from LittleFS.
- auto remove_file(std::string_view relative_path) -> bool override
- Removes one section payload file.
- auto storage_offset_bytes() const -> uint32_t
- Returns configured flash partition offset from start of XIP flash.
- auto valid() const -> bool
- Returns
truewhen flash layout was validated and backend can mount. - auto write_file_atomic(std::string_view relative_path, const std::vector<uint8_t>& bytes) -> bool override
- Writes one section payload file with temp-file + rename semantics.
Function documentation
const char* prf:: config:: PicoLittleFsConfigBackend:: last_mount_recovery_action() const
Returns last mount-recovery action selected by backend policy.
The value is reset to none after a later fully successful mount path.