Home / Learn Embedded C / What Is a Bootloader?

What Is a Bootloader?

A small program that runs first and can load or update the main application firmware.

Bottom lineA small program that runs first and can load or update the main application firmware.

Breaking it down

What a bootloader decides at resetRun existing application immediatelyOR: enter update mode and receive new firmwareOR: fall back to a previous known-good firmware image if the current…
What a bootloader decides at reset

The basic idea

A bootloader is a small, separate program that runs immediately after reset, before the main application — its job is to decide whether to run the existing application or load a new one (over UART, USB, or another channel) first.

Why this comes up

Without a bootloader, updating firmware on a deployed device would require physically reprogramming it with a dedicated programmer tool — a bootloader enables field updates through a simple, ordinary communication channel instead.

The mechanics

A bootloader typically occupies a small, fixed region of flash memory, separate from the application's own flash region, and is itself rarely (if ever) updated once deployed, since it is the fallback mechanism that must always remain reliable.

Where it is used

  • Field firmware updates
  • Product update infrastructure
  • Recovery from a bad firmware image

Try it

A simulated bootloader decision: run app, update, or fall backC: edit and run

A real bootloader checks a hardware pin or stored flag for update_requested, and a CRC (next lessons) for current_image_valid.

Try it: a bootloader checking a dedicated "enter update mode" pin

Deciding to enter update mode based on a held-down button pin at bootC: edit and run

Many real bootloaders check a physical pin (like a held button) at boot time as one common way of requesting update mode, alongside or instead of a software-set flag.

Quick check

1. What is the primary purpose of a bootloader?