subsys: dfu: boot: Allow inspection of boot state.

Exposes the operation that MCUboot will perform on the next reboot
(e.g., stay on current image, swap to alternate image, etc.).

Signed-off-by: Christopher Collins <ccollins@apache.org>
This commit is contained in:
Christopher Collins 2018-01-17 17:40:36 -08:00 committed by Carles Cufí
commit 7b27fa6d5a
2 changed files with 173 additions and 2 deletions

View file

@ -13,6 +13,21 @@
#include <zephyr/types.h>
/** Attempt to boot the contents of slot 0. */
#define BOOT_SWAP_TYPE_NONE 1
/** Swap to slot 1. Absent a confirm command, revert back on next boot. */
#define BOOT_SWAP_TYPE_TEST 2
/** Swap to slot 1, and permanently switch to booting its contents. */
#define BOOT_SWAP_TYPE_PERM 3
/** Swap back to alternate slot. A confirm changes this state to NONE. */
#define BOOT_SWAP_TYPE_REVERT 4
/** Swap failed because image to be run is not valid */
#define BOOT_SWAP_TYPE_FAIL 5
/**
* @brief MCUboot image header representation for image version
*
@ -122,6 +137,14 @@ bool boot_is_img_confirmed(void);
*/
int boot_write_img_confirmed(void);
/**
* @brief Determines the action, if any, that mcuboot will take on the next
* reboot.
* @return a BOOT_SWAP_TYPE_[...] constant on success, negative errno code on
* fail.
*/
int boot_swap_type(void);
/**
* @brief Marks the image in slot 1 as pending. On the next reboot, the system
* will perform a boot of the slot 1 image.