EMBEDDED SYSTEMS & MICROCONTROLLERS · PAGE 28
Programming the Chip: Bootloaders and Programmers
How firmware gets into flash.
A hardware programmer talks to dedicated pins and writes your compiled program into flash. It can also set configuration bits such as clock source.
A bootloader is a small program already in flash that listens on a port such as UART at start-up and writes new firmware sent by your computer, so no programmer is needed.
Wrong configuration bits can lock you out, so read about them before changing anything.