Bluetooth Dfu Image File: What It Is and Why You Need It
If you have a Bluetooth device that needs to be updated with new firmware, you may have heard of the term \"Bluetooth Dfu Image File\". But what does it mean and how does it work? In this article, we will explain what Bluetooth Dfu Image File is, how it is used for over-the-air (OTA) firmware upgrade, and what security features it offers.
Bluetooth Dfu Image File is a file format that contains the firmware image for a Bluetooth device. The firmware image is the software that runs on the device and controls its functionality. The file format is also known as GBL (Gecko Bootloader) format, as it is compatible with the Gecko Bootloader, a common bootloader for all Silicon Labs protocol stacks.
A Bluetooth Dfu Image File can be used to update the firmware of a Bluetooth device OTA, meaning that the device can receive the new firmware via a Bluetooth connection from another device, such as a smartphone or a PC. This eliminates the need for physical access to the device or a wired connection.
How is Bluetooth Dfu Image File used for OTA firmware upgrade?
To upload images OTA, you will need a dedicated Bluetooth application. You can either use Apploader or user application, as follows:
Apploader. The Apploader is a simple application, which is separated from the main application and has a minimal Bluetooth stack that handles the upload process. The Apploader can be used to update both the Bluetooth stack and the user application.
User application. The user application is the main application that provides the functionality of the device. The user application can be used to update only the user application itself, not the Bluetooth stack.
The OTA firmware upgrade process consists of the following steps:
The target device must be programmed with an appropriate Gecko Bootloader configuration and additionally with any Bluetooth application that supports OTA.
The target device must be rebooted into OTA DFU mode using the system_reset (1) API command.
The source device must have the new firmware image available in Bluetooth Dfu Image File format.
The source device must establish a Bluetooth connection with the target device and send the Bluetooth Dfu Image File using a custom protocol.
The target device must receive and verify the Bluetooth Dfu Image File and write it to its internal flash memory.
The target device must reboot and run the new firmware image.
What security features does Bluetooth Dfu Image File offer?
Bluetooth Dfu Image File offers three security features to protect against unauthorized or malicious firmware updates:
Authenticated (signed) upgrade file. An authenticated upgrade file means that an electronic signature is attached to the GBL file. The signature is produced with a public-private key pair. The public key is stored in the device, while the private key is kept secret by the manufacturer. The signature ensures that the upgrade file is from a trusted source.
Encrypted upgrade file. An encrypted upgrade file means that the content of the GBL file is encrypted to protect against eavesdroppers.
Secure Boot. Secure Boot means that a signature is attached to the firmware image (.s37) before it is packed into upgrade file formal (.gbl). A signed image file (secure boot) ensures that the image was not modified since last boot and that it is from a trusted source. This is checked at every boot.
How to create a Bluetooth Dfu Image File?
To create a Bluetooth Dfu Image File, you will need the following tools:
Simplicity Studio. This is the integrated development environment (IDE) for Silicon Labs products. You can download it from here.
Gecko Bootloader. This is the bootloader software that supports Bluetooth Dfu Image File format. You can find it in Simplicity Studio under Software Updates > SDKs > Gecko Platform.
Gecko SDK Suite. This is the software development kit (SDK) for Bluetooth applications. You can find it in Simplicity Studio under Software Updates > SDKs > Gecko SDK Suite.
Commander. This is a command-line tool for programming and debugging devices. You can find it in Simplicity Studio under Tools > Commander.
Private key. This is a secret key that is used to sign and encrypt the Bluetooth Dfu Image File. You can generate it using Commander or any other tool that supports ECDSA (Elliptic Curve Digital Signature Algorithm).
The steps to create a Bluetooth Dfu Image File are as follows:
Create a project for your Bluetooth application using Simplicity Studio and Gecko SDK Suite. You can use one of the example projects or start from scratch.
Build your project and generate a firmware image (.s37) file for your application.
Enable Secure Boot in your project by adding the following line to your project.xml (or project.bgproj) file: Then rebuild your project.
Create a project for your Gecko Bootloader using Simplicity Studio and Gecko Bootloader. You can use one of the predefined configurations or customize your own.
Build your project and generate a firmware image (.s37) file for your bootloader.
Create a Bluetooth Dfu Image File (.gbl) for your application using Commander. For example, you can use the following command: commander convert app.s37 --bootloader bootloader.s37 --keyfile private.pem --encrypt --sign --outfile app.gbl This command will convert the application image file (app.s37) into a Bluetooth Dfu Image File (app.gbl) using the bootloader image file (bootloader.s37) and the private key file (private.pem). It will also encrypt and sign the Bluetooth Dfu Image File with the private key.
You have now created a Bluetooth Dfu Image File that can be used for OTA firmware upgrade.
How to upload the Bluetooth Dfu Image File to the device?
To upload the Bluetooth Dfu Image File to the device, you will need the following tools:
A source device that has the Bluetooth Dfu Image File available and can send it over a Bluetooth connection. This can be a smartphone, a PC, or another Bluetooth device.
A target device that has the Gecko Bootloader and a Bluetooth application that supports OTA DFU. This can be either the Apploader or the user application.
A custom protocol that defines how the Bluetooth Dfu Image File is transferred and verified between the source and target devices. This protocol can be implemented using a custom GATT service and characteristics.
The steps to upload the Bluetooth Dfu Image File to the device are as follows:
Reset the target device into OTA DFU mode using the system_reset (1) API command. This will make the bootloader start either the Apploader or the user application, depending on which one supports OTA DFU.
Scan for and connect to the target device using the source device. The target device should advertise its OTA DFU capability using a custom service UUID.
Select the Bluetooth Dfu Image File on the source device and send it to the target device using a custom protocol. The protocol should use a control characteristic to initiate and terminate the transfer, and a data characteristic to send the GBL file.
The target device should receive and verify the Bluetooth Dfu Image File using the bootloader API. It should also decrypt and authenticate the GBL file if it is encrypted and signed.
The target device should write the new firmware image to its internal flash memory using the bootloader API. It should overwrite either the application area or a bootloader slot, depending on which part of the firmware is being updated.
The target device should reboot and run the new firmware image using the bootloader API.
What are the benefits of OTA DFU?
OTA DFU is a feature that provides many benefits for both the device manufacturers and the end users. Some of the benefits are:
Shorter time to market. OTA DFU allows you to launch your product before it is 100% finished, and then polish it on the field with updates. This gives you a competitive edge over your rivals who may spend more time on planning and testing.
Better customer satisfaction. OTA DFU enables you to fix bugs, address security vulnerabilities, and add new features to your product without requiring physical access or a wired connection. This improves the user experience and loyalty of your customers.
Adaptability to market changes. OTA DFU allows you to respond quickly to changes in the market, such as new standards, regulations, or customer demands. You can update your product to meet the new requirements and stay ahead of the curve.
OTA DFU is a powerful and essential feature for any Bluetooth device that aims to be reliable, secure, and future-proof. d282676c82