Bootloader Basics – Part 1

Recently, we have received the STM32 Nucleo-144 board. We thought of providing a Tutorial Series that explains How to design and write our own bootloader for STM32 Devices. Before start writing the code, we must know about what is the bootloader, and why it is required. This post will give you a basic understanding of the bootloader (Bootloader Basics).

Bootloader Basics

The bootloader is a very important component in any operating system. A bootloader, also known as a boot program or bootstrap loader. It is special operating system software that loads into the working memory of a computer after start-up. So, you must be clear that this is also software like an application. The term bootloader is a shortened form of the words bootstrap loader”.

How does the bootloader work?

To understand the operations of the bootloader, you don’t need to be an expert in embedded systems. If you have used Windows operating system, then that is fair enough.

Have you noticed some text comes before the windows logo comes when you turn on the system? At the time of booting, if you press the Shift key or F12 key, then you may see one blue color screen with some options. Yes, that is the bootloader. It will do some operations based on the need. Once it has done its work, then it will give control to the OS. Then OS will take care of the system running. You can take any OS including Mac, or Linux. All OS has the bootloader which will run initially.

What is a Bootloader in Embedded systems?

Like a normal OS, the bootloader in a microcontroller also serves the same purpose. This is the first piece of code that runs when you press the reset button if you have a bootloader. If you don’t have a bootloader, then directly an application will start running. We have already discussed, what happens when we press the reset button if the bootloader is not present in STM32 (Cortex M4).

If you have a bootloader, then before the application, this bootloader starts running and does some process. Once it is done with the operations, the bootloader job is done. So, it gives control to the application. Now, the application does its job based on our product or project.

What is the need for Bootloader in Microcontroller?

Firmware update

Is it really useful? Why do we need this? Still, I am using a project which doesn’t have a bootloader. I will try to answer the questions.

I agree that when you don’t have a bootloader, it is very simple. We are not complicating by writing an extra bootloader. Only application is enough. But when you are planning to sell your products to the customers, what will do if you want to update the application/firmware in the device that you sold already? Every time go to the field and connect the JTAG/J-LINK and flash the firmware or application? It is not possible, right? So, If you have your bootloader, then you don’t need to worry about that. You can update the firmware or application without connecting any debugger or flasher.

Security

When you have the product which has to be secured, then what will you do when someone overwrites the application or firmware with their customized firmware to hack your product? How do you find it? In this case, we can use the bootloader to check whether the firmware is valid or not. If it is valid, then only we give control to the firmware or application.

Video Explanation

We have posted two variants of the bootloader. We request you to check variant 1 using STM32F103 and variant 2 using STM32F7 microcontroller.

If you are planning to develop the STM32 bootloader using MikroC Pro for ARM, please check these tutorials.

You can also read the below tutorials.

Linux Device Driver TutorialsC Programming Tutorials
FreeRTOS TutorialsNuttX RTOS Tutorials
RTX RTOS TutorialsInterrupts Basics
I2C Protocol – Part 1 (Basics)I2C Protocol – Part 2 (Advanced Topics)
STM32 TutorialsLPC2148 (ARM7) Tutorials
PIC16F877A Tutorials8051 Tutorials
Unit Testing in C TutorialsESP32-IDF Tutorials
Raspberry Pi TutorialsEmbedded Interview Topics
Reset Sequence in ARM Cortex-M4BLE Basics
VIC and NVIC in ARMSPI – Serial Peripheral Interface Protocol
STM32F7 Bootloader TutorialsRaspberry PI Pico Tutorials
STM32F103 Bootloader TutorialsRT-Thread RTOS Tutorials
Zephyr RTOS Tutorials - STM32Zephyr RTOS Tutorials - ESP32
AUTOSAR TutorialsUDS Protocol Tutorials
Product ReviewsSTM32 MikroC Bootloader Tutorial
VHDL Tutorials
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments
Table of Contents