Rust Embedded
嵌入式与 no_std 专家。处理 no_std, embedded-hal, 裸机开发, 中断, DMA, 资源受限环境等问题。触发词:no_std, embedded, embedded-hal, microcontroller, firmware, ISR, DMA, 嵌入式, 裸机--- # 嵌入式与 no_std 开发 ## 核心问题 如何在资源受限环境或没有标准库的情况下编程? no_std 不是 Rust 的子集,而是一种不同的编程模式。
Install
npx skills add huiali/rust-skills --skill rust-embeddedgit clone --depth 1 https://github.com/huiali/rust-skills.git /tmp/rust-skills
mkdir -p ~/.claude/skills
cp -r /tmp/rust-skills/.codex/skills/rust-embedded ~/.claude/skills/rust-embeddedPersonal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.
From the SKILL.md
## no_std 基础
```rust
#![no_std]
// 不能使用 std, alloc, test
use core::panic::PanicMessage;
// 必须实现 panic handler
#[panic_handler]
fn panic(info: &PanicMessage) -> ! {
loop {}
}
// 可选:定义全局分配器
#[global_allocator]
static ALLOC: some_allocator::Allocator = some_allocator::Allocator;
```
### 可用模块
| 模块 | 用途 |
|-----|------|
| `core` | 基本语言特性 |
| `alloc` | 堆分配(需 allocator) |
| `compiler_builtins` | 编译器内置函数 |
## 嵌入式-hal
```rust
use embedded_hal as hal;
use hal::digital::v2::OutputPin;
// 抽象硬件访问
fn blink_led<L: OutputPin>(mut led: L) -> ! {
loop {
led.set_high().unwrap();
delay_ms(1000);
led.set_low().unwrap();
delay_ms(1000);
}
}
```
### 常用 trait
| trait | 操作 |
|-------|------|
| `OutputPin` | 设置高低电平 |
| `InputPin` | 读取引脚 |
| `SpiBus` | SPI 通信 |
| `I2c` | I2C 通信 |
| `Serial` | 串口 |
## 中断处理
```rust
#![no_std]
#![feature(abi_vectorcall)]
use cortex_m::interrupt::{free, Mutex};
use cortex_m::peripheral::NVIC;
// 共享状态
static MY_DEVICE: Mutex<Cell<Option<MyDevice>>> = Mutex::new(None);
#[interrupt]
fn TIM2() {
free(|cs| {
let device = MY_DEVICE.borrow(cs).take();
if let Some(dev) = device {
// 处理中断
dev.handle();
MY_DEVICE.borrow(cs).set(Some(dev));
}
});
}
// 启用中断
fn enable_interrupt(nvic: &mut NVIC, irq: interrupt::TIM2) {
nvic.enable(irq);
}
```
## 内存管理
### 栈大小Details
- Skill name
rust-embedded- Repository
- huiali/rust-skills
- Path
.codex/skills/rust-embedded/SKILL.md- License
- MIT
- Repo updated
- 9 February 2026
FAQ
What does the Rust Embedded skill do?
嵌入式与 no_std 专家。处理 no_std, embedded-hal, 裸机开发, 中断, DMA, 资源受限环境等问题。触发词:no_std, embedded, embedded-hal, microcontroller, firmware, ISR, DMA, 嵌入式, 裸机--- # 嵌入式与 no_std 开发 ## 核心问题 **如何在资源受限环境或没有标准库的情况下编程?** no_std 不是 Rust 的子集,而是一种不同的编程模式。
How do I install the Rust Embedded skill?
skills CLI (Claude Code, Cursor, Codex and more): npx skills add huiali/rust-skills --skill rust-embedded. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.
Is Rust Embedded popular?
It lives in huiali/rust-skills, which has 49 GitHub stars and 7 forks.
Related skills
Rust Actor
49huiali/rust-skills
Actor model expert covering message passing, state isolation, supervision trees, deadlock prevention, fault tolerance, Actix framework, and Erlang-style concurrency patterns.
Rust Anti Pattern
49huiali/rust-skills
Rust anti-patterns and common mistakes expert. Handles code review issues with clone abuse, unwrap in production, String misuse, index loops, and refactoring guidance.
Rust Async
49huiali/rust-skills
Advanced async patterns expert. Handles Stream processing, backpressure control, select/join operations, cancellation, Future trait implementation, and async runtime optimization.
Rust Error
49huiali/rust-skills
Error handling expert covering Result, Option, panic strategies, custom error types with thiserror/anyhow, error propagation patterns, and context-rich error chains.
Rust Ecosystem
49huiali/rust-skills
Rust ecosystem expert covering crate selection, library recommendations, framework comparisons, async runtime choices (tokio, async-std), and common tools.
Rust Error Advanced
49huiali/rust-skills
深入错误处理专家。处理 Result vs Option, thiserror, anyhow, error context, library vs application errors, 错误处理, Result 用法, 什么时候用 panic--- # 深入错误处理 ## 核心问题 **这个失败是预期的还是 bug?** 错误处理策略决定代码的健壮性。
Browse the most popular Claude skills, all software development skills, or write your own with the skills generator.