6.3.6.3 Project Properties Configuration for Current/Running Firmware

By following the previous steps, the BLE OTA capability is added to the application project. The user categorizes this as Firmware in the Slot0 section. For more details, see Memory Management from Related Links. The user needs to add the metadata header and bootloader to this project to make it a working project with OTA capability to receive a new upgradable image over the Bluetooth® LE link.

MPLAB® X tools allow the user to configure and append the metadata header to the application image. The required script and sample private key (.pem) files are added to the project folder (.X) when the user generates the OTA code using MCC.

Figure 6-78. Project Folder (.pem and .X)
Attention: Before proceeding, close and reopen the OTA application project in MPLAB® X IDE. The user must perform this step to properly load the SignFirmware and OTA bin generation scripts into the project environment.
The following are the steps to configure the project properties for enabling OTA firmware upgrades.
  1. Right-click on the project in MPLAB® X and select Properties.
    Figure 6-79. Project Properties
  2. The SignFirmware script adds a metadata header to your application image. For more details, see BLE OTA DFU Image File Definition from Related Links. The header contains parameters such as Firmware Revision, Authentication Method, Manufacturer ID and Sequence Number.
    Figure 6-80. SignFirmware Settings
    1. In the “Firmware Rev:” field, set the firmware version of the currently running firmware. It must match the version in the Device Information Service (DIS). For more details, refer to Step 1 of Verifying Configurations from Related Links.
    2. From the “Auth Method:” drop-down list, choose one of the following three authentication methods:
      1. Signature validation (ECDSA256-SHA256): This is the most secure method and provides data integrity. The signature is encrypted using an ECDSA private key. The user must program the 256-bit ECDSA public key into the device for signature verification. The user can use tools like OpenSSL to generate the key pair. For example, see Generate a JWT with ECDSA keys. A sample private key is available in the project folder (.X). For more details, see Project Folder (.pem and .X) figure. The public key is used in the Bootloader project.
      2. Hash validation (SHA-256): This method provides data integrity check with less security.
      3. No validation (None): This method provides no security and no integrity check.
      Warning: Ensure to keep the sequence number as a non-zero value and not 0xFFFFFFFF. This helps the bootloader distinguish between valid and invalid images.
  3. The standalone bootloader project is available in the \bootloader folder of the application GitHub repository. The bootloader code is available in the Boot Flash section. Add the bootloader project (from either bootloader_GPIO or bootloader_timer based on requirement) as a loadable project to the OTA application project. When the user builds the OTA project, MPLAB® X generates a unified image containing:
    • Bootloader
    • Metadata Header
    • Firmware
    Figure 6-81. Adding Loadable Project
  4. After configuring the above settings, click Apply and then OK in the project properties window.
    • This saves the configuration and enables the OTA upgrade capability for the firmware.