What is BootLoader?
A Bootloader is the first program which executes (before the main program) whenever a system is initialized. In PC It is used to boot he OS of the system. In case of microcontrollers, a bootloader enriches the capabilities of the microcontroller and makes them self programmable device. This article will explore the significance of having bootloader in microcontroller.
While working with microcontroller a common problem faced is to program the controller? Different controllers follow different protocols to program their ROM and hence every controller has a different programmer, which is difficult to be made. A universal programmer on the other hand is quite costly.
With the upgrading era of technology, today’s microcontrollers are not only growing powerful but also incorporate technically superior functionality which makes them more flexible and quite easy to use. The bootloader is one of them. A bootloader is a small section in the ROM of the controller which executes first when it is initialized. Generally the bootloader are written to empower a controller with self burning capabilities. The bootloader program can access any of inbuilt peripherals like USB, USART, CAN, SPI, etc. to exchange the data and this capability is used to write the flash memory. In automotive industries the controllers are encapsulated in a metal case and leaves accessibility to few pins only.. In such cases the controller is programmed with the bootloader program using CAN interface at the time of manufacturing and then it is pasted in the circuits, which provides an ease to update the code with time.
The bootloader can be inserted into a controller by using an external or any conventional burner and then depending on the type of bootloader the controller starts responding to the interface. So whenever the controller is reinitialized the program counter jumps to the bootloader section and then it waits there for the instruction, which is fed from external device. In case there is no bootloader the program counter will go on 0000H (starting position of the flash memory) and start executing the instructions which are written in the memory of the device.
Fig. 1: Image showing role of a bootloader
If the program counter enters the bootloader section then after executing the bootloader, there must be an instruction in the bootloader which will force the program counter to go to 0000H.
Mostly the bootloader resides in the bottom most area of the ROM but there are some cases where the boot loader can be configured in the top (like in PIC18F).The starting and ending address of the bootloader in the ROM depends on the product. So it’s recommended to use the datasheet to collect the required information.