1.10.1.1 Application Version Numbers
Using application version numbers are almost mandatory when determining if the device has the latest application code installed. This is done by comparing the version of the current application SW to the latest available version on the web, a SD card or other place. To make version numbers easier for the user, the FW generated by MCC has numerous functions to access the version number header in each partition on the device. Extra example code can also be generated that prevents rolling back the FW to an older version.
The application version number is stored in the application header file at the beginning of the application space. The name of the file is application_header_VERIFICATION_METHOD.S, where VERIFICATION_METHOD is the method used to verify the application. The exact location in memory of the data will vary based on the verification method. The details of the application header can be found here in Application Header Details
To make accessing this value easier for the user, a helper function, BOOT_VersionNumberGet(), shown below has been created to read the application version number of an image from the bootloader. This function will handle all of the complexity of selecting the correct image, walking through the header information and returning the value of the version number in the header.
- bool BOOT_VersionNumberGet(enum BOOT_IMAGE image, uint32_t *versionNumber)
-
This function will parse the indicated application image header and copy the 32 bit version number into memory location pointed to by pointer versionNumber. If the user provided a valid image number supported by this device and if there was an image there with a valid image number, this function will return true. Otherwise, it will return false if the image was blank or version numbers were not supported by that header.