Electronic – How does a microcontroller load and execute a bootloader

bootloadermicrocontroller

I know that for a regular PC, BIOS executes its handler of interrupt 0x19 to search for a bootable device and if a device is found, first 512 bytes are loaded at 0x7c00 and BIOS starts execute from that address. 0x19 and 0x7c00, although are standard, are defined by BIOS manufacture.

Since microcontroller does not use external device like a hard drive to boot but use its flash memory, how do I know where is it going to load and execute bootloader code in flash memory? And using what interrupt? Is there any document, i.e. I have a TM4C123 microcontroller, what relevant documents do I need to look at to write a bootloader?

Best Answer

A microcontroller, just like any other CPU, starts executing code from a fixed address. That address is often known as the "reset vector".

The address will be in the datasheet for the microcontroller.

Even on a PC it works like that. The "booting" off a hard drive is about number 10347 in its list of things to do when it starts - the first is to execute code from ROM, just like a microcontroller does from Flash.