Posts Tagged ‘read fpga mcu binary file’

PostHeaderIcon Read SoC FPGA Firmware: PS Software, PL Bitstream, Two Deliverables

Devices that combine a processor subsystem with programmable logic have become the default for anything that needs both control and high-throughput processing. They also have the distinction of containing two completely different classes of content behind one part number, which means a single request to extract the firmware is actually two projects.

The processor side holds software: instructions, data, stacks, and everything that implies. It can be disassembled, its functions can be bounded, and its behaviour can be described. The fabric side holds a bitstream: lookup table masks and routing, with no instructions at all. It can be copied exactly and understood only behaviourally.

The two halves

Aspect Processing system Programmable logic
Content Instructions and data Configuration frames
Unit of meaning Operation LUT mask, routing switch
Decompilable Yes, to a degree No
Copyable Yes Yes
Behaviour recoverable Yes Yes, at the interface
Structure recoverable Partly Rarely

The third and fourth rows are the practical distinction: both halves can be copied, and only one can be understood structurally.

How the two halves boot

The relationship between the halves is defined by the boot sequence, and the sequence is where the two projects meet.

Boot mode Who configures the fabric Implication
Processor boots first, then loads the bitstream Processor software The bitstream may be inside the boot image
Fabric configured first, then processor released Boot ROM The bitstream is a separate artefact
Both from one image Boot ROM reads a container A single file holds two payloads
Fabric configured by an external device Neither A third device holds the bitstream

The first and third rows are the most common in practice, and they determine whether the bitstream is a separate file or a section inside the processor’s boot image.

Where the content lives

Storage Content Access
External flash Boot image, possibly containing both Read the flash
SD card Boot image Read the card
Internal ROM Boot code only Not readable
Fabric configuration memory Volatile Nothing to read
Processor internal RAM Transient Nothing to read

The first row covers most designs, and it is the good case: one flash read yields both payloads, and the container format tells you where each begins. A combined boot image has a header that describes its parts, and the header is readable.

Header field Purpose
Magic or identifier Confirms the container format
Partition table Offset and length of each payload
Payload type Processor image, bitstream, or data
Checksum per partition Integrity
Encryption flag Whether a partition is encrypted

The third row is what makes the separation mechanical: the partition types are declared, so the bitstream can be extracted without knowing anything about the fabric.

The processor half

Once separated, the processor image is ordinary ARM software and the usual methods apply.

Step Output
Validate the image Plausible entry and vectors
Identify the load map Regions and addresses
Recover functions Boundaries and call graph
Reconstruct Compilable code at an agreed level

The first step is the two-word check described in reading ARM Cortex-M firmware for microcontrollers, adapted to the core in question. On application-class cores the check is different but the principle is the same: the image should be self-consistent before it is analysed.

The fabric half

The bitstream gets a different treatment entirely.

Task Method
Copy it Program a blank device
Validate it Length and header against the device
Compare builds Frame-level diff
Understand it Interface-level behaviour

The fourth row is the only route to understanding, and it is worth being explicit about what it yields: a description of what the logic does at its pins, not of how it is built. That is usually sufficient for a replacement, and it is never sufficient for a modification that changes internal structure.

Why the split matters commercially

The two halves have different costs, different risks and different definitions of done, and a single quotation for both is a quotation that will be wrong in one direction.

Half Typical effort Typical risk
Processor software Weeks, depending on scope Reconstruction quality arguments
Bitstream copy Days Almost none
Bitstream understanding Months, and bounded Expectations

The third row is where projects fail. A customer who expects RTL from a bitstream is expecting something that does not exist, and the expectation is usually formed before any technical conversation.

The interface between them

There is a deliverable that belongs to neither half: the interface specification. How does the processor talk to the fabric, through which registers, with what handshakes.

Interface element Where to find it
Register map Constants in the processor code
Access width Load and store instructions
Handshake Polling loops, interrupt handlers
DMA descriptors Structures in memory
Timing assumptions Delay loops, timeouts

Recovering this is often more valuable than either half alone, because it is the part that a replacement design must reproduce exactly. It is also the part that exists in no document on most projects.

Where the adjacent work is

The bitstream’s storage and the reason it is usually in an external flash are in reading FPGA firmware. Its limits as an object of understanding are in reading FPGA bitstream. The physical routes for the fabric configuration are compared in extracting FPGA configuration.

Services at this boundary

Work covers boot container parsing, payload separation, processor image reconstruction, bitstream validation and copying, interface specification, and interface-level behavioural description of the fabric. It does not cover producing RTL from a bitstream, and it does not cover modifying fabric logic without the original source.

The framing worth using is that an SoC FPGA is two devices in one package, and a request that treats it as one will produce one good half and one disappointment.