1 /* 2 * Copyright 2022-2024 NXP 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #include <zephyr/kernel.h> 8 #include <zephyr/sys/reboot.h> 9 #include <zephyr/dfu/mcuboot.h> 10 11 /* Main entry point */ main(void)12int main(void) 13 { 14 int err; 15 16 printk("Launching primary slot application on %s\n", CONFIG_BOARD); 17 /* Perform a permanent swap of MCUBoot application */ 18 err = boot_request_upgrade(BOOT_UPGRADE_PERMANENT); 19 if (err) { 20 printk("Failed to request upgrade: %d", err); 21 } else { 22 printk("Secondary application ready for swap, rebooting\n"); 23 sys_reboot(SYS_REBOOT_COLD); 24 } 25 return 0; 26 } 27