tests: mcuboot: add boot_request_upgrade() return value check
- Adds boot_request_upgrade() return value check. - Avoid repeating resets if the upgrade request fails. Signed-off-by: Andrej Butok <andrey.butok@nxp.com>
This commit is contained in:
parent
206897658a
commit
62fa3f729c
1 changed files with 10 additions and 4 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2022 NXP
|
* Copyright 2022-2024 NXP
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
@ -11,10 +11,16 @@
|
||||||
/* Main entry point */
|
/* Main entry point */
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
|
int err;
|
||||||
|
|
||||||
printk("Launching primary slot application on %s\n", CONFIG_BOARD);
|
printk("Launching primary slot application on %s\n", CONFIG_BOARD);
|
||||||
/* Perform a permanent swap of MCUBoot application */
|
/* Perform a permanent swap of MCUBoot application */
|
||||||
boot_request_upgrade(1);
|
err = boot_request_upgrade(BOOT_UPGRADE_PERMANENT);
|
||||||
printk("Secondary application ready for swap, rebooting\n");
|
if (err) {
|
||||||
sys_reboot(SYS_REBOOT_COLD);
|
printk("Failed to request upgrade: %d", err);
|
||||||
|
} else {
|
||||||
|
printk("Secondary application ready for swap, rebooting\n");
|
||||||
|
sys_reboot(SYS_REBOOT_COLD);
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue