What is a bootloader?

The Rise and Rise of Mechatronics

What is a bootloader?

A guide for non-automotive engineers…

Modern cars contain somewhere in the region of 100 to 200 computers. These computers control the myriad of systems on your car. Such as the engine, gearbox, windows, lights, wipers, climate control and so on. All the computers are connected together on communication networks in the car.

Car computers use different networks to printers and laptops. They use networks called CAN and LIN. Cars are starting to use Ethernet but this is a different special Ethernet and still will not work with your printer. With these networks the computers talk to each other to deliver the features we love. For example control of the rear windows from the driver’s door or automatic parking assistance systems when we select reverse gear.

The software in these computers is programmed in the factory before they are built into the car. Since they are ugly little plastic boxes they are hidden away in the bowels of the vehicle. These little computers are called ECUs, Electronic Control Modules.

Occasionally the software has bugs and the ECUs need to be reprogrammed. To avoid the need to remove the ECUs from the car they are reprogrammed over the in-car networks. To make this possible a special piece of software needs to be installed into the ECUs when they are built. This piece of software is called a bootloader.

Normally when an ECU is running it is doing its normal control activities such as looking after the engine, running the aircon or managing the door-latches. The software that does the normal control activities is called the application. The bootloader is used to reprogram the application within the ECU.

When an application in an ECU needs to be reprogrammed the car is taken into a main dealer garage. The technician in the garage plugs a service diagnostics tool into the car. The service diagnostics tool exchanges a security key with the application in the ECU. This security key gives the service tool authority to reprogram the ECU application.

Reprogramming an application in an ECU is done in a specific sequence. Where the service tool requests that the application sets a reprogram flag within the ECU. The application is then stopped and the ECU is reset (turned off and on again). Every time an ECU starts it runs the bootloader software first. The bootloader sees the flag and does not run the application. Instead the bootloader talks with the service diagnostics tool to get the new application. The bootloader copies the application into the ECU flash memory. This is why reprogramming an ECU is often called reflashing. The bootloader checks the reprogramming has been done correctly and if so clears the flag. Next the bootloader resets the ECU. This time there is no reprogramming flag so the bootloader runs the new application. Job done.

The sequence above is the simplest case. In advanced cars ECUs are reflashed over the mobile phone network. Now you don’t need to take the car to the garage. This has a downside where if an ECU is half way through being reflashed it doesn’t have an application. If it doesn’t have an application it doesn’t work. To overcome this some ECUs have two applications; the one running now and one that can be reprogramed. In this way the ECU is always available to perform its normal control duties. This feature is called multi-imaging.

Reflashing software over the air (called SOTA) using the mobile phone network means the car is vulnerable to hackers. Consequently the security features can be very complex. ECUs are adopting advanced cyber-security algorithms and special Hardware Security Modules that are available on newer silicon chips.

Bootloaders are becoming much more advanced and are the technology underpinning the software in tomorrow’s car. They are the car manufacturers’ insurance policy to fix things after the car is sold.

If you need a bootloader, get in touch!