What is the Arduino Bootloader?
The term "bootloader" is often mentioned in guides or troubleshooting threads where people are struggling to program their device. But what actually is a bootloader? and why does an Arduino need one?
The bootloader occasionally referred to as firmware is essentially a small hex file that is stored in a specially designated section of memory in the microcontroller. It allows the device to be programmed via the serial port which means rather than having to use an external AVR Programmer all you need to program it is a USB cable.
When the device is powered on or reset on this hex code is ran first before the stored user program. This code monitors the devices UART pins for a particular sequence of bytes which indicates an update or reprogramming of the bootloader, if this sequence of bytes is not detected then the device will run the code stored in the user memory.
Bootloaders are great for boards used in prototyping or situations where many iterations of code are used and tested. It makes programming the microcontroller quicker and easier than using an external programmer. Although extremely useful there are some tradeoffs to using a bootloader. It can take up valuable memory when using lower tier microcontrollers and can also make the boot process longer.