Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Bootloaders Embedded

ASecurity

Use when writing a custom bootloader, jumping to application code, relocating VTOR, or implementing DFU/USB firmware update on Cortex-M. Not for reset-to-main: use baremetal-startup.

54 stars
0 votes
0 copies
0 views
Added 9/20/2026
ai-agentsrustgoshell

Security Analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned 9/20/2026

$npx -y skills add OutlineDriven/outline-driven-development --skill bootloaders-embedded --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Bootloaders Embedded?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Bootloaders Embedded
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/outlinedriven-bootloaders-embedded-outline-driven-development/badge)](https://www.skillsdirectory.com/skills/outlinedriven-bootloaders-embedded-outline-driven-development)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
Files
SKILL.md
---
name: bootloaders-embedded
description: 'Use when writing a custom bootloader, jumping to application code, relocating VTOR, or implementing DFU/USB firmware update on Cortex-M. Not for reset-to-main: use baremetal-startup.'
---

# Embedded bootloaders

## Contract

| Field | Bound contract |
|---|---|
| Trigger | An application must run at a non-zero flash offset, a bootloader must validate and jump to it, a firmware update path (UART, USB DFU, custom protocol) is being written, or an application works when flashed alone but fails when launched by the bootloader. |
| Authority | Read-only: emits the flash layout, validation checks, handoff sequence, and update-safety rules to chat; the user places them in the project. Rollback is not needed because no file is written. No remote mutation. |
| Side effect | Chat output only. |
| Done | The flash partition table, the application validity check, the ordered handoff sequence, and the update commit rule are stated for the target part, and the application-side `VTOR` and linker changes are named. |

## Inputs

- Target part and its flash map: base address, sector or page sizes, and whether it has two banks.
- Bootloader size budget and the chosen application base address.
- Update transport (UART, USB DFU, external flash, none).
- Where the update request flag lives (RTC backup register, GPIO strap, magic word in RAM).
- Whether the vendor part has a system-memory bootloader and which transports it lists in the vendor application note (AN2606 for STM32).

## Procedure

1. Fix the flash layout and relink both images to it. The bootloader starts at the flash base; the application starts at a sector boundary above it and its vector table sits at that base. Done when: the application linker script sets `FLASH ORIGIN` to the application base and the bootloader never writes below it.

   | Region | Address (STM32 example) | Content |
   |---|---|---|
   | Bootloader | `0x08000000` | Boot code and update logic, typically 16 KB to 64 KB |
   | Application | `0x08010000` | Application vector table then code |

2. Validate the application image before jumping. Vector 0 must point into RAM; vector 1 must point into the application's flash range and carry the Thumb bit (bit 0 set). Add a CRC or magic word in an application metadata section when the update path can leave a half-written image. Done when: the check rejects an erased sector (`0xFFFFFFFF` in both vectors) and accepts a good image.

   ```c
   #define APP_BASE 0x08010000U

   static int app_valid(uint32_t base)
   {
       uint32_t sp    = *(volatile uint32_t *)base;
       uint32_t reset = *(volatile uint32_t *)(base + 4U);
       if (sp < SRAM_BASE || sp > SRAM_END)   return 0;
       if ((reset & 1U) == 0U)                return 0;   /* Thumb bit */
       if (reset < base || reset > FLASH_END) return 0;
       return 1;
   }
   ```

3. Hand off to the application in this order: disable interrupts, stop SysTick, clear every NVIC enable and pending bit, de-initialize any peripheral the bootloader used (UART, USB, DMA), write `SCB->VTOR` to the application base, load the main stack pointer from vector 0, barrier, then branch to vector 1. Done when: the sequence runs with no interrupt enabled between the NVIC clear and the branch.

   ```c
   typedef void (*app_entry_t)(void);

   void jump_to_app(uint32_t app_base)
   {
       uint32_t sp    = *(volatile uint32_t *)app_base;
       uint32_t reset = *(volatile uint32_t *)(app_base + 4U);

       __disable_irq();
       SysTick->CTRL = 0;
       for (unsigned i = 0; i < 8; i++) {
           NVIC->ICER[i] = 0xFFFFFFFFU;
           NVIC->ICPR[i] = 0xFFFFFFFFU;
       }
       /* de-init bootloader peripherals here, or reset them through RCC */

       SCB->VTOR = app_base;
       __set_MSP(sp);
       __DSB();
       __ISB();
       ((app_entry_t)reset)();   /* never returns */
   }
   ```

4. Make the application own its vector table. Either the bootloader's `VTOR` write is trusted, or the application's `Reset_Handler` writes `SCB->VTOR = APP_BASE` itself before enabling any interrupt. Prefer the second: it also lets the application run when flashed alone. Done when: an interrupt raised in the application reaches the application's handler.
5. Lay out the bootloader main loop. Initialize the minimum clock and the update transport, read the update request flag, and take one of three paths: receive and program an image, jump to a valid application, or stay in the bootloader shell. Done when: every path terminates in a jump or in the shell, and none falls through.
6. Keep the update commit safe. Write the new image to a scratch region or the inactive bank, verify its CRC in place, then switch the active-image marker in one atomic write (metadata pointer or bank swap). Never erase the only valid image without a recovery path, and only service the watchdog after the verified commit. Done when: a power loss at any point leaves at least one valid, bootable image.
7. Distinguish the vendor system-memory bootloader from yours. STM32 parts enter the ROM bootloader when `BOOT0` selects system memory at reset; the transports it offers (USART, USB DFU, others) vary by part and are listed in AN2606. It is not your flash bootloader and does not replace it. Done when: the design states which bootloader handles which recovery case.
8. Verify: flash both images, power-cycle, confirm the jump, then erase the application sector and confirm the bootloader stays in its shell instead of faulting. Done when: both outcomes are observed on the target.

## Failure and recovery

| Symptom | Cause | Fix |
|---|---|---|
| HardFault right after the jump | Stack pointer invalid or Thumb bit clear in vector 1 | Run `app_valid` first; relink the application if the vectors are wrong. |
| Interrupts land in bootloader handlers | `VTOR` still points at the bootloader table | Write `SCB->VTOR` before enabling interrupts, in the application's `Reset_Handler`. |
| Application works standalone, fails via bootloader | Application still linked at the flash base | Set the application linker `FLASH ORIGIN` to the application base. |
| Serial garbage after the jump | Bootloader left its UART or DMA running | De-initialize or reset the peripherals before the branch. |
| Device bricked after an update | Power loss during erase of the only image | Use a scratch region or dual bank with an atomic active marker. |

## Output

For the target part: a flash partition table, the application validity check, the ordered handoff routine, the application-side `VTOR` and linker changes, the bootloader main-loop paths, and the update commit rule that keeps one bootable image at every instant.

Attribution

OutlineDrivenOutlineDriven
View sourceSee grades on GitHubMore from OutlineDriven →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Caveman

Terse caveman voice: answer first, fluff gone, every technical fact kept. Use for /caveman, "caveman mode", "talk like caveman", "be brief", "less tokens". Stays on until "stop caveman" or "normal mode".

1100021 votes

Hyperplan

Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...

698431 votes

Writing Skills

Create and manage Claude Code skills in HASH repository following Anthropic best practices. Use when creating new skills, modifying skill-rules.json, understanding trigger patterns, working with hooks, debugging skill activation, or implementing progressive disclosure. Covers skill structure, YAML frontmatter, trigger types (keywords, intent patterns), UserPromptSubmit hook, and the 500-line rule. Includes validation and debugging with SKILL_DEBUG. Examples include rust-error-stack, cargo-dep...

3931 votes

Mcp Code Execution

Routes multi-tool workflows through MCP servers for large datasets and pipelines. Use when Bash tool overhead is limiting throughput on data-heavy tasks.

3421 votes

catchup

Recovers the conversation and failed tool calls of a previous Codex, Amp, Claude Code, Antigravity, Cline, Copilot CLI, Cursor, DeepSeek Harness, Grok Build, Kimi, OpenCode, Pi Agent, or ZCode session. Use when the user says "catch up", "what did the last session do", "get me up to speed", "I switched agents", asks to recover/summarize a previous session before continuing, or asks to diagnose or report a catchup failure. Do NOT use for the current conversation, git history, or any non-agent log.

741 votes
View all in ai-agents →