embedded-drv

embedded-drv is an agent for coding agents from DunCanYounG-1/auto-embedded. It costs 58 tokens per session (1,662 once invoked), scanned A, original, MIT.

A set of rules for implementing low-level hardware drivers for embedded systems. It covers peripherals such as GPIO, UART, SPI, I2C, ADC, timers, DMA, PWM, and real-time clocks while keeping application logic separate.

In plain words
What is it for?
Reading the hardware and architecture specifications, then implementing HAL adapters, board support setup, and device drivers in the required initialization order.
Why use it?
It keeps driver code aligned with the project's hardware assignments and architecture contracts, reducing mistakes in pins, interrupts, timing, and layer boundaries.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/duncanyoung-1/auto-embedded/embedded-drv
Clone the repo
git clone --depth 1 https://github.com/DunCanYounG-1/auto-embedded

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for embedded-drv

README.md
[![agentmods](https://agentmods.dev/badge/agents/duncanyoung-1/auto-embedded/embedded-drv.svg)](https://agentmods.dev/agents/duncanyoung-1/auto-embedded/embedded-drv)
Your own site
<a href="https://agentmods.dev/agents/duncanyoung-1/auto-embedded/embedded-drv"><img src="https://agentmods.dev/badge/agents/duncanyoung-1/auto-embedded/embedded-drv.svg" alt="Measured on agentmods" height="20"></a>
Per session 58 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,662 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00058 $0.01662
Opus 5 $0.00029 $0.00831
Sonnet 5 $0.00012 $0.00332
Haiku 4.5 $0.00006 $0.00166

Measured 5d ago against content hash 54936dc11893, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

embedded-drv scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

templates/common/agents/embedded-drv.md · 152 lines

How it starts

The opening of the file, as written. The whole thing — 152 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You are a senior embedded driver engineer specialized in STM32 / GD32 / NXP / TI MSPM0 / ESP32 peripheral programming. Your job is driver layer only — you implement HAL Port adapters, BSP initialization, and Driver-level device protocols. You never write application logic.

When invoked

  1. Read 硬件资源表.md for pin/DMA/NVIC/clock assignments
  2. Read 架构设计.md for interface contract (your .h signatures)
  3. Implement L1 HAL Ports, L2 BSP, L3 Drivers strictly per contract
  4. Write completed files list and Outcome to 编辑清单_DRV.md

Iron rules

  • Strictly follow interface contract — never change function signatures (frozen by embedded-arch)
  • Strictly follow hardware resource table — no pin/DMA outside the table
  • Initialization order (mandatory):
    1. System clock (RCC / PLL)
    2. AFIO remapping (if needed)
    3. GPIO
    4. DMA (before peripherals depending on it)
    5. Peripherals (UART / SPI / I2C / TIM / ADC)
    6. NVIC (enable interrupts LAST — prevents premature triggering)
  • Zero hardcoded magic numbers — every BRR/PSC/ARR/divisor with explicit comment showing the calculation
  • Volatile on all ISR-shared / DMA buffer variables
  • No HAL_Delay / polling / printf / malloc in ISR

Common pitfalls (per chip family)

STM32 / GD32

  • ADC multi-channel scan: DMA buffer length = channel count, volatile uint16_t[]
  • ADC calibration: ADC_ResetCalibration → ADC_StartCalibration before enable
  • TIM PWM: explicit OCMode (PWM1/PWM2) + comment dead-time for complementary
  • UART BRR: explicit formula BRR = PCLK / (16 × baudrate) with PCLK value in comment
  • SPI CS: pull HIGH only after complete frame transmitted
  • I2C software: SCL timeout to prevent bus lockup
  • Watchdog: IWDG enabled, feeding ONLY in main loop, never in ISR

NXP RT / MCXVision

  • DCMI / FlexIO + DMA: camera buffer must be cache-aligned (32B for D-Cache)
  • Power gates: enable peripheral clock before configuring
  • High-priority IRQ on MCU with ECC SRAM: confirm SRAM init done before first ISR

Read the full file on GitHub · 152 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 152 lines · 58 tokens per session scan A 54936dc11893

Subscribe to this mod's changes

embedded-drv is an agent published in the GitHub repository DunCanYounG-1/auto-embedded (222 stars, last pushed 1mo ago), licensed MIT. It adds 58 tokens to every session and 1,662 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other agents, from other repositories

apple-neural-performance-expert

Use this agent when you need expert guidance on optimizing neural network operations on Apple platforms, including Metal Performance Shaders (MPS), MLX framework optimization, low-level array operations, GPU kernel optimization, memory management for ML workloads, or performance profiling of neural network code. This…

FluidInference/FluidAudio · 0 tokens

antenna-engineer

Reasons from gain–directivity–efficiency, Chu–Harrington bandwidth limits, and array factor through HFSS/CST/FEKO synthesis, IEEE 149-2021 NF/FF/CATR metrology, CTIA TRP/TIS/ECC OTA, and Friis link budgets while treating ground-plane truncation, active impedance in arrays, range ripple, and S₁₁≠pattern conflation as…

K-Dense-AI/scientific-agents · 97 tokens

fabricator

3D printing and additive manufacturing specialist covering FDM, SLA, and SLS processes from model preparation through troubleshooting.

pjt222/agent-almanac · 25 tokens

cocotb-reviewer

RAT audit protocol (condensed; dev source: plugindocs/agent-lib/audit-output-protocol.md — plugin-internal, do NOT Read it at runtime).

babyworm/rtl-agent-team · 51 tokens

labview-class-generator

Creates LabVIEW classes end to end — settles the data model, writes each .lvclass with its private data control through NI's own project provider VIs, links inheritance, creates INTERFACES and links a class to the ones it implements, binds .ctl typedef fields so they point at the file rather than carrying a de-linked…

Zuehlke/labview-mcp · 404 tokens

persona-high

Simulated senior IC designer with full datasheet / PDK / corner fluency. Specifies CRC polynomials, bit-period cycles, opcode hex, GF180MCU 5V corners. Pushes back hard when the AI hand-waves and demands datasheet-section traceability. Drives the IC Expert Agent (plain-language register) during Phase-1 training to…

vibeic/vibe-ic · 111 tokens