PostHeaderIcon TMS320F2812: Securing the Flash Does Not Secure the Design

The word “secured” describes the state of the flash array, and it is easy to read as a description of the product. On this part the two are not the same, because the external memory interface lets the core fetch instructions and read data from a bus that leaves the package. When that bus is in use, the firmware is distributed across the die and the board, and only one of those is protected.

The interesting cases are not exotic. A design that runs a control loop from internal flash but keeps a large lookup table in external RAM is ordinary, and it is also a design whose table is readable by anyone with a logic analyser.

What the interface exposes

The interface presents address, data and control lines, and it behaves like any parallel memory bus: reads and writes are visible on the pins, in order, with timing. Code fetched from external memory is therefore not merely readable at rest — it is broadcast continuously while the device runs.

What is external What the pins reveal Persistence
Program code Instruction fetches, in address order Every execution
Constant tables Read bursts at table addresses On use
Working data Read-modify-write sequences Continuous
Buffered output Writes to a frame or DAC region Continuous

The first row is the significant one. A device executing from an external bus is running its program in the open, and no configuration bit inside the die changes that.

The usual arrangement

Most designs on this family keep the boot and the interrupt-heavy code internal and put bulk data outside. That is a reasonable engineering choice and a poor security one, because the data is often the valuable part: calibration, characterisation curves, signal-processing coefficients, protocol tables.

A coefficient table of several kilobytes, read on every control cycle, tells an observer the loop structure, the filter order, the sample rate and the scaling — which is most of the algorithm, even though no instruction was captured.

Why protection stops at the pin

The code security module gates accesses that originate outside the secure region inside the device. It has no visibility into what happens after data crosses the interface, because the interface is a legitimate path out of the region by design — that is what it is for.

This produces a clean division of responsibility that is frequently described wrongly:

  • The module protects the array from being read by an unauthorised master.
  • The module does not protect the design from observation at the bus.

Both statements are true at once, and a product can satisfy the first while failing the second completely.

Detecting that a design uses external memory

Three reliable indicators, in order of cost:

Pin activity at the interface. Address and data lines toggling in bursts, synchronous with execution. If nothing toggles at idle, the bus may still be used during operation.

Boot code initialising the interface. The registers that configure wait states, bank sizes and chip-select timing are written early in initialisation. Their presence in a disassembly of the internal image is conclusive.

Timing. A loop that runs faster than internal memory alone would allow, or a data structure too large for the internal RAM, implies an external region.

Only the second is available on a locked part, and it requires reading the internal image — which, on a locked part, is a separate problem.

What can be recovered from the bus

Capture the bus for long enough and the content becomes reconstructable, because reads are address-tagged. The mechanics:

  1. Capture address and data with a logic analyser at a rate above the bus clock.
  2. Filter to read cycles only.
  3. Sort by address, keeping the most recent value per address.
  4. Repeat across the device’s operating modes, since tables are read only when needed.

The result is a sparse but growing map of the external region. Sparse, because unread addresses are invisible; growing, because the device reads what it uses. Over a full exercise of the product’s functionality, the map approaches the content.

The limits of that approach

Not everything appears. Regions read only during a mode that never runs, or during a fault path, remain unknown. And a table read once at startup, before capture began, is missed entirely.

The honest characterisation: bus capture recovers what the device did, not what the device contains. For a table-driven algorithm the two are close. For a rarely executed branch they are not.

There is also a resolution problem. A narrow capture window misses cycles; a wide one overflows. In practice this forces a choice between coverage and completeness, and the right answer is several captures under different conditions rather than one long one.

Protecting a design against this

If the point of view is defensive rather than attacking, the measures are architectural:

  • Keep algorithm-critical constants internal, even at the cost of a smaller table.
  • If external memory is unavoidable, load tables into internal RAM at startup and disable the interface afterwards.
  • Avoid executing from external memory on any device that ships.
  • Treat the bus as public: everything on it is readable by anyone holding the product.

The third item is the one that costs nothing and is most often neglected, usually because the prototype was built that way and never revisited.

Where this leaves a recovery project

On a device of this shape, the internal flash is one source among three, and it is not always the most informative. A bus capture, a set of behavioural measurements and a partial internal image together describe the design; any one of them alone describes a fragment.

The mistake to avoid is treating the protected array as the whole problem. A design with an external bus is a design with a published interface, and starting from the interface is often faster than starting from the die.

Related reading

FAQ

Does locking the flash stop external memory accesses? No. The interface is a legitimate path out of the secure region; the module governs internal accesses.

Can code execute from external memory? Yes, subject to wait-state configuration. When it does, the program is visible on the pins.

Does a bus capture recover everything? Only what the device read while capture was running. Unused regions stay unknown.

Is external memory common on this part? It is one of the reasons the part exists. Designs that need more table space than the die provides use it routinely.

Can firmware disable the interface after loading tables? Yes, and doing so removes the exposure. It is a cheap measure that is frequently omitted.

Conclusion

“Secured” on the F2812 describes an array, not a product. The external bus is a legitimate, documented, permanently available path out of the die, and designs that use it expose whatever crosses it. Understanding which of the three sources holds the informative part is the first step of any real assessment — and the first step of defending the next design.

Comments are closed.