Zephyr Project API  3.3.0
A Scalable Open Source RTOS
image.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018-2021 mcumgr authors
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef H_IMAGE_
8#define H_IMAGE_
9
10#include <inttypes.h>
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16#define IMAGE_MAGIC 0x96f3b83d
17#define IMAGE_TLV_INFO_MAGIC 0x6907
18#define IMAGE_TLV_PROT_INFO_MAGIC 0x6908
19
20#define IMAGE_HEADER_SIZE 32
21
23#define IMAGE_F_NON_BOOTABLE 0x00000010 /* Split image app. */
24#define IMAGE_F_ROM_FIXED_ADDR 0x00000100
25
27#define IMAGE_TLV_SHA256 0x10 /* SHA256 of image hdr and body */
28
30#define IMAGE_HASH_LEN 32
31
37} __packed;
38
43 uint16_t ih_hdr_size; /* Size of image header (bytes). */
44 uint16_t _pad2;
45 uint32_t ih_img_size; /* Does not include header. */
46 uint32_t ih_flags; /* IMAGE_F_[...]. */
48 uint32_t _pad3;
49} __packed;
50
54 uint16_t it_tlv_tot; /* size of TLV area (including tlv_info header) */
55} __packed;
56
58struct image_tlv {
59 uint8_t it_type; /* IMAGE_TLV_[...]. */
60 uint8_t _pad;
61 uint16_t it_len; /* Data length (not including TLV header). */
62} __packed;
63
64_Static_assert(sizeof(struct image_header) == IMAGE_HEADER_SIZE,
65 "struct image_header not required size");
66
67#ifdef __cplusplus
68}
69#endif
70
71#endif
#define IMAGE_HEADER_SIZE
Definition: image.h:20
__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: image.h:40
uint32_t ih_flags
Definition: image.h:46
uint32_t ih_load_addr
Definition: image.h:42
uint16_t ih_hdr_size
Definition: image.h:43
uint32_t ih_magic
Definition: image.h:41
struct image_version ih_ver
Definition: image.h:47
uint32_t ih_img_size
Definition: image.h:45
Definition: image.h:52
uint16_t it_magic
Definition: image.h:53
uint16_t it_tlv_tot
Definition: image.h:54
Definition: image.h:58
uint8_t it_type
Definition: image.h:59
uint16_t it_len
Definition: image.h:61
Definition: image.h:32
uint8_t iv_major
Definition: image.h:33
uint16_t iv_revision
Definition: image.h:35
uint8_t iv_minor
Definition: image.h:34
uint32_t iv_build_num
Definition: image.h:36