Home / Learn Embedded C / Flash Layout: Bootloader and Application
Flash Layout: Bootloader and Application
How flash memory is divided into separate regions for the bootloader and the application.
Theory in plain words
Definition
A bootloader-capable chip's flash is divided into at least two regions: a small bootloader region (at the fixed address the chip starts executing from after reset) and a larger application region (where the actual firmware lives, loaded/updated by the bootloader).
Why you need this
This separation is what makes field updates possible at all — the application region can be safely erased and reprogrammed by the bootloader without ever touching (and risking corrupting) the bootloader's own flash region.
How it works
The exact addresses and sizes of each region are defined in the chip's linker script (covered in depth in the Build Systems group) — both the bootloader's and the application's build must agree on where the application region begins.
Where you'll see this
- Linker script design
- Firmware update architecture
- Flash memory planning
Try it
A real bootloader performs exactly this kind of bounds check before accepting any incoming firmware bytes, to guarantee it can never overwrite itself.
Try it: computing each region's size from its start/end addresses
Computing sizes this way is a useful sanity check when reading a linker script, since the bootloader region is normally a small fraction of the much larger application region.
Test what you just read
1. Why must flash be divided into separate bootloader and application regions?
Keeping the bootloader in its own untouched flash region ensures it always remains available to receive a new application image, even if an application update goes wrong.