Internal Interface Wrap
API reference
Loading...
Searching...
No Matches
Classes
StmNvs.h File Reference

STM32 NVS (Non-Volatile Storage) — flash-based key-value store. More...

#include "BaseNvs.h"
#include "StmTypes.h"
#include <cstring>
Include dependency graph for StmNvs.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  StmNvs
 STM32 NVS — flash-backed key-value store with wear leveling. More...
 
struct  StmNvs::CacheEntry
 RAM cache entry. More...
 

Detailed Description

STM32 NVS (Non-Volatile Storage) — flash-based key-value store.

Implements BaseNvs using STM32 internal flash. Provides a simple key-value store suitable for configuration persistence, calibration data, etc.

The storage format is a compact key-value log in a designated flash region. Users specify the flash region via hf_stm32_nvs_config_t (start address, size).

Usage

// Reserve last 2 sectors of flash (e.g., sector 6 & 7 on STM32F4)
hf_stm32_nvs_config_t nvs_cfg(0x08060000, 2 * 0x20000);
StmNvs nvs("app_config", nvs_cfg);
nvs.Initialize();
nvs.SetU32("boot_count", 42);
nvs.Commit();
nvs.GetU32("boot_count", count);
RAII soft-CS: runs assert_fn on construction and deassert_fn on destruction (including early return /...
Definition SoftChipSelectGuard.h:32
STM32 NVS — flash-backed key-value store with wear leveling.
Definition StmNvs.h:50
Flash-based NVS configuration for STM32.
Definition StmTypes.h:537
Author
HardFOC
Date
2025