In a previous blog we discussed the role of the NVIC in ARM Cortex-M microcontrollers. This peripheral will play a central role in booting our target application. First of all, we need to discuss the boot process in an ARM Cortex-M microcontroller.
Boot process
- After Power On Reset the microcontroller assumes the NVIC table is located at address 0x00000000.
- The processor fetches the first two words in the NVIC table, corresponding to the top of the stack and the reset vector.
- It sets the MSP (Main stack pointer) to the top of the stack.
- It jumps to the address indicated by the reset vector.
- Application program execution begins.
In the case of our bootloader, the processor will be loading the top of the stack and the reset vector of our bootloader and then start executing it. Then, we the bootloader decides if it can boot an application already present at flash memory or if it needs to load an application using the loader. No matter which is chosen, it will eventually have to boot the target application.