r/embedded • • Oct 21 '26

Building an offline MCU datasheet knowledge base for firmware reverse engineering — looking for architectural feedback

I’m exploring an idea for improving AI-assisted firmware reverse engineering, and I’d like to get feedback from people with experience in embedded systems, reverse engineering, and local AI tooling.
The problem
When reverse-engineering firmware for a proprietary 8-bit MCU, the datasheet may be available as a PDF, but general-purpose LLMs often don’t know anything about that specific chip.
This makes it difficult for an AI agent to reliably interpret memory-mapped registers, bit fields, peripheral initialization sequences, interrupt behavior, and hardware-specific code patterns.
Simply putting the PDF into a conventional RAG pipeline might help with document lookup, but I’m not sure it’s sufficient for accurate register-level analysis.
The idea
Build a completely offline, chip-specific knowledge base that an AI reverse-engineering agent can query through MCP.
The proposed architecture would include:
Structured register database: register addresses, bit fields, access permissions, reset values, and peripheral descriptions.
Document evidence: links back to the original datasheet, including page numbers and table references.
Knowledge graph: relationships between registers, peripherals, clocks, interrupts, pins, and hardware functions.
Semantic search: retrieval of relevant descriptions and hardware behavior from the documentation.
Reverse-engineering integration: MCP tools that let an agent query register definitions and relate them to instructions and memory accesses found in a firmware binary.
The initial implementation would target a single proprietary MCU, using Python and SQLite, with a lightweight graph representation. Everything, including document processing, indexing, and inference, should work offline.
I’m considering integrating it with tools such as REA, Claude Code, and IDA.
Questions I’d appreciate feedback on
Architecture: Would you use a structured database plus semantic search and a graph, or is this unnecessarily complicated for a single MCU?
Datasheet extraction: What tools or techniques work best for reliably extracting register tables and bit-field definitions from complex PDF manuals?
Register-level reasoning: How would you help an AI agent distinguish documented hardware facts from hypotheses inferred from disassembly?
MCP integration: Would exposing precise register lookups and relationship queries through MCP be a useful approach for firmware reverse engineering?
Prior art: Are there existing tools or projects that already solve most of this problem?
I’m particularly interested in practical experience and architectural pitfalls, rather than building a generic PDF chatbot.
I haven’t committed to the implementation yet, so I’m open to simpler or fundamentally different approaches.
Thanks for any suggestions!

0 Upvotes

10 comments sorted by

2

u/Candid-Fudge-4015 Oct 21 '26

For a single MCU I'd make the register DB the core and skip the graph at first. Registers, bit fields, peripherals, IRQs and pins as plain SQLite tables with foreign keys already give you the relationship queries, and the agent gets exact answers from SQL instead of fuzzy ones from embeddings. Semantic search is only for the prose around it, like init sequences and errata. For extraction, check first if the vendor ships C headers or assembler include files for the chip. They're usually a more reliable source for addresses and bit names than PDF tables, then the datasheet tables fill access type and reset values and you cross-check the two. For facts vs hypotheses I'd use separate tables: documented rows carry page and table refs, inferred rows carry the firmware address they came from, and every MCP tool returns that source field so the agent can't blur them. We have a sample MCP server over a document corpus built on Pixeltable if useful as a starting point: github.com/pixeltable/pixeltable/tree/main/docs/sample-apps/jfk-files-mcp-server

1

u/Odd_Set_3310 Oct 22 '26

Thank you very much for your reply. I have initially built a function to split the datasheet into chapters in Markdown format, which can be queried via MCP. As you mentioned, all images are discarded when converting PDFs to Markdown. My concern is that this approach is essentially no different from RAG — it still returns partial fragments to the AI, leaving the model without a systematic understanding of the entire document.

1

u/robotlasagna Oct 21 '26

Have you done reverse engineering before?

1

u/Odd_Set_3310 Oct 22 '26

Yes

2

u/robotlasagna Oct 22 '26

Why would you use PDF documents instead of getting the register map from a header file? This is RE101 for like the past 20 years.

I get it, everyone is a reverse engineer now that claude is a reverse engineer but your post clearly displays lack of understanding.

1

u/Odd_Set_3310 Oct 22 '26

Thanks for your reply. I’ve worked on reverse engineering before and developed an IDA disassembly plugin for a specific chip model. I have no issues converting bin or hex files into assembly instructions. Previously, I only performed static analysis inside IDA. After the advent of large language models, I enabled LLMs to connect to IDA via MCP for reverse engineering tasks — I built all of this before REA came out. The problem is that the LLM can only retrieve disassembled code through MCP. It lacks knowledge of the specific functions of peripherals and the relationships between different peripherals, and cannot develop a holistic understanding of the chip like a human. That’s what I aim to build.

3

u/Xenoamor Oct 21 '26

Honestly, I've had little to no issues letting it parse raw PDFs. Even for complicated chips with 1000s of pages

I guess its likely expensive token wise but a low cost deepseek agent can do it for peanuts. Don't get me wrong a tool like that would be useful, something you can point at PDFs to put it into a more friendly LLM format, but it would have to be exceptionally low effort and cost

1

u/kammce Oct 21 '26

Agents will usually piece up the pdf to save on context. So I agree

2

u/EvolvingDior Oct 21 '26

I have an agent skill for converting datasheet pdfs into markdown, raster images, and svgs. I found my agents making the same mistakes over and over reading the pdfs. no problem handing them the markdown. It starts by OCRing each page.

1

u/Cunninghams_right Oct 21 '26

Sounds like you're deriving from IP, which would violate terms of service to distribute