Your browser is no longer supported. Please upgrade your browser to improve your experience.

Bootloaders play a crucial role in most embedded devices. But what are they? Do you need one? 

When talking to non-technical stakeholders, bootloaders frequently come up as something they’re uncertain about. It’s not surprising—even the experts disagree on what some of the related terms mean. 

In this blog, we explain the purpose of embedded bootloaders, their crucial role in updating firmware, and who should be responsible for creating them. 

In this article: 

What is a bootloader?

Do all devices need a bootloader?

Is a bootloader the same as firmware?

How do you update embedded firmware?

What is a bootloader’s role in updating firmware?

Whose responsibility is the bootloader?

Don’t take chances

What is a bootloader? 

A bootloader is the first piece of code that runs when you turn on a device.  

Its job is to load essential software on the processor chip, which will allow higher-level software to run. If the device has an operating system (OS), such as Windows, MacOS, Linux, Android, or iOS, then the bootloader’s job is usually to load this into the device’s main memory (RAM).  

Most embedded devices have bootloaders, too. However, the most common purpose of a bootloader on an embedded system is to update the software.  

Do all embedded devices need a bootloader? 

No. Not all devices need bootloaders. However, a device without a bootloader is effectively unchangeable in the user’s hands; you won’t be able to fix bugs, patch security issues, or improve performance. As you might imagine, omitting a bootloader carries a very high risk and is generally inadvisable. 

So, is a bootloader the same as firmware?

Bootloaders are a type of firmware.  

We use “firmware” to describe all software programmed onto a microcontroller, including the bootloader. However, some people will only use the term for embedded software that cannot be updated. Historically, firmware was considered effectively permanent; once the device shipped, it would receive no further updates—hence firmware.  

However, times and technology have changed. Firmware controls evermore complex technology and is often stored in flash memory, which is far easier to reprogram. And there are plenty of reasons to install updates. These include:  

  • fixing bugs, 
  • improving security, 
  • adding new features, or 
  • making the device run faster or more efficiently. 

We know that bootloaders facilitate firmware updates, but how does a device receive updates in the first place? 

How do you update embedded firmware? 

There are several ways for embedded devices to receive firmware updates:  

Service centre 

Many devices can’t be updated in the field; they lack the means to interface. You’d have to physically take them apart to do so. As you might expect, delivering devices to service centres can be costly. Most companies tend to avoid this unless necessary. 

Physical interface 

Other devices might have an accessible physical port (such as a USB) allowing engineers or users to plug in external media and apply updates. This is less work than returning a product to a service centre, but it’s not always practical or possible. 

Imagine you have sensors gathering data in the depths of the jungle or the middle of the ocean; what then? Closer to home, imagine if every time your fridge, Wi-Fi, phone, smart speaker, e-reader, router, TV, and so on needed an update, you had to download the new firmware on your computer, copy it onto a memory stick, and then plug that into the device. 

Clearly, this isn’t a sensible option for many devices. 

Firmware over-the-air (FOTA) 

Network connectivity has changed everything. Firmware over-the-air (FOTA) enables internet-connected devices to receive updates remotely. It’s quicker, easier, and significantly less costly. The device can receive updates if it can connect to a network—Wi-Fi, mobile, satellite, or other. 

It’s important to note that some people use “FOTA” to describe only devices that can be updated wirelessly. In contrast, others will include devices on wired networks. 

Wired or not, FOTA must be carefully engineered. As we saw in a previous blog post, a stuck FOTA update on an IoT tumble dryer was likely responsible for sending and receiving 1GB of data daily. 

What is the bootloader’s role in updating firmware? 

The bootloader is essential for firmware updates. It is usually tasked with crucial functions during the update process:

How a firmware update happens: A device checks for an update. It finds a firmware update on a server and downloads it. The bootloader verifies the download, creates a backup, and installs the update. The installation is then validated. The device has been successfully updated.

Download/Transfer 

First, the active firmware identifies an available update and initiates the download or transfer. This code is not necessarily part of the bootloader since a bug here could be disastrous, but it is a vital part of the process. 

Verification  

The bootloader verifies the integrity of the new firmware. It ensures the update is from a trusted source and hasn’t been altered (either accidentally or maliciously) during the download process. This ensures the new download is safe and won’t compromise the device. 

Backup and recovery 

Have you noticed how your phone asks to be left plugged in while it updates? Any interruption to the update process—especially losing power—could be disastrous. If a firmware update goes wrong, it could render your device unusable (also known as “bricking”). 

For this reason, many bootloaders will hold a backup version of firmware. A previous working firmware can be restored if something goes wrong during the update. Phew! 

Installation and validation 

The bootloader installs the firmware and then validates that it was installed correctly. Finally, the bootloader hands control over to the firmware. Update complete! 

Who should create the bootloader?

It’s reasonable to ask: “Who should write this firmware? Is this a job for hardware engineers or software engineers?”

The answer isn’t so simple as choosing one or the other. Creating a high-quality, secure bootloader requires multiple expertise, encompassing distribution, security, hardware engineering, and more.

Chart showing expertise required for firmware update. Software engineers fulfil the following requirements: store updates on web server, securely check for updates, securely download updates, check download integrity, and check firmware integrity. Hardware engineers fulfil the following requirements: reprogramming and hardware design. Both software and hardware engineers can carry out reprogramming.

While many hardware and software engineers can create firmware, the unique challenges and constraints mean that important projects—particularly those in compliance-critical spaces—require a thorough understanding of the full embedded system stack. It requires a team. 

Diagram showing full embedded software development stack. Standard service offered by Bluefruit are: cloud, bootloader, algorithms, file system, PCB abstraction, complex drivers, hardware. Things that are usually off-the-shelf but Bluefruit can/do write are: libraries, operating system, microcontroller abstraction.

Don’t take chances

The bootloader is one of the most essential elements of your device. It could mean the difference between an up-to-date device that complies with all necessary industry standards and, in the worst-case scenario, a brick.  

Clearly, this is not an area to be cutting corners.  

To get the best possible outcome for your project, you should ensure that your development team have the required skills and capacity from the outset. 

If you have any questions or need advice on anything embedded, let us know. 

Did you know that we have a monthly newsletter?

If you’d like insights into software development, Lean-Agile practices, advances in technology and more to your inbox once a month—sign up today!

Find out more