zephyr-foundations

Apply Zephyr RTOS concurrency primitives and Devicetree patterns to embedded C driver code.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) and assets (resource) components.

What problem does it solve?

This Skill provides a structured set of foundational Zephyr RTOS patterns and best practices, enabling developers to write reliable, idiomatic embedded C that scales.

Core Features & Use Cases

  • Idiomatic C Patterns: Master macros and patterns like CONTAINER_OF, BIT, GENMASK, and container-based data structures; map hardware with device trees using standard conventions.
  • Real-Time Concurrency: Use safe synchronization primitives (k_mutex, k_sem, k_spinlock), ISR-safe coding, and atomic operations to build responsive, deterministic drivers and tasks.
  • Hardware Literacy (Devicetree): Understand how hardware topology and overlays drive driver behavior, with proper use of nodes, properties, phandles, and overlays.
  • Robust Error Handling: Apply defensive coding with BUILD_ASSERT, parameter validation, and disciplined return code handling to prevent crashes.

Quick Start

Review the template_driver.c in assets/foundation_examples as a complete skeleton, then consult the references for macros and concurrency primitives to adapt the patterns to your specific driver or core logic task.

Frequently Asked Questions about zephyr-foundations

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

FAQPage Schema
How do I use Zephyr RTOS concurrency primitives like k_mutex and k_spinlock safely in driver development?

To use Zephyr RTOS concurrency primitives safely, apply ISR-safe coding with k_mutex, k_sem, and k_spinlock to build responsive, deterministic drivers. These synchronization primitives prevent race conditions in resource-constrained embedded software.

What is the best way to map hardware topology in Zephyr using Devicetree overlays?

Mapping hardware topology in Zephyr requires using Devicetree nodes, properties, phandles, and overlays. These standard conventions drive driver behavior and ensure correct hardware literacy across your embedded project.

How do I implement defensive error handling in Zephyr embedded C code?

Implement defensive error handling in Zephyr embedded C by applying BUILD_ASSERT, parameter validation, and disciplined return code handling. These foundational patterns prevent crashes and ensure reliable driver code execution.

Can I use standard Zephyr macros like CONTAINER_OF and GENMASK for core logic tasks?

Yes, you can use standard Zephyr macros like CONTAINER_OF, BIT, and GENMASK for core logic tasks. These idiomatic C patterns enable container-based data structures and scalable embedded software development.

Does this Zephyr driver development approach work for resource-constrained embedded projects?

Yes, this Zephyr driver development approach explicitly targets resource-constrained embedded projects. It ensures foundational patterns like ISR safety and correct Devicetree usage are followed in driver code and system components.

Why do I need a template driver skeleton when starting Zephyr driver development?

You need a template driver skeleton to establish solid foundations when starting Zephyr driver development. Reviewing a complete skeleton provides structured foundational patterns and best practices to adapt for reliable embedded C.