PostHeaderIcon ATtiny261: A Wider Vector Table Means More to Verify

Peripheral count drives vector count. A twenty-pin part with a comparator, an ADC, two timer channels and a serial port has more interrupt sources than an eight-pin part with one timer, and every source needs an entry in the table at the bottom of the flash.

That table is the most structured thing in the image, and on this part it is long enough to be a real alignment and completeness test rather than a formality.

What the table looks like

The reset vector sits at address zero and is a jump. The interrupt vectors follow at a fixed spacing, one slot per source, most of them also jumps to the handler. Sources that the build does not use are usually filled with a jump to a common default handler, which is itself informative: a table full of identical targets means the firmware handles almost nothing asynchronously.

Four patterns are worth recognising:

Table pattern What it means What it tells you
All unique targets Event-driven design Behaviour lives in the handlers
Mostly one target Interrupts enabled, unhandled The stubs return immediately
Mixed, with gaps The realistic case Which peripherals matter
Targets past the table Handlers inline after the table Read them as a block

The fourth row is the one that catches people out. When every target lands just past the last entry, the handlers are written inline immediately after the table, and the block that follows is code rather than data. Reading it as code is the difference between finding the logic and missing it.

Why this is a verification tool

A vector table is a known structure at a known address. If the image is correctly aligned and complete, every slot decodes as a valid jump. If the image is off by a byte, the slots decode as instructions that do not exist in the instruction set.

That makes the table a stronger check than any checksum, because a checksum only proves the bytes are the bytes that were read. The table proves the bytes are correctly placed.

The check costs a disassembly of the first few dozen words. On a part this size it is the first thing worth doing after the read completes.

Peripherals and what they imply about the program

A twenty-pin part has room for analogue and digital functions that a smaller package cannot support. In practice that means the firmware usually has:

  • An ADC path, with calibration constants.
  • A comparator path, sometimes used for a threshold rather than a measurement.
  • A serial port, which means a protocol implementation.
  • Timer channels used for PWM, which means the code computes duty cycles.

Each of those corresponds to a cluster of code and a set of constants. Locating the clusters is the practical work of understanding the image, and the vector table is the map: handler addresses point at the code that services each peripheral.

Lock state on this family

The same four-state encoding applies, with no boot section and therefore no boot lock bits. The protection model is one field, and the reasoning is short: readable, or not, and if not, the erase is the only exit and it takes the array.

What differs from the eight-pin members is accessibility. Twenty pins means the programming interface is less likely to be fully occupied by other functions, and in-circuit entry is more often practical. That is a small but real advantage when a device is still fitted to its board.

Reading order

  1. Supply at the design rail, measured at the socket.
  2. Signature and fuses. A part configured for a crystal that is not on the board will not answer.
  3. Lock byte.
  4. Full array read in pages, each read twice and compared.
  5. Disassemble the vector table and confirm the reset vector’s target lies inside the application region.

Step 5 is the completeness test specific to this part. On a longer table, a single misplaced byte produces a table that is visibly wrong, which is exactly the kind of evidence that is hard to obtain from bulk data.

Related notes

FAQ

Does every vector have to point at unique code? No. Shared handlers are common, and a table full of one target is a legitimate build.

Can the vector table be relocated? Not on this family. There is no boot section and no vector redirection.

Why is the table a better alignment test than a checksum? Because it has known structure. Misalignment makes it decode as invalid instructions, which a checksum cannot detect.

Does a longer table mean a bigger program? Not necessarily. It means more interrupt sources exist.

Conclusion

More peripherals mean more vectors, and a longer table is a better instrument. It verifies alignment, reveals which interrupts the firmware actually services, and indexes the code clusters behind each peripheral. On a twenty-pin part, that structure is the most reliable guide into an unfamiliar image.

Comments are closed.