‹ 首页

kernel-services

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

Advanced Zephyr RTOS kernel services. Covers inter-thread communication using Zbus (pub/sub), behavioral management with the State Machine Framework (SMF), background processing via work queues, and persistent configuration with the Settings subsystem. Trigger when building modular application architectures, complex state-driven logic, or requiring persistent data storage.

适合你,如果要在 Zephyr RTOS 上开发模块化或状态驱动的应用

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

怎么用

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

这个技能让Claude能够协助你使用Zephyr RTOS的Zbus(发布/订阅)、状态机框架(SMF)、工作队列和设置子系统,构建模块化、事件驱动的嵌入式应用。

什么时候触发

当你需要开发模块化架构、复杂状态逻辑或持久化存储时,这个技能会自动激活并提供指导。

装好后可以这样说
Claude会给出Zbus通道定义和发布/订阅的示例代码。
Claude会使用SMF框架创建状态表并给出过渡逻辑。
Claude会介绍Settings子系统的用法。
技能原文 SKILL.md作者撰写 · Apache-2.0 · ed63cdf

Zephyr Kernel Services

Move beyond basic threading and logging to build modular, event-driven, and robust Zephyr applications.

Core Workflows
1. Event-Driven Communication (Zbus)

Decouple your modules using a lightweight publish-and-subscribe bus.

  • Reference: [zbus.md](references/zbus.md)
  • Key Tools: ZBUS_CHAN_DEFINE, ZBUS_SUBSCRIBER_DEFINE, zbus_chan_pub.
2. Behavioral Logic (SMF)

Manage complex system states and transitions using the State Machine Framework.

  • Reference: [smf.md](references/smf.md)
  • Key Tools: smf_set_state, SMF_CREATE_STATE, Hierarchical states.
3. Background Processing (Work Queues)

Defer long-running or non-critical tasks to prevent blocking interrupts or high-priority threads.

  • Reference: [settings_workqueue.md](references/settings_workqueue.md)
  • Key Tools: k_work_submit, k_work_delayable, Custom work queues.
4. Persistence (Settings)

Save and restore configuration data and state across reboots.

  • Reference: [settings_workqueue.md](references/settings_workqueue.md#settings-subsystem)
  • Key Tools: settings_load, settings_save_one, NVS backends.
Quick Start (Zbus)
// Define a channel for sensor data
ZBUS_CHAN_DEFINE(sensor_data_chan, struct sensor_msg, NULL, NULL, ZBUS_OBSERVERS_EMPTY, ZBUS_CHAN_DEFAULTS);

// Publish from a thread
zbus_chan_pub(&sensor_data_chan, &msg, K_NO_WAIT);
Professional Patterns (Asset Tracker Style)
  • Modularity: Use Zbus as the backbone for inter-module communication.
  • Predictability: Use SMF to define clear lifecycle states for each module (e.g., Uninitialized -> Ready -> Active -> Error).
  • Responsiveness: Use custom work queues for sensor data ingestion to keep the main thread responsive for cloud communication.
  • Sensor Integration: For sensor data ingestion patterns, see the [hardware-io](../hardware-io/SKILL.md) skill.
Automation Tools
  • [zbus_channel_lint.py](scripts/zbus_channel_lint.py): Detect duplicate ZBUS_CHAN_DEFINE names across source files.
Examples & Templates
  • [smf_state_table_template.c](assets/smf_state_table_template.c): Starter SMF state table and lifecycle wiring.
Validation Checklist
  • [ ] Zbus publishers and subscribers exchange messages without deadlock or missed updates.
  • [ ] SMF transitions follow expected state graph under normal and error conditions.
  • [ ] Deferred work executes on intended queue context with bounded execution time.
  • [ ] Settings values persist across reboot and reload successfully at startup.
Resources
  • [References](references/):
  • zbus.md: Publish/Subscribe patterns and subscriber types.
  • smf.md: Finite and Hierarchical state machine implementation.
  • settings_workqueue.md: Background work and persistent storage.
  • [Scripts](scripts/):
  • zbus_channel_lint.py: Zbus channel name collision checker.
  • [Assets](assets/):
  • smf_state_table_template.c: State-machine template.
按 Apache-2.0 许可原样转载,未经改动 · 在 GitHub 查看 →

评论

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