15#include <zcbor_common.h>
28#define IMG_MGMT_HASH_STR 48
29#define IMG_MGMT_HASH_LEN 32
30#define IMG_MGMT_DATA_SHA_LEN 32
35#define IMG_MGMT_STATE_F_PENDING 0x01
36#define IMG_MGMT_STATE_F_CONFIRMED 0x02
37#define IMG_MGMT_STATE_F_ACTIVE 0x04
38#define IMG_MGMT_STATE_F_PERMANENT 0x08
41#define IMG_MGMT_VER_MAX_STR_LEN (sizeof("255.255.65535.4294967295"))
46#define IMG_MGMT_SWAP_TYPE_NONE 0
47#define IMG_MGMT_SWAP_TYPE_TEST 1
48#define IMG_MGMT_SWAP_TYPE_PERM 2
49#define IMG_MGMT_SWAP_TYPE_REVERT 3
50#define IMG_MGMT_SWAP_TYPE_UNKNOWN 255
55#define IMG_MGMT_ID_STATE 0
56#define IMG_MGMT_ID_UPLOAD 1
57#define IMG_MGMT_ID_FILE 2
58#define IMG_MGMT_ID_CORELIST 3
59#define IMG_MGMT_ID_CORELOAD 4
60#define IMG_MGMT_ID_ERASE 5
204#ifdef CONFIG_MCUMGR_GRP_IMG_VERBOSE_ERR
335#ifdef CONFIG_MCUMGR_SMP_SUPPORT_ORIGINAL_PROTOCOL
346#ifdef CONFIG_MCUMGR_GRP_IMG_VERBOSE_ERR
347#define IMG_MGMT_UPLOAD_ACTION_SET_RC_RSN(action, rsn) ((action)->rc_rsn = (rsn))
348#define IMG_MGMT_UPLOAD_ACTION_RC_RSN(action) ((action)->rc_rsn)
349int img_mgmt_error_rsp(
struct smp_streamer *ctxt,
int rc,
const char *rsn);
350extern const char *img_mgmt_err_str_app_reject;
351extern const char *img_mgmt_err_str_hdr_malformed;
352extern const char *img_mgmt_err_str_magic_mismatch;
353extern const char *img_mgmt_err_str_no_slot;
354extern const char *img_mgmt_err_str_flash_open_failed;
355extern const char *img_mgmt_err_str_flash_erase_failed;
356extern const char *img_mgmt_err_str_flash_write_failed;
357extern const char *img_mgmt_err_str_downgrade;
358extern const char *img_mgmt_err_str_image_bad_flash_addr;
360#define IMG_MGMT_UPLOAD_ACTION_SET_RC_RSN(action, rsn)
361#define IMG_MGMT_UPLOAD_ACTION_RC_RSN(action) NULL
img_mgmt_id_upload_t
Definition: img_mgmt.h:160
img_mgmt_ret_code_t
Definition: img_mgmt.h:65
int img_mgmt_state_any_pending(void)
Check if any slot is in MCUboot pending state.
uint8_t img_mgmt_state_flags(int query_slot)
Returns state flags set to slot.
int img_mgmt_ver_str(const struct image_version *ver, char *dst)
Format version string from struct image_version.
int img_mgmt_read_info(int image_slot, struct image_version *ver, uint8_t *hash, uint32_t *flags)
int img_mgmt_vercmp(const struct image_version *a, const struct image_version *b)
#define IMG_MGMT_DATA_SHA_LEN
Definition: img_mgmt.h:30
int img_mgmt_state_set_pending(int slot, int permanent)
Sets the pending flag for the specified image slot.
int img_mgmt_slot_in_use(int slot)
Check if the image slot is in use.
int img_mgmt_active_slot(int image)
Get active, running application slot number for an image.
int img_mgmt_active_image(void)
Get active image number.
struct img_mgmt_state g_img_mgmt_state
int img_mgmt_my_version(struct image_version *ver)
Get the image version of the currently running application.
int img_mgmt_state_confirm(void)
Confirms the current image state.
@ IMG_MGMT_ID_UPLOAD_STATUS_ONGOING
Definition: img_mgmt.h:162
@ IMG_MGMT_ID_UPLOAD_STATUS_COMPLETE
Definition: img_mgmt.h:163
@ IMG_MGMT_ID_UPLOAD_STATUS_START
Definition: img_mgmt.h:161
@ IMG_MGMT_RET_RC_CURRENT_VERSION_IS_NEWER
Definition: img_mgmt.h:148
@ IMG_MGMT_RET_RC_FLASH_CONTEXT_NOT_SET
Definition: img_mgmt.h:118
@ IMG_MGMT_RET_RC_VERSION_GET_FAILED
Definition: img_mgmt.h:145
@ IMG_MGMT_RET_RC_TLV_INVALID_SIZE
Definition: img_mgmt.h:88
@ IMG_MGMT_RET_RC_FLASH_CONFIG_QUERY_FAIL
Definition: img_mgmt.h:73
@ IMG_MGMT_RET_RC_INVALID_IMAGE_HEADER_MAGIC
Definition: img_mgmt.h:136
@ IMG_MGMT_RET_RC_HASH_NOT_FOUND
Definition: img_mgmt.h:91
@ IMG_MGMT_RET_RC_NO_FREE_SLOT
Definition: img_mgmt.h:94
@ IMG_MGMT_RET_RC_UNKNOWN
Definition: img_mgmt.h:70
@ IMG_MGMT_RET_RC_INVALID_LENGTH
Definition: img_mgmt.h:130
@ IMG_MGMT_RET_RC_INVALID_SLOT
Definition: img_mgmt.h:109
@ IMG_MGMT_RET_RC_INVALID_FLASH_ADDRESS
Definition: img_mgmt.h:142
@ IMG_MGMT_RET_RC_NO_FREE_MEMORY
Definition: img_mgmt.h:112
@ IMG_MGMT_RET_RC_FLASH_READ_FAILED
Definition: img_mgmt.h:100
@ IMG_MGMT_RET_RC_FLASH_WRITE_FAILED
Definition: img_mgmt.h:103
@ IMG_MGMT_RET_RC_NO_TLVS
Definition: img_mgmt.h:79
@ IMG_MGMT_RET_RC_INVALID_HASH
Definition: img_mgmt.h:139
@ IMG_MGMT_RET_RC_INVALID_PAGE_OFFSET
Definition: img_mgmt.h:124
@ IMG_MGMT_RET_RC_INVALID_TLV
Definition: img_mgmt.h:82
@ IMG_MGMT_RET_RC_FLASH_CONTEXT_ALREADY_SET
Definition: img_mgmt.h:115
@ IMG_MGMT_RET_RC_TLV_MULTIPLE_HASHES_FOUND
Definition: img_mgmt.h:85
@ IMG_MGMT_RET_RC_INVALID_OFFSET
Definition: img_mgmt.h:127
@ IMG_MGMT_RET_RC_NO_IMAGE
Definition: img_mgmt.h:76
@ IMG_MGMT_RET_RC_INVALID_IMAGE_VECTOR_TABLE
Definition: img_mgmt.h:154
@ IMG_MGMT_RET_RC_FLASH_AREA_DEVICE_NULL
Definition: img_mgmt.h:121
@ IMG_MGMT_RET_RC_IMAGE_ALREADY_PENDING
Definition: img_mgmt.h:151
@ IMG_MGMT_RET_RC_INVALID_IMAGE_HEADER
Definition: img_mgmt.h:133
@ IMG_MGMT_RET_RC_FLASH_OPEN_FAILED
Definition: img_mgmt.h:97
@ IMG_MGMT_RET_RC_OK
Definition: img_mgmt.h:67
@ IMG_MGMT_RET_RC_FLASH_ERASE_FAILED
Definition: img_mgmt.h:106
static ZTEST_BMEM volatile int ret
Definition: k_float_disable.c:29
flags
Definition: parser.h:96
SMP - Simple Management Protocol.
__UINT32_TYPE__ uint32_t
Definition: stdint.h:90
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
__UINT16_TYPE__ uint16_t
Definition: stdint.h:89
Definition: img_mgmt.h:180
uint8_t data_sha[32]
Definition: img_mgmt.h:189
size_t size
Definition: img_mgmt.h:186
int area_id
Definition: img_mgmt.h:182
uint8_t data_sha_len
Definition: img_mgmt.h:188
size_t off
Definition: img_mgmt.h:184
Definition: img_mgmt.h:193
unsigned long long size
Definition: img_mgmt.h:195
int area_id
Definition: img_mgmt.h:199
bool proceed
Definition: img_mgmt.h:201
int write_bytes
Definition: img_mgmt.h:197
bool erase
Definition: img_mgmt.h:203
Definition: img_mgmt.h:170
size_t size
Definition: img_mgmt.h:173
bool upgrade
Definition: img_mgmt.h:176
uint32_t image
Definition: img_mgmt.h:171
struct zcbor_string img_data
Definition: img_mgmt.h:174
struct zcbor_string data_sha
Definition: img_mgmt.h:175
size_t off
Definition: img_mgmt.h:172
Decodes, encodes, and transmits SMP packets.
Definition: smp.h:82