Adding Gecko Bootloader to Bluetooth Projects#

Bluetooth projects do not include Gecko Bootloder by default, so you have to add it separately!

In Bluetooth SDKs between v2.0 and v2.6:

  • Legacy OTA bootloader is included in Software Example projects created for EFR32BG1 devices

  • No bootloader is included in Software Example projects created for other devices (EFR32xG12, EFR32xG13)

In Bluetooth SDK v2.7 or later:

  • No bootloader is included in any Software Exmaple projects

  • However, when a demo is flashed, both the bootloader and the application are flashed

    • NCP - empty target demo is flashed along with a BGAPI UART DFU type Gecko Bootloader

    • Other demos are flashed with Bluetooth OTA type Gecko bootloader (configuration depends on the part)

Devices are shipped with preprogrammed bootloaders:

  • EFR32BG1 devices are preprogrammed with the legacy bootloader. The legacy bootloader is a one-stage simple bootloader with limited capabilities compared to the Gecko Bootloader. UART DFU and OTA DFU are the two types of the legacy bootloader. UART DFU upgrades the firmware using UART while OTA DFU upgrades the firmware using the Bluetooth connection. Devices are preprogrammed with UART DFU bootloader, but the projects in SDK v2.6 and older contain OTA DFU bootloader by default. The support for the legacy bootloader was discontinued in SDK v2.7. As a result, you have to add Gecko Bootloader to your project to overwrite the legacy bootloader. Gecko Bootloader also has UART and OTA configuration, which is compatible with the legacy bootloaders.

  • EFR32BG12 and EFR32BG13 devices are preprogrammed with a dummy bootloader, which can start the application but can't upgrade it. As a result, it is essential to overwrite it with the Gecko Bootloader.

  • EFR32BG21 and EFR32BG22 devices are not preprogrammed with any bootloader

  • BGM modules are usually preprogrammed with an UART bootloader, see What is the Factory-Programmed Firmware in the BGMx Modules? or the data sheet of your module.

To add a Gecko Bootloader to your Bluetooth project do the following:

First method

  1. Build your Bluetooth application.

  2. Flash your Bluetooth application (.s37 OR .hex OR .bin) to the device.

  3. Create a new Gecko Bootloader project, e.g., Bluetooth in-place OTA DFU Bootloader or BGAPI UART DFU Bootloader. Click the New Project button in Simplicity Studio, select Gecko Bootloader, select Bluetooth in-place OTA DFU Bootloader or BGAPI UART DFU Bootloader.

  4. Generate and build it.

  5. Flash the .s37 file that ends with "–combined” (e.g. bootloader-uart-bgapi-s37) file to the device. This will overwrite the legacy bootloader in EFR32BG1 devices or the dummy bootloader in EFR32BG12 devices.

  6. To flash a new version of the application, make sure that you use .hex or .s37 or .gbl format because the .bin format will overwrite the bootloader on some devices.

Note: Bootloader-uart-bgapi-combined.s37 contains the first+second stage of the Gecko Bootloader, while bootloader-uart-bgapi.* contains only the second stage. The first+second stage is needed when flashing the bootloader for the first time, while the second stage is needed when upgrading the bootloader (either by flashing or by using the DFU).

Second method

  1. If you use a EFR32BG1 device with SDK v2.6 or older, remove the legacy bootloader from the Bluetooth application project. If you have a different device or a later SDK, skip these steps:

    1. Right click on your project -> properties.

    2. C/C++ build > Settings > IAR Linker for ARM > Library or C/C++ build > Settings > GNU ARM C Linker > Miscellaneous > Other objects

    3. Remove binbootloader.o

  2. Build your Bluetooth application.

  3. Create a new Gecko Bootloader project, e.g., Bluetooth in-place OTA DFU Bootloader or BGAPI UART DFU Bootloader. Click the New Project button in Simplicity Studio, select Gecko Bootloader, select Bluetooth in-place OTA DFU Bootloader or BGAPI UART DFU Bootloader.

  4. Generate and build it.

  5. Merge the (combined) bootloader and the application image:

commander convert bootloader-uart-bgapi-combined.s37 your_application.s37 -o app+bootloader.s37
  1. Flash the merged image to the device.

Third method

  1. If you use a EFR32BG1 device with SDK v2.6 or older, remove the legacy bootloader from the Bluetooth application project. If you have a different device or a later SDK, skip these steps:

    1. If the .isc file is open in your project, close it first.

    2. Open the .isc file in your project with a text editor (right click -> Open With -> Text Editor).

    3. Change appPlugin: gecko_bootloader=false to appPlugin: gecko_bootloader=true.

    4. Change appPlugin: legacy_ble_ota_bootloader=true to appPlugin: legacy_ble_ota_bootloader=false.

    5. Save and close the .isc file.

    6. Open the .isc file with App Builder (right click -> Open With -> App Builder).

    7. Press Generate.

  2. Build your Bluetooth application.

  3. Create a new Gecko Bootloader project, e.g., Bluetooth in-place OTA DFU Bootloader or BGAPI UART DFU Bootloader. Click the New Project button in Simplicity Studio, select Gecko Bootloader, select Bluetooth in-place OTA DFU Bootloader or BGAPI UART DFU Bootloader.

  4. Generate and build it.

  5. Merge the (combined) bootloader and the application image:

commander convert bootloader-uart-bgapi-combined.s37 your_application.s37 -o app+bootloader.s37
  1. Flash the merged image to the device.

Fourth method (If you have SDK v2.7 or later)

  1. Flash a demo to your device.

    • Flash the SoC - Empty demo to your device first. This will flash the SoC - Empty application with Bluetooth in-place OTA DFU type Gecko Bootloader.

    • OR: Flash NCP target - Empty demo to your device. This will flash the NCP target - Empty application with BGAPI UART DFU type Gecko Bootloader.

  2. Build your Bluetooth application.

  3. Flash the .hex or the .s37 file to your device. This will not overwrite the bootloader (unlike .bin).

Note: commander.exe can be found in: C:\SiliconLabs\SimplicityStudio\vX\developer\adapter_packs\commander.

Warning: For SDK versions earlier than v2.4.0, the second and third methods work only if you are using IAR Embedded Workbench as a compiler. The GCC compiler is fully supported starting with v2.4.0.

Warning: In SDK v2.3.3, the postbuild step of the bootloader project may fail and the -combined.s37 file may be missing. In this case, open the bootloader project, go to "Project > Properties > C/C++ Build > Settings > Build steps", and put the script path between quotes. Rebuild the bootloader project.