storage

Manage NVS-backed persistent storage and flash partitions in Zephyr RTOS.

59|13|Updated Feb 7, 2026
One-click install
npx skills add https://github.com/beriberikix/zephyr-agent-skills --skill storage-beriberikix
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: storage
Source: https://github.com/beriberikix/zephyr-agent-skills/tree/main/skills/storage
Command: npx skills add https://github.com/beriberikix/zephyr-agent-skills --skill storage-beriberikix

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Storage management for Zephyr RTOS, enabling Non-Volatile Storage (NVS) for durable settings, flash partition handling in Devicetree, and runtime flash layout access to simplify reliable data storage and configuration.

Core Features & Use Cases

  • NVS-backed persistence: Use Non-Volatile Storage to store settings and data with wear leveling.
  • Partition-aware management: Define and manage flash partitions via Devicetree fixed partitions.
  • Runtime layout awareness: Query and adapt to flash layout at runtime for safe access.
  • Use Case: Example: a device that must retain user preferences across reboots and securely store calibration data.

Quick Start

  • Enable NVS in prj.conf: CONFIG_NVS=y, CONFIG_FLASH=y, CONFIG_FLASH_PAGE_LAYOUT=y.
  • Define and mount the NVS file system using the storage_partition fixed partition.
  • Read and write values using nvs_read and nvs_write, with a centralized ID map to avoid collisions.

Frequently Asked Questions about storage

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I store persistent configuration data in Zephyr RTOS using NVS?

Zephyr RTOS uses Non-Volatile Storage (NVS) to retain settings and data across reboots. You enable it in your build configuration, define a fixed flash partition in Devicetree, and use nvs_read and nvs_write with a centralized ID map to store data safely.

What is the best way to define flash partitions for NVS in Zephyr Devicetree?

Devicetree fixed partitions define the flash memory layout for NVS in Zephyr. You assign a dedicated storage_partition in the Devicetree, enabling the system to safely locate and manage the flash region used for persistent data at runtime.

Do I need to enable wear leveling for flash storage in Zephyr?

Zephyr's NVS implementation includes built-in wear leveling, so you do not need a separate mechanism. By enabling NVS via your build configuration, wear leveling is automatically handled to protect your flash memory during frequent write operations.

Why are my nvs_write operations failing in Zephyr?

nvs_write operations in Zephyr often fail due to incorrect flash layout or missing build configurations. Ensure CONFIG_NVS, CONFIG_FLASH, and CONFIG_FLASH_PAGE_LAYOUT are enabled, and verify your Devicetree storage_partition aligns with the actual hardware flash boundaries.

Can I query flash layout at runtime in Zephyr for safe NVS access?

Yes, you can query and adapt to flash layout at runtime in Zephyr. This partition-aware management allows your application to verify storage boundaries dynamically, ensuring safe NVS access and preventing accidental writes outside the designated fixed partition.