12.3.4 BLE OTA DFU Image File Definition

#BLE OTA DFU Image File Definition

BLE OTA DFU File contains the OTAU header and Upgradable Flash Image as shown in below figure. This file is loaded into OTAU Manager (Smart phone/ GATT client) to send to OTAU Target over BLE link.

Figure 12-38. BLE OTA DFU Image File Definition
  • Flash Image: Meta-data Header + Executable Firmware. This is full image content which is programmed in the device Flash Slot1.
  • Meta-data Header: Flash Image will have a metadata header, metadata payload and metadata footer that will give the Bootloader firmware information about where the firmware image is located, security decryption information, signature, sequence number etc. Digital signatures ensure the authenticity of the image and integrity of the data in the image. A digital signature also ensures that the data within the image has not been modified (preserving integrity) and is intact as it was generated at the source. Refer to meta data header format from stack document.
  • OTAU File Encryption: The executable firmware can be encrypted (This is configurable). Encrypting the image ensures the confidentiality of the data. This makes that no unauthorized parties are able to peek at the contents of the image. Only the end-device should be able to decrypt the image. AES128-CBC method of encryption is used. Only the firmware image is encrypted and OTAU Header is not encrypted.
  • BLE OTAU Header: This holds the OTAU File information for BLE OTA DFU Client (Ex: mobile App) to perform OTA DFU procedures. This header is not being sent over the air to OTAU Target.
Figure 12-39. BLE OTAU Header

◦ Total Header length: 16 bytes

◦ BLE OTAU Header Version (HEADER_VER): 1 byte

  • 0x01: PIC32CXBZ2/WBZ451

  • Others: RFU.

◦ Flash Image is encrypted or not (FLASH_IMG_ENC): 1 byte

  • 0x00: Firmware Image is not encrypted.

  • 0x01: Firmware Image is encrypted by AES-CBC method.

  • Others: RFU.

◦ Checksum : 2 bytes

  • Checksum value of full OTAU file.

◦ Flash Image ID (FLASH_IMG_ID): 4 byte

  • Identity number of Flash Image.

◦ Flash Image Revision/version (FLASH_IMG_REV): 4 byte

◦ OTAU File Type (FILE_TYPE): 1 Byte

  • 0x01: BLE OTAU File

  • 0x02: BLE+Zigbee Combo OTAU File

  • Others: RFU

◦ Reserved: 3 byte

OTA file is .bin file which can be generated from MPLABX Tools environment as illustrated below. The detail steps for image generation is explained later.
  • BLE OTA Header and Encryption Key Configuration:
Figure 12-40. BLE OTA Header and Encryption Key Configuration in MPLABX
  • Meta-data Header Configuration:
Figure 12-41. Meta-data Header Configuration in MPLABX