Commit 75e9a59d authored by Fabio Utzig's avatar Fabio Utzig Committed by Fabio Utzig
Browse files

Remove boot_swap_type usage in the bootloader

`boot_swap_type_multi` should be used instead. The `BOOT_CURR_IMG` macro
already returns the correct value in single image mode.

For compatibility with external tools like mcumgr, `boot_swap_type`
remains available and always returns the swap type of image 0.

Signed-off-by: default avatarFabio Utzig <utzig@apache.org>
parent 233af7d7
Loading
Loading
Loading
Loading
+4 −1
Changes for boot/bootutil/src/bootutil_misc.c: 4 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -580,13 +580,16 @@ boot_swap_type_multi(int image_index)
    return BOOT_SWAP_TYPE_NONE;
}

/*
 * This function is not used by the bootloader itself, but its required API
 * by external tooling like mcumgr.
 */
int
boot_swap_type(void)
{
    return boot_swap_type_multi(0);
}


/**
 * Marks the image in the secondary slot as pending.  On the next reboot,
 * the system will perform a one-time boot of the the secondary slot image.
+0 −4
Changes for boot/bootutil/src/loader.c: 0 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -949,11 +949,7 @@ boot_validated_swap_type(struct boot_loader_state *state,
{
    int swap_type;

#if (BOOT_IMAGE_NUMBER == 1)
    swap_type = boot_swap_type();
#else
    swap_type = boot_swap_type_multi(BOOT_CURR_IMG(state));
#endif
    switch (swap_type) {
    case BOOT_SWAP_TYPE_TEST:
    case BOOT_SWAP_TYPE_PERM: