‹ 首页

storage

@beriberikix · 收录于 昨天 · 上游提交 2 个月前

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 RTOS 设备实现持久数据存储。

/ 通过 npx 安装 校验哈希
npx oh-my-skill add beriberikix/zephyr-agent-skills/storage
/ 通过 bash 安装
curl -fsSL https://oh-my-skill.com/install.sh | bash -s -- beriberikix/zephyr-agent-skills/storage
/ 已经装过?验证本机副本,不用重装
npx oh-my-skill verify beriberikix/zephyr-agent-skills/storage
安装目标可用 --agent / --scope 或 --to 明确指定;省略时只会在唯一已存在的 agent 目录上自动选择,零命中或多命中会停止并提示。content_hash 缺失或不一致均拒装。
58GitHub stars
~486最小装载
~1.8K含声明引用
~1.9K文本包总量
索引托管

怎么用

商店整理自技能原文 · 版本 ed63cdf · 表述以原文为准
它做什么

Claude 能够帮你实现 Zephyr RTOS 上的持久数据存储,包括使用 NVS 进行读写、管理设备树中的 flash 分区以及访问运行时 flash 布局。

什么时候触发

当你需要实现持久数据存储、管理 flash 磨损均衡或配置设备分区时触发。

装好后可以这样说
Claude 会生成 nvs_write 代码示例。
Claude 会提供固定分区模板。
Claude 会建议使用 nvs_read 验证。
技能原文 SKILL.md作者撰写 · Apache-2.0 · ed63cdf

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)
#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.
按 Apache-2.0 许可原样转载,未经改动 · 在 GitHub 查看 →

评论

登录即可评论;带「已验证安装」的,是发布者名下有本店的安装或持有记录。