mgmt: mcumgr: Use MCUboot bootutil file instead of outdated copy

Uses the MCUboot bootutil image.h file directly instead of an
outdated copy which resides in the zephyr tree.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
This commit is contained in:
Jamie McCrae 2023-07-24 08:41:59 +01:00 committed by Carles Cufí
commit 7ca7f5a39c
7 changed files with 8 additions and 80 deletions

View file

@ -1,71 +0,0 @@
/*
* Copyright (c) 2018-2021 mcumgr authors
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef H_IMAGE_
#define H_IMAGE_
#include <inttypes.h>
#ifdef __cplusplus
extern "C" {
#endif
#define IMAGE_MAGIC 0x96f3b83d
#define IMAGE_TLV_INFO_MAGIC 0x6907
#define IMAGE_TLV_PROT_INFO_MAGIC 0x6908
#define IMAGE_HEADER_SIZE 32
/** Image header flags. */
#define IMAGE_F_NON_BOOTABLE 0x00000010 /* Split image app. */
#define IMAGE_F_ROM_FIXED_ADDR 0x00000100
/** Image trailer TLV types. */
#define IMAGE_TLV_SHA256 0x10 /* SHA256 of image hdr and body */
/** Image TLV-specific definitions. */
#define IMAGE_HASH_LEN 32
struct image_version {
uint8_t iv_major;
uint8_t iv_minor;
uint16_t iv_revision;
uint32_t iv_build_num;
} __packed;
/** Image header. All fields are in little endian byte order. */
struct image_header {
uint32_t ih_magic;
uint32_t ih_load_addr;
uint16_t ih_hdr_size; /* Size of image header (bytes). */
uint16_t _pad2;
uint32_t ih_img_size; /* Does not include header. */
uint32_t ih_flags; /* IMAGE_F_[...]. */
struct image_version ih_ver;
uint32_t _pad3;
} __packed;
/** Image TLV header. All fields in little endian. */
struct image_tlv_info {
uint16_t it_magic;
uint16_t it_tlv_tot; /* size of TLV area (including tlv_info header) */
} __packed;
/** Image trailer TLV format. All fields in little endian. */
struct image_tlv {
uint8_t it_type; /* IMAGE_TLV_[...]. */
uint8_t _pad;
uint16_t it_len; /* Data length (not including TLV header). */
} __packed;
_Static_assert(sizeof(struct image_header) == IMAGE_HEADER_SIZE,
"struct image_header not required size");
#ifdef __cplusplus
}
#endif
#endif

View file

@ -11,7 +11,7 @@
#include <inttypes.h>
#include <zephyr/mgmt/mcumgr/mgmt/mgmt.h>
#include <zephyr/mgmt/mcumgr/smp/smp.h>
#include <zephyr/mgmt/mcumgr/grp/img_mgmt/image.h>
#include <bootutil/image.h>
#include <zcbor_common.h>
/**
@ -25,8 +25,6 @@
extern "C" {
#endif
#define IMG_MGMT_HASH_STR 48
#define IMG_MGMT_HASH_LEN 32
#define IMG_MGMT_DATA_SHA_LEN 32 /* SHA256 */
/**

View file

@ -8,12 +8,14 @@
#ifndef H_MCUMGR_IMG_MGMT_CALLBACKS_
#define H_MCUMGR_IMG_MGMT_CALLBACKS_
#include <zephyr/mgmt/mcumgr/grp/img_mgmt/img_mgmt.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Dummy definitions, include zephyr/mgmt/mcumgr/grp/img_mgmt/img_mgmt.h for actual definitions */
struct img_mgmt_upload_action;
struct img_mgmt_upload_req;
/**
* @brief MCUmgr img_mgmt callback API
* @defgroup mcumgr_callback_api_img_mgmt MCUmgr img_mgmt callback API

View file

@ -21,7 +21,6 @@
#include <zephyr/mgmt/mcumgr/smp/smp.h>
#include <zephyr/mgmt/mcumgr/mgmt/handlers.h>
#include <zephyr/mgmt/mcumgr/grp/img_mgmt/img_mgmt.h>
#include <zephyr/mgmt/mcumgr/grp/img_mgmt/image.h>
#include <mgmt/mcumgr/util/zcbor_bulk.h>
#include <mgmt/mcumgr/grp/img_mgmt/img_mgmt_priv.h>
@ -76,6 +75,9 @@
#error "Unsupported code parition is set as active application partition"
#endif
_Static_assert(sizeof(struct image_header) == IMAGE_HEADER_SIZE,
"struct image_header not required size");
LOG_MODULE_REGISTER(mcumgr_img_grp, CONFIG_MCUMGR_GRP_IMG_LOG_LEVEL);
struct img_mgmt_state g_img_mgmt_state;

View file

@ -19,7 +19,6 @@
#include <zephyr/mgmt/mcumgr/mgmt/mgmt.h>
#include <zephyr/mgmt/mcumgr/smp/smp.h>
#include <zephyr/mgmt/mcumgr/grp/img_mgmt/img_mgmt.h>
#include <zephyr/mgmt/mcumgr/grp/img_mgmt/image.h>
#include <mgmt/mcumgr/util/zcbor_bulk.h>
#include <mgmt/mcumgr/grp/img_mgmt/img_mgmt_priv.h>

View file

@ -8,7 +8,6 @@
#include <string.h>
#include <zephyr/mgmt/mcumgr/grp/img_mgmt/img_mgmt.h>
#include <zephyr/mgmt/mcumgr/grp/img_mgmt/image.h>
int
img_mgmt_ver_str(const struct image_version *ver, char *dst)

View file

@ -16,7 +16,6 @@
#include <zephyr/mgmt/mcumgr/mgmt/mgmt.h>
#include <zephyr/mgmt/mcumgr/grp/img_mgmt/img_mgmt.h>
#include <zephyr/mgmt/mcumgr/grp/img_mgmt/image.h>
#include <mgmt/mcumgr/grp/img_mgmt/img_mgmt_priv.h>