Embedded Firmware Dev logo

Embedded Firmware Dev

Community
AmethystLuna
embedded-firmware-dev

Use when writing or reviewing embedded C firmware, FreeRTOS tasks, ISR handlers, NVM/flash storage, or sensor driver state machines. NOT for documentation-only RTOS references, conceptual RTOS discussions, or bare-metal projects without an RTOS or sensor subsystem.

Overview

PublisherAmethystLuna
Repositoryembedded-workbench
Skill nameembedded-firmware-dev
Stars
32
Forks
3
Bundled files
3
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 3 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by AmethystLuna on GitHub. Read the source before you install it.

Installation

Install the Embedded Firmware Dev AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/AmethystLuna/embedded-workbench/tree/master/skills/embedded-firmware-dev
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/AmethystLuna/embedded-workbench.git /tmp/embedded-workbench
mkdir -p .claude/skills
cp -r /tmp/embedded-workbench/skills/embedded-firmware-dev .claude/skills/embedded-firmware-dev
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Embedded Firmware Dev in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Embedded Firmware Dev on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Embedded Firmware Dev is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Embedded Firmware Development

FreeRTOS

  • Give each task a clear ownership boundary. Shared resources need a deliberate synchronization strategy.
  • Prefer task notifications for one-to-one wakeups, queues for data transfer, event groups for combined state, mutexes for mutual exclusion, semaphores for one-way signaling.
  • Use a mutex (not binary semaphore) when mutual exclusion matters and priority inheritance is needed.
  • Make every blocking wait explicit: use a timeout unless an infinite wait is deliberate.
  • Keep timer callbacks short and non-blocking — use them to schedule work, not do it.
  • Avoid holding locks across flash, storage, or long operations.
  • Size task stacks from worst-case call chains. Recheck high-water marks after adding buffers or deeper call trees.
  • Use ISR-safe APIs for interrupt-to-task handoff. Keep ISR state capture minimal.
  • Avoid priority inversion: don't hold shared locks across blocking I/O or long processing.
  • If a task can be paused/restarted/signaled from multiple places, define resume, timeout, and recovery paths explicitly.
  • For cross-task pointer ownership: make lifetime and invalidation rules obvious.
  • Prefer the smallest critical section that protects the state transition. Don't wrap whole operations in locks when narrower ordering suffices.
  • For objects handed between threads: define whether the receiver owns, borrows, or copies before crossing the boundary.

Interrupts / ISR

  • Keep the interrupt path short, deterministic, and bounded. Capture minimum state, clear the source, defer expensive work.
  • Do not block, sleep, allocate heap, or call non-ISR-safe APIs from an ISR.
  • Prefer top-half/bottom-half split when the handler needs more than quick state capture and wakeup.
  • Make shared-state ownership explicit. Use minimum synchronization for the data being shared.
  • If an ISR wakes a task, use the ISR-safe RTOS primitive and preserve yield-from-ISR behavior.
  • Define clear read/clear/re-enable ordering to avoid losing edges or creating re-trigger loops.
  • Avoid logging and complex branching in the hot interrupt path.
  • If code runs from both task and ISR context, separate wrappers so the ISR-safe path stays obvious.

Async Lifecycle Cleanup

  • Any async flag (pending, in-progress, busy, data-ready) that can be set during normal operation must be explicitly cleared in every stop, init, reset, power-off, and error-recovery path. A stale flag silently blocks the next operation.
  • When adding a new async operation, audit all lifecycle entry points and ensure each path resets flags to known-safe.
  • Cleanup must happen before any new operation is attempted, not after.
c
// CORRECT: every async flag cleared in stop path. No stale state survives restart.
uint8_t comm_stop_sample(void) {
    g_comm.data_ready         = false;
    g_comm.state              = COMM_STATE_IDLE;
    g_comm.activating         = false;
    g_comm.command_fail_count = 0;
    g_comm.protocol_locked    = false;
    g_comm.communication_lost = false;
    g_comm.warmup_start_time  = 0;
    comm_command_complete();                     // Release any pending I/O
    memset(&g_comm_data, 0, sizeof(g_comm_data));// Reset cached data
    comm_process_faults(false);                  // Clear fault detection state
    return COMM_OK;
}

// BAD: half the flags survive — next start inherits stale state
void comm_stop_bad(void) {
    g_comm.state = COMM_STATE_IDLE;              // Only state changed
    // Missing: data_ready, protocol_locked, communication_lost, fail_count...
    // Next start: data_ready==true blocks first sample; fail_count persists
}

// CALLER GUARD: clear stale flags at power-off boundaries before re-init
void comm_handler(void) {
    if (!power_get_status() && g_comm.command_pending) {
        comm_command_complete();                 // Clear before deinit
    }
    if (power_get_status()) {
        comm_state_process();
    }
}

One-Shot Event Consumption

  • When a low-level driver produces a transient event that multiple higher-level consumers need, use an atomic check-and-clear (consume) API rather than shared flags each consumer clears manually.
  • Manual clearing by multiple consumers creates races: consumer A clears before B reads, or B reads a flag already set again by the next cycle.
  • The consume primitive returns whether the event occurred and atomically clears the latch — every interested consumer observes the event exactly once per occurrence.
c
// Atomic check-and-clear: every consumer sees the event exactly once
static volatile uint32_t event_latch;

uint32_t event_consume(uint32_t mask) {
    uint32_t primask = __get_PRIMASK();
    __disable_irq();
    uint32_t pending = event_latch & mask;
    event_latch &= ~mask;               // Clear consumed bits atomically
    if (!primask) __enable_irq();
    return pending;                     // Non-zero = event occurred this cycle
}

// Each consumer independently observes — no races between consumers
void ui_consume(void) {
    if (event_consume(EVT_SENSOR_READY)) update_display();
}
void log_consume(void) {
    if (event_consume(EVT_SENSOR_READY)) write_log();
}

Storage / Persistence

  • Separate object corruption from schema change. Rebuild the whole store only when versioned layout rules require it.
  • Prefer recoverable write paths: write primary → read back and verify → write backup → read back and verify.
  • During delete, reset, or migration, preserve at least one valid recoverable copy.
  • Prefer targeted repair and re-sync over destructive reinitialization.
  • Treat startup repair, steady-state writes, emergency writes, and factory reset as separate paths with explicit guarantees.

Boundary Analysis

  • When thresholds trip at edges, inspect debounce latency, sample timing, and ring-vs-bounded assumptions before tuning constants.
  • When behavior diverges by mode, compare all branches side by side instead of debugging only the failing branch.
  • When a defect appears on only one trigger path, diff which state each caller resets, preserves, or derives.
  • For transient inconsistencies, inspect raw state, derived state, and cached state separately — stale data in any layer masquerades as a timing problem.
  • When a system undergoes mode switch, direction reversal, or re-initialization, allow a bounded tolerance window for the first post-transition deviation. Treating it with steady-state thresholds produces false error accumulation.

Deep Reference

This skill's references/ directory contains in-depth material. Load when you need more than the core rules:

ReferenceTopicLoad When
architecture-principles.md12 architecture design principlesDesigning module boundaries, state ownership, or GUI architecture
embedded-patterns.mdGIF timer safety, async lifecycle, state latchesDebugging timer crashes, stale flags, or state corruption
lvgl-pitfalls.mdLVGL layout, alignment, alpha, and mask trapsDebugging LVGL rendering artifacts or HardFault in draw paths

See also: Skill("state-machine-design") for state transition rules, Skill("debug-methodology") for debugging process, Skill("hardfault-triage") for stack overflow and ISR crash triage.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Embedded Firmware Dev AI skill do?

Use when writing or reviewing embedded C firmware, FreeRTOS tasks, ISR handlers, NVM/flash storage, or sensor driver state machines. NOT for documentation-only RTOS references, conceptual RTOS discussions, or bare-metal projects without an RTOS or sensor subsystem.

Why use Embedded Firmware Dev on TypingMind?

Because you install it once and use it with any model. Embedded Firmware Dev is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Embedded Firmware Dev in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/AmethystLuna/embedded-workbench/tree/master/skills/embedded-firmware-dev. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Embedded Firmware Dev?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Embedded Firmware Dev?

As many as you like. As long as a model supports skills, you can use Embedded Firmware Dev with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Embedded Firmware Dev AI skill free?

Yes. It is published on GitHub by AmethystLuna under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇