/bare-metal:bare-metal <init|optimize|analyze-map|flash> [options]from bare-metal
Scaffolds bare-metal firmware projects with startup code, linker scripts, and Makefiles. Also supports size optimization, linker map analysis, and flash command generation.
Ships in bare-metal. Installing the plugin adds it to Claude Code.
Bare-metal firmware command: register-level drivers, linker scripts, startup code, and size analysis.
/bare-metal <action> [options]
initGenerate a complete bare-metal project scaffold for a target MCU.
/bare-metal init --mcu stm32f407vg --flash 1024K --sram 128K --ccm 64K
/bare-metal init --mcu stm32f103c8 --flash 64K --sram 20K
Generates:
startup.c with Reset_Handler and weak default ISR aliases<mcu>.ld linker script with MEMORY regions and SECTIONSMakefile with arm-none-eabi-gcc flags (-Os -ffunction-sections --gc-sections)main.c skeleton with SystemInit call and infinite loopoptimizeAnalyze and reduce code/data size.
/bare-metal optimize --map firmware.map --target flash
/bare-metal optimize --elf firmware.elf --show-top 20
Actions:
.map file for top consumers__attribute__((optimize("Os"))) on hot paths that need size over speed-fno-exceptions and -fno-rtti if C++ is mixed inanalyze-mapDecode a linker map file.
/bare-metal analyze-map firmware.map
/bare-metal analyze-map firmware.map --section .text --min-size 512
Output: table of symbol, section, size, origin file, sorted descending.
flashGenerate flash commands for common programmers.
/bare-metal flash --tool openocd --interface stlink --target stm32f4x
/bare-metal flash --tool pyocd --target stm32f407
/bare-metal flash --tool jlink --device STM32F407VG
stm32f4xx.h or similar).arm-none-eabi-size that sections fit within declared MEMORY regions.ASSERT statements to catch overflows at link time./* Fail at link time if firmware exceeds flash */
ASSERT(SIZEOF(.text) + SIZEOF(.data) < LENGTH(FLASH),
"ERROR: Flash overflow")
ASSERT(SIZEOF(.data) + SIZEOF(.bss) < LENGTH(SRAM),
"ERROR: SRAM overflow")
OPENOCD = openocd
OCD_IFACE = -f interface/stlink.cfg
OCD_TARGET = -f target/stm32f4x.cfg
OCD_FLASH_CMD = -c "program firmware.elf verify reset exit"
flash: firmware.elf
$(OPENOCD) $(OCD_IFACE) $(OCD_TARGET) $(OCD_FLASH_CMD)
erase:
$(OPENOCD) $(OCD_IFACE) $(OCD_TARGET) \
-c "init" -c "halt" -c "stm32f4x mass_erase 0" -c "exit"
text data bss dec hex filename
9832 128 512 10472 28e8 firmware.elf
text = flash used for code + rodata + .data LMA copy
data = SRAM initialized variables (also counted in flash above)
bss = SRAM zero-initialized variables (not in flash)
Common failures:
-Os, check for accidental float printf-specs=nosys.specs or provide your own _sbrk.data copy overwrites stack; check _estack and _sidata in .map fileWhat the command file sets; muted values are Claude Code's defaults
7-day visitors to each command page
npx claudepluginhub ormus-solutions/libreembed-claude-code --plugin bare-metalOther plugins' commands for the same job