apache / mynewt-mcumgr

Apache mynewt
https://mynewt.apache.org/
99 stars 76 forks source link

cmd/img_mgmt: Allow upgrade-only requests #25

Closed ccollins476ad closed 5 years ago

ccollins476ad commented 5 years ago

This PR adds an additional boolean field to the "image upload" request: upgrade. If this field is true, the firmware will only accept an upload attempt if the new image's version number is greater than that of the currently running image (using a semver-compatible comparision).

If the upgrade field is false or missing, no version check is performed.

The firmware only processes the upgrade field on the first image chunk. It is harmless, but pointless, for a client to specify upgrade in any subsequent chunks.