PIC18F45K22: Application-Only Updates and What They Require
A device that can be updated in the field has a fixed part and a replaceable part. The fixed part is the boot block, which contains the vectors and the update routine. The replaceable part is the application above it. The boundary between them is a design decision, and it is recoverable from the device’s behaviour.
This arrangement is so common on products with a communication interface that it is worth treating as the default case rather than an exception. Once recognised, it answers questions that would otherwise require reading memory.
What the arrangement requires
For an application-only update to work, four things must hold:
| Requirement | Why |
|---|---|
| A fixed entry point above the boot block | The loader must know where to jump |
| A defined image format | The loader must parse what it receives |
| A verification method | The loader must decide whether to jump |
| A protected boot block | An update must not be able to overwrite the loader |
The fourth is not universal but is common, and it produces a device whose boot block is write-protected while the application is not. That pattern is itself evidence: a device with exactly that protection configuration has an update path, whether or not anyone documented it.
Finding the boundary
The boundary between boot block and application is an address, and it is inferable from several directions:
- From the protection pattern, if the boot block is separately protected;
- From the loader’s jump target, if the loader is readable;
- From the image format, if the update records begin at a consistent address;
- From behaviour, since the application’s first actions are observable as outputs.
The first is the cheapest when available. The second is the most precise. The third is available after a single update capture. The fourth works when nothing else is.
Why the application region is the interesting one
A boot block is generic. It loads, verifies and jumps. It may be the vendor’s standard code, present in a hundred products, and it says little about any particular one.
The application is where the product is. Its size, its table structure, its protocol implementation and its control logic all describe what the device does. For analysis, the boot block is the frame and the application is the picture.
That inverts a common assumption. People often treat the protected loader as the valuable secret and the application as routine; on these products the opposite is usually true, and the protection pattern frequently reflects it — loader readable, application closed.
Reading an application with a known start address
A known start address is worth a great deal. It provides:
- the entry point, which anchors the disassembly;
- the interrupt handler offsets, if vectors are relocated there;
- the boundary below which nothing needs decoding;
- a reference point for the image format’s addresses.
With those, a 32K image decodes in the usual order: entry point, initialisation, peripheral setup, main loop, handlers, tables.
What an update capture adds
If the device can be updated, capturing an update is the single most informative experiment available. It yields:
- the transport and its timing;
- the image format, including address handling;
- the verification method, from what the loader does with a corrupted image;
- the application’s extent, from the records transmitted.
The third item is underused. Sending a deliberately corrupted image and observing the loader’s rejection tells you the verification algorithm’s class — a simple sum rejects differently from a CRC, and the number of bytes before rejection often indicates the checked range.
Practical sequence
- Read the configuration; identify the boot block’s protection state and size.
- Capture an update if the device accepts one.
- Derive the application’s start address from the format or the loader.
- Decode from that address.
- For a replacement device, reproduce the boundary exactly — an application that starts elsewhere will not be jumped to.
Step five is the replication trap. A rebuilt application placed at a different address is invisible to the loader, and the device appears not to start while both parts are individually correct.
Related reading
- PIC18F46K22 and images that are three quarters available — the partial-read case on the same family.
- PIC18F44K22 and the vectors — why the block containing them is often protected.
- PIC18F25K80 and CAN as the update transport — the same arrangement over a different bus.
FAQ
How do I know a device has an update path? From the protection pattern, from a loader in the boot block, or from observing an update.
Where does the application start? Above the boot block, at an address the loader knows and the format reveals.
Is the boot block always protected? No, but it frequently is write-protected, which is why field updates do not overwrite it.
Why does a rebuilt application fail to start? Usually because it was placed at a different address from the original.
What does a rejected update reveal? The verification method’s class, and often the range it covers.
Conclusion
Application-only updates impose a structure: a fixed loader, a defined entry point, a format and a verification. That structure is measurable from outside, and it supplies the one thing a disassembly needs most — a starting address. Recognising the pattern early is what turns a 32K image into a readable one.