boot: zephyr: Add MCUboot status callback support
Adds an optional callback when the MCUboot status changes which can
allow components to react.
Signed-off-by: Jamie McCrae <jamie.mccrae@lairdconnect.com>
diff --git a/boot/bootutil/src/loader.c b/boot/bootutil/src/loader.c
index 6f6343c..27f2e5f 100644
--- a/boot/bootutil/src/loader.c
+++ b/boot/bootutil/src/loader.c
@@ -46,6 +46,7 @@
#include "bootutil/fault_injection_hardening.h"
#include "bootutil/ramload.h"
#include "bootutil/boot_hooks.h"
+#include "bootutil/mcuboot_status.h"
#ifdef MCUBOOT_ENC_IMAGES
#include "bootutil/enc_key.h"
@@ -1998,6 +1999,9 @@
}
#endif
+ /* Trigger status change callback with upgrading status */
+ mcuboot_status_change(MCUBOOT_STATUS_UPGRADING);
+
/* Iterate over all the images. At this point there are no aborted swaps
* and the swap types are determined for each image. By the end of the loop
* all required update operations will have been finished.