Posts Tagged ‘crack dsp cpld flash program’
Crack DSP and CPLD Files: JED, RBT, BIN, OUT and HEX
Files in this field arrive with extensions that look interchangeable and are not. A .hex from a DSP build, a .jed from a CPLD programmer and a .rbt from an FPGA toolchain are three different data models, and the differences are not cosmetic. Each answers a different question about what “the contents” means.
Getting the container right is the least interesting part of the work and the part that causes the most wasted time, because the errors are silent. A file interpreted as the wrong container produces something that looks like data and is not.
The containers compared
| Container | Unit | Carries addresses | Carries checksum | Typical source |
|---|---|---|---|---|
| Intel HEX | Byte at an address | Yes, per record | Per record, plus optional | Microcontroller, DSP tools |
| Motorola S-record | Byte at an address | Yes, per record | Per record | Older toolchains |
| Raw binary | Byte, position implies address | No | No | Memory dumps |
| JED | Fuse coordinate | No; index is the fuse number | One, over fuse bits | CPLD, PLD |
| RBT | Configuration frame | No | Often none | FPGA toolchains |
| OUT (COFF) | Section with a virtual address | Yes, per section | No | DSP linkers |
The third row is the one that causes most loss. A raw binary is the most portable format and the least informative: it says nothing about where the bytes belong, so the same file loaded at two different base addresses produces two different systems.
Why addresses matter more than bytes
A memory image is a partial function from addresses to bytes. A hex or S-record file expresses that function explicitly, including the gaps. A raw binary expresses only the range from the lowest to the highest address, with the gaps filled by whatever the tool emitted.
| Property | HEX or S-record | Raw binary |
|---|---|---|
| Sparse regions | Explicitly skipped | Filled with padding |
| Base address | Recorded | Assumed |
| Multiple regions | Supported | Concatenated |
| File size | Proportional to written data | Span of the address range |
| Detectable corruption | Per-record checksum | None |
The second row is the one that breaks DSP work in particular, because DSP images are frequently split across program and data spaces with different base addresses. Converting such an image to a raw binary forces a decision about the base, and the decision is usually made silently by whatever tool did the conversion.
The JED container is a different animal
A JED file does not contain a memory image at all. It contains a list of fuse states, and its “address” is a fuse index rather than a memory location. There is no meaningful way to load a JED file at a base address, and no meaningful way to concatenate two of them.
| Question | HEX answer | JED answer |
|---|---|---|
| Where does this byte go | At the record’s address | Nowhere; a fuse has a position, not an address |
| How long is the file | As long as the used code | Exactly the device’s fuse count |
| What does a checksum cover | The record’s bytes | The fuse bits, weighted by index |
| Can it be disassembled | Yes | No |
That last row is why CPLD work needs a different toolchain entirely. A JED file fed to a disassembler produces nonsense, and the nonsense is not obviously nonsense.
RBT and the FPGA case
A raw bit file from an FPGA toolchain is a stream of configuration frames, ordered by the device’s internal addressing. It has no header in the usual sense and no per-record integrity check. Its length is fixed by the device, and its content is meaningless without the device’s frame map.
| Property | Consequence |
|---|---|
| Fixed length per device | Truncation is detectable by length alone |
| No per-frame checksum | Corruption inside a frame is invisible |
| Bit order defined by the toolchain | Byte-swapping produces a scrambled but plausible file |
| No address information | Cannot be relocated or partially loaded |
The third row catches people converting between vendor tools: the same bitstream exported by two tools can differ by bit ordering within each byte, and the resulting file programs the device and configures nothing.
CRC and checksum are not the same guarantee
A recurring confusion is treating any integrity value as equivalent to any other.
| Value | Detects | Does not detect |
|---|---|---|
| Per-record checksum in HEX | Single-byte errors within a record | Missing records, wrong base |
| JED fuse checksum | Positions of set fuses | A design that is internally consistent but wrong |
| CRC over the file | Any change to the file bytes | A file that was wrong before the CRC was computed |
| Device-side verify | That the device matches the file | That the file matches the design |
The last row is the important one for copying work: device verification proves agreement between two things that can both be wrong. This is exactly the failure mode described in copying CPLD IC code, where a map from the wrong revision verifies perfectly.
Converting between containers without losing information
Conversion is safe in one direction and lossy in the other.
| Conversion | Safe | Note |
|---|---|---|
| HEX to binary | Only if the address range is known and contiguous | Gaps become padding |
| Binary to HEX | Yes, with a stated base | The base must be recorded |
| JED to binary | Not meaningful | Fuse indices are not addresses |
| OUT to HEX | Yes, with section mapping | Requires a linker script to be honest |
| RBT to anything | No | Frame order is device specific |
The fourth row is a common task in DSP work: a COFF or ELF object has sections with virtual addresses, and flattening it to a hex file requires deciding what to do with sections that do not belong in the load image. That decision is the same one described in reading DSP embedded source code, where recovering the section layout is the first step.
Reading the container is the first step of any job
Every project in this area begins with identifying what the file actually is, independent of its extension. The method is straightforward: look at the first bytes, check for record markers, compute the length against a known device size, and see whether any integrity value closes.
| Test | Identifies |
|---|---|
| Leading colon and hex record structure | Intel HEX |
| Leading S and a record type digit | S-record |
| Leading STX and field letters | JED |
| Length equals a device fuse count | JED or RBT |
| No structure at all | Raw binary |
Where the container is a JED, the field-level details are in reading the JED format. Where the file came from a DSP build, the section semantics are in reading DSP source code, and where it is a mixed board’s two files, attacking CPLD and MCU firmware files covers the pairing.
Services at this boundary
Work covers container identification, conversion with explicit base and padding decisions, integrity verification at the right level, and repair of headers that were stripped by a tool. It does not cover reconstructing addresses that a raw binary never contained, and it does not cover converting a fuse map into a memory image, because the two are not the same kind of object.
The habit worth adopting is to name the container in every report, because half the arguments in this field are arguments about which file was being discussed.