Hi!
I am using MCUBoot and the DFU library to perform a custom firmware update (which is working as expected).
I have a question about the "swap_type" value, which is printed when enabling the LOGS from MCUBoot.
After flashing my device (I am using a nRF54L15DK for my tests), MCUboot prints out:
I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3 I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3 I: Boot source: none I: Image index: 0, Swap type: none
In that case, I am booting from the "Primay image".
Is it normal, that "magic" is unset? Should it not be initialized when flashing the nRF54L15?
After performing the DFU and rebooting the device (using sys_reboot(SYS_REBOOT_WARM)), MCUboot prints out:
I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3 I: Secondary image: magic=good, swap_type=0x2, copy_done=0x3, image_ok=0x3 I: Boot source: none I: Image index: 0, Swap type: test I: Starting swap using move algorithm.
Magic flag for secondary image is now "good", swap_type=0x2 (BOOT_SWAP_TYPE_TEST) seems to be correct.
In my code, I confirm that the image is good by calling:
if (boot_is_img_confirmed() == false) {
printk("Image not confirmed, confirming now...\n");
boot_write_img_confirmed();
printk("Ok confirmed!\n");
} else {
printk("Image already confirmed.\n");
}
After reseting the board (Reset button), MCUboot prints out:
*** Booting MCUboot v2.3.0-dev-0d9411f5dda3 *** *** Using nRF Connect SDK v3.2.1-d8887f6f32df *** *** Using Zephyr OS v4.2.99-ec78104f1569 *** I: Starting bootloader I: Primary image: magic=good, swap_type=0x2, copy_done=0x1, image_ok=0x1 I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3 I: Boot source: none I: Image index: 0, Swap type: none
It correctly boots on primary image, but "swap_type" remains to the value 0x2.
Is that normal?
Best regards,
Jordan