From 62fa3f729c2b38fb591c3ce6cb1b4810370ddb1a Mon Sep 17 00:00:00 2001 From: Andrej Butok Date: Thu, 16 May 2024 16:10:17 +0200 Subject: [PATCH] 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 --- tests/boot/test_mcuboot/src/main.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/boot/test_mcuboot/src/main.c b/tests/boot/test_mcuboot/src/main.c index 3e9012a1484..a28f401f4bc 100644 --- a/tests/boot/test_mcuboot/src/main.c +++ b/tests/boot/test_mcuboot/src/main.c @@ -1,5 +1,5 @@ /* - * Copyright 2022 NXP + * Copyright 2022-2024 NXP * * SPDX-License-Identifier: Apache-2.0 */ @@ -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; }