dfu/boot: request upgrade & confirm for multimage

Add boot_write_confirm_multi() and boot_request_upgrade_multi() APIs so
that the user can set the image with given index as pending, confirmed.

This is needed for enabling the mcuboot multi-mage boot feature by
the zephyr.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
This commit is contained in:
Andrzej Puzdrowski 2021-06-04 13:36:43 +02:00 committed by Carles Cufí
commit ccddd74488
2 changed files with 53 additions and 0 deletions

View file

@ -167,6 +167,17 @@ int boot_request_upgrade(int permanent)
return 0;
}
int boot_request_upgrade_multi(int image_index, int permanent)
{
int rc;
rc = boot_set_pending_multi(image_index, permanent);
if (rc) {
return -EFAULT;
}
return 0;
}
bool boot_is_img_confirmed(void)
{
const struct flash_area *fa;
@ -198,6 +209,18 @@ int boot_write_img_confirmed(void)
return 0;
}
int boot_write_img_confirmed_multi(int image_index)
{
int rc;
rc = boot_set_confirmed_multi(image_index);
if (rc) {
return -EIO;
}
return 0;
}
int boot_erase_img_bank(uint8_t area_id)
{
const struct flash_area *fa;