subsys: dfu: boot: mcuboot: Query current img ver

Allow a running image to query its own version number.

Signed-off-by: Christopher Collins <ccollins@apache.org>
This commit is contained in:
Christopher Collins 2018-01-25 18:31:11 -08:00 committed by Carles Cufí
commit 2ad7ccdb2d
2 changed files with 59 additions and 2 deletions

View file

@ -28,6 +28,15 @@
/** Swap failed because image to be run is not valid */
#define BOOT_SWAP_TYPE_FAIL 5
#define BOOT_IMG_VER_STRLEN_MAX 25 /* 255.255.65535.4294967295\0 */
struct image_version {
u8_t iv_major;
u8_t iv_minor;
u16_t iv_revision;
u32_t iv_build_num;
};
/**
* @brief MCUboot image header representation for image version
*
@ -137,6 +146,8 @@ bool boot_is_img_confirmed(void);
*/
int boot_write_img_confirmed(void);
int boot_current_image_version(struct image_version *out_ver);
/**
* @brief Determines the action, if any, that mcuboot will take on the next
* reboot.
@ -165,4 +176,4 @@ int boot_request_upgrade(int permanent);
*/
int boot_erase_img_bank(u32_t bank_offset);
#endif /* __MCUBOOT_H__ */
#endif /* __MCUBOOT_H__ */