Hello, I am testing the secondary bootloader MCUBoot on the LPC55S69. For that, I followed the documentation MCUOTASBLSFWUG.
In order to update the main application (SFW) I am using the "Local FOTA" with an SD-Card.
The update works well. I can generate a new image, sign it with imgtool.py and put it in the SD Card. The SFW detects the SD Card and puts the new program in the secondary slot. At the next reboot, the SBL swap primary and secondary slots and boot on the primary slot.
In order to test the rollback mechanism, I modified some bytes of the new signed image and put the corrupted image in the SD Card. The SFW puts the new program in the secondary slot, and at the next reboot, the SBL swaps the two slots. As the binary is corrupted, SBL doesn't boot it. However, the SBL doesn't rollback to use the correct image of the secondary slot. So, the board doesn't boot anymore.
Does anyone know why? All help is welcome. Thank you.
My setup is the following:
Config of SBL and MCUBoot:
Config of SFW:
Here are the logs of the update:
Bootloader Version 1.1.0
Primary image: magic=good, swap_type=0x2, copy_done=0x3, image_ok=0x1
Secondary image: magic=bad, swap_type=0x0, copy_done=0x2, image_ok=0x2
Boot source: primary slot
writing copy_done; fa_id=1 off=0xlx (0xlx)
Bootloader chainload address offset: 0x20000
Reset_Handler address offset: 0x20400
Jumping to the image
hello sfw.
Current image verison: 1.3.0
SD Card updating task enable.
Hello world1.
Hello world2.
Please insert a sd card into board.
Update done, the last update type: SD Card
Write OK flag: off = 0x4fe00
Hello world1.
Hello world2.
Card inserted.
Hello world1.
Hello world2.
reading...
new img verison: 1.4.0
updating...
finished
write update type = 0x1
write magic number offset = 0x7fe00
Please remove the SD Card!
sys rst...
Hello world1.
Hello world2.
hello sbl.
Bootloader Version 1.1.0
Primary image: magic=good, swap_type=0x2, copy_done=0x3, image_ok=0x1
Secondary image: magic=good, swap_type=0x1, copy_done=0x3, image_ok=0x3
Boot source: none
Swap type: test
erasing trailer; fa_id=1
initializing status; fa_id=1
writing swap_info; fa_id=1 off=0xlx (0xlx), swap_type=0x2ffd8 image_num=0x4ffd8
writing swap_size; fa_id=1 off=0xlx (0xlx)
writing magic; fa_id=1 off=0xlx (0xlx)
erasing trailer; fa_id=2
writing copy_done; fa_id=1 off=0xlx (0xlx)
Signature verification failed, Image in the primary slot is not valid!
hello sbl.
Bootloader Version 1.1.0
Primary image: magic=good, swap_type=0x2, copy_done=0x1, image_ok=0x2
Secondary image: magic=bad, swap_type=0x0, copy_done=0x2, image_ok=0x2
Boot source: none
Swap type: none
Signature verification failed, Image in the primary slot is not valid!
Hello @Kentinos
How about refer to "U-Disk and SD Card Update in SFW"
https://www.nxp.com.cn/docs/en/application-note/AN13499.pdf
BR
Alice
Yes my problem is with SD Card OTA mode with SFW