Skip to content

Commit

Permalink
tests: mcuboot: add boot_request_upgrade() return value check
Browse files Browse the repository at this point in the history
- Adds boot_request_upgrade() return value check.
- Avoid repeating resets if the upgrade request fails.

Signed-off-by: Andrej Butok <[email protected]>
  • Loading branch information
butok authored and carlescufi committed May 29, 2024
1 parent 2068976 commit 62fa3f7
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions tests/boot/test_mcuboot/src/main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022 NXP
* Copyright 2022-2024 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand All @@ -11,10 +11,16 @@
/* Main entry point */
int main(void)
{
int err;

printk("Launching primary slot application on %s\n", CONFIG_BOARD);
/* Perform a permanent swap of MCUBoot application */
boot_request_upgrade(1);
printk("Secondary application ready for swap, rebooting\n");
sys_reboot(SYS_REBOOT_COLD);
err = boot_request_upgrade(BOOT_UPGRADE_PERMANENT);
if (err) {
printk("Failed to request upgrade: %d", err);
} else {
printk("Secondary application ready for swap, rebooting\n");
sys_reboot(SYS_REBOOT_COLD);
}
return 0;
}

0 comments on commit 62fa3f7

Please sign in to comment.