DFU: add module for interact with mcuboot

read, update status
trigger flashing
erase image bank
Module is intended to be use by a higher-level
image management protocol module.

Signed-off-by: Fabio Utzig <utzig@apache.org>
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
This commit is contained in:
Andrzej Puzdrowski 2017-07-04 11:54:11 +02:00 committed by Anas Nashif
commit 49fccdd2ea
8 changed files with 371 additions and 0 deletions

41
include/dfu/mcuboot.h Normal file
View file

@ -0,0 +1,41 @@
/*
* Copyright (c) 2017 Nordic Semiconductor ASA
* Copyright (c) 2016 Linaro Limited
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef __MCUBOOT_H__
#define __MCUBOOT_H__
/**
* @brief Marks the image in slot 0 as confirmed. The system will continue
* booting into the image in slot 0 until told to boot from a different slot.
*
* This call is expected to be used by the application running on trial.
*
* @return 0 on success, negative errno code on fail.
*/
int boot_write_img_confirmed(void);
/**
* @brief Marks the image in slot 1 as pending. On the next reboot, the system
* will perform a boot of the slot 1 image.
*
* @param permanent Whether the image should be used permanently or
* only tested once:
* 0=run image once, then confirm or revert.
* 1=run image forever.
* @return 0 on success, negative errno code on fail.
*/
int boot_request_upgrade(int permanent);
/**
* @brief Erase the image Bank.
*
* @param bank_offset address of the image bank
* @return 0 on success, negative errno code on fail.
*/
int boot_erase_img_bank(u32_t bank_offset);
#endif /* __MCUBOOT_H__ */