Zephyr API Documentation 4.0.0-rc2
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
mcuboot.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2017 Nordic Semiconductor ASA
3 * Copyright (c) 2016 Linaro Limited
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
16#ifndef ZEPHYR_INCLUDE_DFU_MCUBOOT_H_
17#define ZEPHYR_INCLUDE_DFU_MCUBOOT_H_
18
19#include <stdbool.h>
20#include <stddef.h>
21#include <sys/types.h>
22
23#include <zephyr/types.h>
24
33#ifdef __cplusplus
34extern "C" {
35#endif
36
37#ifdef BOOT_SWAP_TYPE_NONE
38#if BOOT_SWAP_TYPE_NONE != 1 /*ensure the same definition in MCUboot */
39#error "definition incompatible"
40#endif
41#else
43#define BOOT_SWAP_TYPE_NONE 1
44#endif
45
46#ifdef BOOT_SWAP_TYPE_TEST
47#if BOOT_SWAP_TYPE_TEST != 2 /*ensure the same definition in MCUboot */
48#error "definition incompatible"
49#endif
50#else
52#define BOOT_SWAP_TYPE_TEST 2
53#endif
54
55#ifdef BOOT_SWAP_TYPE_PERM
56#if BOOT_SWAP_TYPE_PERM != 3 /*ensure the same definition in MCUboot */
57#error "definition incompatible"
58#endif
59#else
61#define BOOT_SWAP_TYPE_PERM 3
62#endif
63
64#ifdef BOOT_SWAP_TYPE_REVERT
65#if BOOT_SWAP_TYPE_REVERT != 4 /*ensure the same definition in MCUboot */
66#error "definition incompatible"
67#endif
68#else
70#define BOOT_SWAP_TYPE_REVERT 4
71#endif
72
73#ifdef BOOT_SWAP_TYPE_FAIL
74#if BOOT_SWAP_TYPE_FAIL != 5 /*ensure the same definition in MCUboot */
75#error "definition incompatible"
76#endif
77#else
79#define BOOT_SWAP_TYPE_FAIL 5
80#endif
81
82#define BOOT_IMG_VER_STRLEN_MAX 25 /* 255.255.65535.4294967295\0 */
83
84
98
114
143
159 struct mcuboot_img_header *header,
160 size_t header_size);
161
177
191
207
215
225int mcuboot_swap_type_multi(int image_index);
226
227
229#define BOOT_UPGRADE_TEST 0
230#define BOOT_UPGRADE_PERMANENT 1
231
242int boot_request_upgrade(int permanent);
243
256int boot_request_upgrade_multi(int image_index, int permanent);
257
265
273
282
283#ifdef __cplusplus
284}
285#endif
286
291#endif /* ZEPHYR_INCLUDE_DFU_MCUBOOT_H_ */
int boot_erase_img_bank(uint8_t area_id)
Erase the image Bank.
int mcuboot_swap_type_multi(int image_index)
Determines the action, if any, that mcuboot will take on the next reboot.
bool boot_is_img_confirmed(void)
Check if the currently running image is confirmed as OK.
int boot_read_bank_header(uint8_t area_id, struct mcuboot_img_header *header, size_t header_size)
Read the MCUboot image header information from an image bank.
ssize_t boot_get_area_trailer_status_offset(uint8_t area_id)
Get the offset of the status in the image bank.
ssize_t boot_get_trailer_status_offset(size_t area_size)
Get the offset of the status from an image bank size.
int boot_write_img_confirmed(void)
Marks the currently running image as confirmed.
int mcuboot_swap_type(void)
Determines the action, if any, that mcuboot will take on the next reboot.
int boot_write_img_confirmed_multi(int image_index)
Marks the image with the given index in the primary slot as confirmed.
int boot_request_upgrade(int permanent)
Marks the image in slot 1 as pending.
int boot_request_upgrade_multi(int image_index, int permanent)
Marks the image with the given index in the secondary slot as pending.
__SIZE_TYPE__ ssize_t
Definition types.h:28
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Model for the MCUboot image header as of version 1.
Definition mcuboot.h:108
struct mcuboot_img_sem_ver sem_ver
The image version.
Definition mcuboot.h:112
uint32_t image_size
The size of the image, in bytes.
Definition mcuboot.h:110
Model for the MCUBoot image header.
Definition mcuboot.h:126
uint32_t mcuboot_version
The version of MCUboot the header is built for.
Definition mcuboot.h:132
union mcuboot_img_header::@182 h
The header information.
struct mcuboot_img_header_v1 v1
Header information for MCUboot version 1.
Definition mcuboot.h:140
MCUboot image header representation for image version.
Definition mcuboot.h:92
uint8_t minor
Definition mcuboot.h:94
uint16_t revision
Definition mcuboot.h:95
uint32_t build_num
Definition mcuboot.h:96
uint8_t major
Definition mcuboot.h:93