原始内容
OpenOCD SPI Dump Plugin
A Claude Code plugin for dumping SPI flash/EEPROM memory through a microcontroller's SPI peripheral via OpenOCD, without requiring external SPI programming hardware.
Overview
When reverse engineering embedded systems, you often need to dump SPI flash contents but lack dedicated SPI programming hardware. This plugin provides Claude with the knowledge and guided workflows to help you dump flash via the MCU's debug interface (SWD/JTAG).
Features
Skill: spi-flash-dump - Comprehensive knowledge about RAM-resident SPI dumping
- MCU register maps for SAM4S, SAM3X, STM32F1/F4, nRF52, LPC1768
- Ready-to-use code templates (C, linker scripts, OpenOCD TCL)
- Troubleshooting guide for common issues
Command: /spi-dump - Fully guided interactive workflow
- Gathers information about your target MCU and SPI connections
- Generates customized implementation for your hardware
- Walks through testing and verification
Prerequisites
Required Software
| Tool | Purpose | Installation |
|---|---|---|
| OpenOCD | Debug interface to target MCU | brew install openocd (macOS) or apt install openocd (Linux) |
| ARM GNU Toolchain | Compile RAM-resident dumper. | brew install arm-none-eabi-gcc or ARM Downloads |
| netcat (nc) | Shell scripts communicate with OpenOCD | Usually pre-installed on macOS/Linux |
Optional Tools
| Tool | Purpose | Installation |
|---|---|---|
| xxd | Dump verification script | Usually pre-installed (part of vim) |
| bc | Dump verification calculations | brew install bc or apt install bc |
Hardware Requirements
- SWD/JTAG debug probe (ST-Link, J-Link, CMSIS-DAP, etc.)
- Working debug connection to target MCU via OpenOCD
- Target MCU with SPI flash/EEPROM connected to its SPI peripheral
Installation
# Use as a plugin directory
claude --plugin-dir /path/to/claude-openocd-spi-dump
# Or copy to your project's .claude-plugin directory
Usage
Quick Start
Just ask Claude about your scenario:
- "I need to dump the SPI flash on this SAM4S board"
- "How do I read the EEPROM through the MCU via OpenOCD?"
- "Help me dump flash from this STM32 target"
Guided Workflow
Run the interactive command:
/spi-dump
This will guide you through:
- Identifying your MCU and SPI connections
- Verifying OpenOCD connectivity
- Generating the RAM-resident dumper code
- Testing with JEDEC ID read
- Performing the full flash dump
Supported MCU Families
| Family | Example Parts | Status |
|---|---|---|
| SAM4S | ATSAM4S2A, ATSAM4S4A | Full support |
| SAM3X | ATSAM3X8E (Arduino Due) | Full support |
| STM32F1 | STM32F103 (Blue Pill) | Full support |
| STM32F4 | STM32F407, STM32F411 | Full support |
| nRF52 | nRF52832, nRF52840 | Full support |
| LPC1768 | LPC1768 (mbed) | Full support |
Adding new MCUs is straightforward - see the skill documentation for guidance.
To-Do
- Parameterize the max chunk size
License
MIT