ZigBee OTA multiple images in one OTA file

by <a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Hero Employee</font></font> </a> kpszupin ‎12-22-2016 05:24 PM - edited ‎12-28-2016 04:38 PM


Currently, our OTA Client plugin code can only handle one image at a time. However, your client node will download an OTA image with two images in it, so it just needs to be parsed after/during download. This KBA will cover an OTA image that will have one image to update the ZigBee chip and a second image for the host to use.

The OTA image will consist of an OTA Header (ZigBee Doc docs-07-5123-05-0afg-zigbee-cluster-library-specification, Over-the-Air Upgrading section 11.4.2), Tag1 (which consists of a Tag ID and Length), Image #1 (EBL file), Tag2, and then Image #2. The first image in the OTA file will have the Tag ID of 0x0000 which signifies that this is the upgrade image for the ZigBee chip. The second image will have a Tag ID of any value above 0xF000 (ZigBee Doc 075123 Over-the-Air Upgrading section 11.4.2.19).

 

OTA File layout:

[OTA Header][Tag1][----Image #1 Data----][Tag2][----Image #2 Data----]


Idea #1: Modify OTA Client plugin to catch second tag during download
 - In imageBlockResponseParse() collect OTA Header and Tag1
 - Calculate if there is a Tag2
 - Continue download
 - When Tag2 is reached push data to host or continue to save locally.

Idea #2: Modify OTA Client plugin to request second tag at the start of download
  - Collect OTA Header and Tag1
  - Calculate if there is a Tag2
  - Request specific bytes to get Tag2
  - Download Tag1 image and push to local storage
  - Download Tag2 image and push to host

Caveats:
 - First tag must be Tag ID 0x0000
 - Depending on packet size, the 6-bytes of Tag #2 might be in two different packets (Idea #1).
 - If separating the two images, OTA Header length will not match the length of the downloaded image, so Image Verification will fail.