Skip to content

Mcuboot swap type is test when update fails #1592

@ghost

Description

Dublication from zephyrproject-rtos/zephyr#54373

Describe the bug
When installing an image with mcuboot swap using move, the installation can fail if the image is too big.
In that case the old image is loaded again.
If we ask the image for its swap type using the mcuboot_swap_type-function we expect it to say none, but we get test instead.

#include <stdbool.h>
#include <dfu/dfu_target.h>
#include <dfu/dfu_target_mcuboot.h>
#include <dfu/mcuboot.h>

void main(void)
{
    mcuboot_swap_type();
}

To Reproduce
Steps to reproduce the behavior:

  1. Make mcuboot update swap using move fail by providing an image that is too big
  2. use the mcuboot_swap_type(); function somewhere in the firmware.

Expected behavior
After the upgrade failed, mcuboot reverts to the previous image. It is expected to be of swap type none but instead it is of type test

Impact
If someone is using the flag to check for a "healthy" boot, they get unexpected behavior. Reset cycles for example.

Logs and console output

*** Booting Zephyr OS build v3.1.99-ncs1-12-gaa84ba70d601  ***
<inf> mcuboot_util: Swap type: none

Let me know if additional context is needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions