domain-embedded_skill

This skill helps you implement no_std embedded Rust projects safely by enforcing heapless data structures, interrupt-safe patterns, and clear peripheral
  • Shell

565

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill zhanghandong/rust-skills --skill domain-embedded

  • SKILL.md4.4 KB

Overview

This skill helps Rust developers build embedded and no_std firmware by encoding domain constraints, common patterns, and crate recommendations. It focuses on safe peripheral ownership, interrupt-safe state, and heapless designs for resource-constrained microcontrollers. Use it to align design decisions with real hardware requirements and common embedded frameworks.

How this skill works

The skill inspects domain rules (no heap, no std, real-time, limited resources, interrupt safety) and maps them to concrete Rust patterns and crates. It recommends static allocations, Mutex + critical sections for ISR safety, HAL/PAC ownership patterns, and framework choices like RTIC or Embassy. It also provides code patterns and common fixes for typical mistakes in embedded Rust.

When to use it

  • Starting a new bare-metal or no_std Rust firmware project
  • Designing interrupt-safe shared state or peripheral singletons
  • Choosing crates for ARM or RISC-V microcontrollers
  • Migrating code away from dynamic allocation to static buffers
  • Picking a concurrency framework (RTIC vs Embassy) for your app

Best practices

  • Prefer static, compile-time sized collections (heapless::Vec, arrays) instead of heap allocations
  • Use HAL/PAC ownership and singletons (Peripherals::take()) to avoid conflicting access
  • Protect shared state with Mutex<RefCell<T>> and use interrupt::free or critical sections in ISRs
  • Avoid blocking or heavy work inside ISRs; defer processing to tasks or the main loop
  • Choose a runtime that matches your concurrency model: RTIC for priority-driven ISRs, Embassy for async state machines

Example use cases

  • Blinking an LED safely from both main loop and ISR using a Mutex-wrapped static peripheral
  • Implementing a UART driver with static buffers (heapless::Vec) and DMA-friendly ownership
  • Porting a driver to embedded-hal traits for portability across HALs
  • Selecting RTIC for a low-latency interrupt-driven sensor fusion loop
  • Using Embassy async for complex sensor networks with state machines and timers

FAQ

Not if you require deterministic memory and no allocator. Use heapless::Vec or fixed-size arrays instead.

How do I share peripheral handles between ISR and main?

Move the peripheral into a static Mutex<RefCell<Option<T>>> and access it inside interrupt::free or critical sections to ensure mutual exclusion.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational
domain-embedded skill by zhanghandong/rust-skills | VeilStrat