Skip to content
Back to skills

Storage

ASecurity

Storage management for Zephyr RTOS. Covers Non-Volatile Storage (NVS) for persistent settings, flash partition management in Devicetree, and runtime flash layout access. Trigger when implementing persistent data storage, managing flash wear leveling, or configuring device partitions.

  • 63 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 1, 2026
ai-agentsbackend

Security analysis

A100/100

Pro scans all 6 files and shows the line behind each finding

Scanned September 1, 2026

npx -y skills add beriberikix/zephyr-agent-skills --skill storage --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Storage?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Storage
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/beriberikix-storage/badge)](https://www.skillsdirectory.com/skills/beriberikix-storage)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: storage
description: Storage management for Zephyr RTOS. Covers Non-Volatile Storage (NVS) for persistent settings, flash partition management in Devicetree, and runtime flash layout access. Trigger when implementing persistent data storage, managing flash wear leveling, or configuring device partitions.
---

# Zephyr Storage

Implement reliable persistent data handling using Zephyr's storage subsystem and flash management utilities.

## Core Workflows

### 1. NVS Storage
Utilize Non-Volatile Storage (NVS) for efficient, wear-leveled data persistence.
- **Reference**: **[nvs_storage.md](references/nvs_storage.md)**
- **Key Tools**: `nvs_mount()`, `nvs_read()`, `nvs_write()`.

### 2. Flash Management
Configure and manage flash partitions and hardware page layouts.
- **Reference**: **[flash_management.md](references/flash_management.md)**
- **Key Tools**: `fixed-partitions`, `FLASH_MAP`, `flash_get_page_info_by_offs()`.

## Quick Start (NVS Write)
```c
#include <zephyr/storage/nvs/nvs.h>

void save_data(struct nvs_fs *fs, uint16_t id, void *data, size_t len) {
    nvs_write(fs, id, data, len);
}
```

## Professional Patterns (Reliability)
- **Settings Integration**: Use NVS as the backend for the `settings` subsystem for a standard key-value configuration experience.
- **Collision Prevention**: Define NVS Entry IDs in a centralized header file to prevent accidental overwrites across modules.
- **Runtime Layout Checks**: Always query the flash controller for page sizes (`flash_get_page_layout`) rather than assuming hardcoded sector sizes.

## Automation Tools
- **[nvs_id_lint.py](scripts/nvs_id_lint.py)**: Detect duplicate `NVS_ID_*` macro values across source/header files.

## Examples & Templates
- **[partition_overlay_template.overlay](assets/partition_overlay_template.overlay)**: Starter fixed-partitions overlay for app + storage.

## Validation Checklist
- [ ] `nvs_mount()` succeeds on boot for the configured storage partition.
- [ ] Written values survive reset and read back with matching length and content.
- [ ] Partition layout in DTS matches runtime flash-map queries.
- [ ] Repeated write cycles do not produce mount/read corruption errors.

## Resources

- **[References](references/)**:
  - `nvs_storage.md`: Using NVS for data blobs and integers.
  - `flash_management.md`: Devicetree partitions and page information.
- **[Scripts](scripts/)**:
  - `nvs_id_lint.py`: Duplicate ID detector for NVS namespaces.
- **[Assets](assets/)**:
  - `partition_overlay_template.overlay`: Flash partitioning template.

Files in this skill

  • SKILL.md2.5 KB
  • assets/partition_overlay_template.overlay570 B
  • references/flash_management.md2.2 KB
  • references/nvs_storage.md2 KB
  • scripts/nvs_id_lint.py2.4 KB
  • skill-meta.yaml579 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.