Chapter 7. Updating Code
When your system has problems after it goes out into the wild, youâll need to be able to update the code on a device in the field. To understand the complexities, letâs start by looking at how uploading works in the comfort of your development lab, and how that differs from uploading to a device youâve released.
During development, your system lets you peer into the guts of the code, maybe with a JTAG that can stop the processor. As part of the process, you also get to modify the code (aka flashing the chip). The method for doing that is chip-dependent, but it usually requires some special debugging widget. If you want to update the code after the system leaves your desk, youâll need to plan ahead. Although weâd like to arm the world with development hardware, it isnât cost effective (sadly).
The lowest level of updating code is very chip-dependent, but the general procedure follows certain common patterns.
Tip
There are many different names for updating code on a device: bootstrap loading, bootloading (even when it isnât related to booting), updating, uploading, burning the code, and over-the-air programming. Whatever you call it, uploading code is one of the most difficult topics in embedded systems. It is right up there with storing code on cartridges, keeping consumables secure, and faking floating-point math via binary scaling. This chapter may be tough the first time you read it. Donât lose hope.
Three different loaders are described in ...
Get Making Embedded Systems now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.