bootloader-patterns

bootloader-patterns is a skill for Claude Code from HermeticOrmus/LibreEmbed-Claude-Code. It costs 70 tokens per session (1,778 once invoked), scanned A, original, MIT.

A knowledge guide to building boot software for STM32, nRF52, and SAM microcontrollers. Boot software runs first when a device starts and decides which application image to load.

In plain words
What is it for?
Use it when designing firmware updates over UART, CAN, or USB, storing a new image in a second memory area, checking its CRC and signature, counting failed starts, and returning to a known-good image.
Why use it?
It helps avoid designing update, image-checking, failure-recovery, and rollback behavior from scratch. These steps reduce the risk of starting an invalid update or leaving a device unusable after an update fails.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the bootloader-design plugin — 1 skill, 1 command, 1 agent shipped together

Good fit Use it when designing firmware updates over UART, CAN, or USB, storing a new image in a second memory area, checking its CRC and signature, counting failed starts, and returning to a known-good image.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/hermeticormus/libreembed-claude-code/bootloader-patterns
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.

Any agent
npx skills add HermeticOrmus/LibreEmbed-Claude-Code --skill bootloader-patterns
Clone the repo
git clone --depth 1 https://github.com/HermeticOrmus/LibreEmbed-Claude-Code

Made for: Claude Code.

Or install bootloader-design, the plugin that ships this one along with the rest of its 1 skill, 1 command, 1 agent.

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 bootloader-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/hermeticormus/libreembed-claude-code/bootloader-patterns/github.svg)](https://agentmods.dev/skills/hermeticormus/libreembed-claude-code/bootloader-patterns)
Your own site
<a href="https://agentmods.dev/skills/hermeticormus/libreembed-claude-code/bootloader-patterns"><img src="https://agentmods.dev/badge/skills/hermeticormus/libreembed-claude-code/bootloader-patterns/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for bootloader-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/hermeticormus/libreembed-claude-code/bootloader-patterns"><img src="https://agentmods.dev/badge/skills/hermeticormus/libreembed-claude-code/bootloader-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 70 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,778 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.00070 $0.01778
Opus 5.5 $0.00028 $0.00711
Sonnet 5.5 $0.00014 $0.00356
Haiku 4.5 $0.00007 $0.00178

Measured 27d ago against content hash 9f13aa00b331, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

bootloader-patterns 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 27d 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.

plugins/bootloader-design/skills/bootloader-patterns/SKILL.md · 200 lines

How it starts

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

bootloader-patterns

Knowledge Base

Production bootloader patterns for STM32, nRF52, and SAM MCUs.


Pattern 1: Boot Decision Tree

Power-on Reset
    │
    ▼
Read boot flag (RTC backup register or dedicated NVM byte)
    │
    ├── FLAG_UPDATE_PENDING ──► Receive new image via UART/CAN/USB
    │                           │
    │                           ▼
    │                      Write to inactive bank
    │                           │
    │                      Verify CRC + signature
    │                           │
    │                      Set FLAG_BOOT_NEW, reset
    │
    ├── FLAG_BOOT_NEW ──► Validate image at new bank
    │                      │
    │                      ├── OK ─► Clear flag, increment boot counter,
    │                      │         jump to new image
    │                      │
    │                      └── FAIL ─► Increment failure counter
    │                                  │
    │                                  └── > 3 fails ─► Revert to golden
    │
    └── FLAG_NONE ──► Validate active bank image
                       │
                       ├── OK ─► Jump to application
                       │
                       └── FAIL ─► Fall back to recovery UART mode

Pattern 2: RTC Backup Register for Boot Flags

STM32 RTC backup registers survive reset (not power-off). Ideal for bootloader flags.

#define BKP_REG_BOOT_FLAG  RTC->BKP0R
#define BOOT_FLAG_NONE     0x00000000UL
#define BOOT_FLAG_UPDATE   0xA5A5A5A5UL
#define BOOT_FLAG_BOOT_NEW 0x5A5A5A5AUL

void bootflag_set(uint32_t flag)
{
    /* Enable backup domain access */
    RCC->APB1ENR |= RCC_APB1ENR_PWREN;
    PWR->CR |= PWR_CR_DBP;
    BKP_REG_BOOT_FLAG = flag;
    PWR->CR &= ~PWR_CR_DBP;
}

uint32_t bootflag_get(void)
{
    RCC->APB1ENR |= RCC_APB1ENR_PWREN;
    PWR->CR |= PWR_CR_DBP;
    return BKP_REG_BOOT_FLAG;
}

Pattern 3: Dual-Bank Flash Layout (STM32F407, 1MB)

0x08000000 ┌─────────────────────────┐  Sector 0 (16KB)
           │  Primary Bootloader     │  Write-protected
           │  (golden copy)          │
0x08004000 ├─────────────────────────┤  Sector 1 (16KB)
           │  Bootloader config      │
           │  (version NVM, keys)    │
0x08008000 ├─────────────────────────┤  Sectors 2-3 (32KB)
           │  Application Bank A     │  Active
           │  (img_header + app)     │
0x08040000 ├─────────────────────────┤  Sector 6 (128KB)
           │  Application Bank B     │  OTA target
           │  (img_header + app)     │
0x080C0000 ├─────────────────────────┤  Sector 10 (128KB)
           │  Application Data       │
           │  (settings, logs)       │
0x08100000 └─────────────────────────┘

Read the full file on GitHub · 200 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. 27d ago Changed · +5 lines · +70 tokens per session 9f13aa00b331
  2. 1mo ago First seen · 195 lines · 0 tokens per session scan A 064f54ad27ac

Subscribe to this mod's changes

bootloader-patterns is a skill published in the GitHub repository HermeticOrmus/LibreEmbed-Claude-Code (50 stars, last pushed 18d ago), licensed MIT. It adds 70 tokens to every session and 1,778 once invoked, about $0.0003 per session on Opus 5.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 skills, from other repositories

volt-ota

Produce a complete OTA update system design — partition layout, update flow, rollback conditions, validation checks, fleet management approach, failure modes and recovery. Use when asked about "OTA updates", "firmware updates over the air", "how do I update devices in the field", "OTA strategy", or "remote firmware…

tonone-ai/tonone · 70 tokens

volt-firmware

Produce a complete firmware architecture spec for a described device — layer diagram, module responsibilities, HAL interface definitions, key state machines, RTOS decision. Use when asked to "design firmware architecture", "plan embedded firmware", "architect an IoT device", "how should I structure this firmware", or…

tonone-ai/tonone · 76 tokens

iot-expert

Expert-level IoT systems, embedded devices, edge computing, and IoT protocols. Use when the user mentions embedded, edge computing, MQTT, sensors, or firmware, or when the task involves IoT Architecture, IoT Protocols, Embedded Systems, or Device Design.

personamanagmentlayer/pcl · 59 tokens

volt-driver

Build a device driver or protocol handler — I2C sensors, BLE services, MQTT clients, SPI peripherals with interrupt-driven I/O and clean HAL abstraction. Use when asked to "write a driver", "I2C device", "BLE service", "MQTT client", or "sensor integration".

tonone-ai/tonone · 63 tokens

volt-power

Power management audit — analyze sleep modes, wake sources, power state machines, radio duty cycles, and battery life estimates. Use when asked to "audit power usage", "optimize battery life", "review power management", "why is my battery draining", "power budget analysis", or "sleep mode review".

tonone-ai/tonone · 65 tokens

volt-recon

Firmware reconnaissance for takeover — inventory the MCU, peripherals, RTOS, protocols, OTA, power management, and assess code quality with risk flags. Use when asked to "understand this firmware", "device inventory", or "embedded assessment".

tonone-ai/tonone · 52 tokens