Skip to content

Commit c46d27c

Browse files
nvlsianpubjarki-andreasen
authored andcommitted
[nrf noup] boot/../loader: reboot after updating s0/s1
As this is MCUboot updating itself, it should reboot the device so NSIB will chainload the update MCUboot Signed-off-by: Andrzej Puzdrowski <[email protected]> (cherry picked from commit 8541955)
1 parent 64a4660 commit c46d27c

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

boot/bootutil/src/loader.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@
4949
#include "bootutil/boot_hooks.h"
5050
#include "bootutil/mcuboot_status.h"
5151

52+
#ifdef __ZEPHYR__
53+
#include <zephyr/sys/reboot.h>
54+
#endif
55+
5256
#if defined(CONFIG_SOC_NRF5340_CPUAPP) && defined(PM_CPUNET_B0N_ADDRESS)
5357
#include <dfu/pcd.h>
5458
#ifdef CONFIG_PCD_READ_NETCORE_APP_VERSION
@@ -2627,6 +2631,12 @@ context_boot_go(struct boot_loader_state *state, struct boot_rsp *rsp)
26272631
rc = boot_perform_update(state, &bs);
26282632
}
26292633
assert(rc == 0);
2634+
#if defined(PM_S1_ADDRESS) && defined(CONFIG_REBOOT)
2635+
if (owner_nsib[BOOT_CURR_IMG(state)]) {
2636+
sys_reboot(SYS_REBOOT_COLD);
2637+
2638+
}
2639+
#endif
26302640
break;
26312641

26322642
case BOOT_SWAP_TYPE_FAIL:

boot/zephyr/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ config MCUBOOT
1818
select MPU_ALLOW_FLASH_WRITE if ARM_MPU
1919
select USE_DT_CODE_PARTITION if HAS_FLASH_LOAD_OFFSET
2020
select MCUBOOT_BOOTUTIL_LIB
21+
select REBOOT if SECURE_BOOT
2122

2223
config BOOT_USE_MBEDTLS
2324
bool

0 commit comments

Comments
 (0)