Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: mcuboot: add boot_request_upgrade() return value check #72883

Merged

Conversation

butok
Copy link
Contributor

@butok butok commented May 16, 2024

  • Adds boot_request_upgrade() return value check.
  • Avoid repeating resets if the upgrade request fails.

- Adds boot_request_upgrade() return value check.
- Avoid repeating resets if the upgrade request fails.

Signed-off-by: Andrej Butok <andrey.butok@nxp.com>
@butok butok force-pushed the check_return_request_upgrade branch from 2f9710d to 5b04c66 Compare May 16, 2024 14:15
@dleach02 dleach02 added the Trivial Changes that can be reviewed by anyone, i.e. doc changes, minor build system tweaks, etc. label May 17, 2024
@hakehuang
Copy link
Collaborator

@butok I meet failure on

lpcexpresso55s36

*** Booting MCUboot v2.1.0-rc1-1-gd4394c2f9b76 ***
*** Using Zephyr OS build v3.6.0-4091-g5b04c6606fde ***
I: Starting bootloader
*** Booting MCUboot v2.1.0-rc1-1-gd4394c2f9b76 ***
*** Using Zephyr OS build v3.6.0-4091-g5b04c6606fde ***
I: Starting bootloader
*** Booting MCUboot v2.1.0-rc1-1-gd4394c2f9b76 ***
*** Using Zephyr OS build v3.6.0-4091-g5b04c6606fde ***
I: Starting bootloader
*** Booting MCUboot v2.1.0-rc1-1-gd4394c2f9b76 ***
*** Using Zephyr OS build v3.6.0-4091-g5b04c6606fde ***
I: Starting bootloader
*** Booting MCUboot v2.1.0-rc1-1-gd4394c2f9b76 ***
*** Using Zephyr OS build v3.6.0-4091-g5b04c6606fde ***
I: Starting bootloader

printk("Failed to request upgrade: %d", err);
} else {
printk("Secondary application ready for swap, rebooting\n");
sys_reboot(SYS_REBOOT_COLD);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth adding a k_sleep() here for 200ms or so to ensure message is printed (optional)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth adding a k_sleep() here for 200ms or so to ensure message is printed (optional)

It 's not needed. It is printed on all tested platforms.

@butok
Copy link
Contributor Author

butok commented May 17, 2024

@butok I meet failure on

lpcexpresso55s36

*** Booting MCUboot v2.1.0-rc1-1-gd4394c2f9b76 ***
*** Using Zephyr OS build v3.6.0-4091-g5b04c6606fde ***
I: Starting bootloader
*** Booting MCUboot v2.1.0-rc1-1-gd4394c2f9b76 ***
*** Using Zephyr OS build v3.6.0-4091-g5b04c6606fde ***
I: Starting bootloader
*** Booting MCUboot v2.1.0-rc1-1-gd4394c2f9b76 ***
*** Using Zephyr OS build v3.6.0-4091-g5b04c6606fde ***
I: Starting bootloader
*** Booting MCUboot v2.1.0-rc1-1-gd4394c2f9b76 ***
*** Using Zephyr OS build v3.6.0-4091-g5b04c6606fde ***
I: Starting bootloader
*** Booting MCUboot v2.1.0-rc1-1-gd4394c2f9b76 ***
*** Using Zephyr OS build v3.6.0-4091-g5b04c6606fde ***
I: Starting bootloader

Tested on other LPC55S69, and it is fine.

After mass erase (Jlink), LPC55S36 also passed (Debug messages are enabled):

*** Booting MCUboot v2.1.0-rc1-1-gd4394c2f9b76 ***
*** Using Zephyr OS build v3.6.0-3696-ga495fd9475e3 ***
I: Starting bootloader
I: Image index: 0, Swap type: none
E: Unable to find bootable image
*** Booting MCUboot v2.1.0-rc1-1-gd4394c2f9b76 ***
*** Using Zephyr OS build v3.6.0-3696-ga495fd9475e3 ***
I: Starting bootloader
I: Image index: 0, Swap type: none
E: Unable to find bootable image
*** Booting MCUboot v2.1.0-rc1-1-gd4394c2f9b76 ***
*** Using Zephyr OS build v3.6.0-3696-ga495fd9475e3 ***
I: Starting bootloader
I: Image index: 0, Swap type: none
I: Bootloader chainload address offset: 0x8000
I: Jumping to the first image slot
*** Booting Zephyr OS build v3.6.0-3696-ga495fd9475e3 ***
Launching primary slot application on lpcxpresso55s36
Secondary application ready for swap, rebootingÿ*** Booting MCUboot v2.1.0-rc1-1-gd4394c2f9b76 ***
*** Using Zephyr OS build v3.6.0-3696-ga495fd9475e3 ***
I: Starting bootloader
I: Image index: 0, Swap type: perm
I: Image 0 upgrade secondary slot -> primary slot
I: Erasing the primary slot
I: Image 0 copying the secondary slot to the primary slot: 0x4600 bytes
D: writing magic; fa_id=1 off=0x17ff0 (0x1fff0)
D: erasing secondary header
D: erasing secondary trailer
I: Bootloader chainload address offset: 0x8000
I: Jumping to the first image slot
*** Booting Zephyr OS build v3.6.0-3696-ga495fd9475e3 ***
Swapped application booted on lpcxpresso55s36

@hakehuang
Copy link
Collaborator

ok, maybe my board issue atagin.

@butok
Copy link
Contributor Author

butok commented May 21, 2024

Hi @d3zd3z , PR is waiting for you.

@carlescufi carlescufi merged commit 62fa3f7 into zephyrproject-rtos:main May 29, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Bootloader area: MCUBoot Trivial Changes that can be reviewed by anyone, i.e. doc changes, minor build system tweaks, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants