MCCI Trusted Bootloader
Simple trusted bootloader and tools for small embedded systems
mcci_bootloader_types.h
Go to the documentation of this file.
1/* mcci_bootloader_types.h Mon Jun 29 2020 10:14:36 tmm */
2
3/*
4
5Module: mcci_bootloader_types.h
6
7Function:
8 Format of on-media data for the MCCI bootloader.
9
10Copyright notice:
11 This file copyright (C) 2020 by
12
13 MCCI Corporation
14 3520 Krums Corners Road
15 Ithaca, NY 14850
16
17 An unpublished work. All rights reserved.
18
19 This file is proprietary information, and may not be disclosed or
20 copied without the prior permission of MCCI Corporation.
21
22Author:
23 Terry Moore, MCCI Corporation June 2020
24
25Revision history:
26 0.1.0 Mon Jun 29 2020 10:14:36 tmm
27 Module created.
28
29*/
30
31#ifndef _MCCI_BOOTLOADER_TYPES_H_ /* prevent multiple includes */
32#define _MCCI_BOOTLOADER_TYPES_H_
33
34#include "mcciadk_env.h"
35
36#include <stdbool.h>
37#include <stddef.h>
38#include <stdint.h>
39#include <stdarg.h>
40
41/****************************************************************************\
42|
43| Environmental basics
44|
45\****************************************************************************/
46
47#ifdef __cplusplus
48# define MCCI_BOOTLOADER_BEGIN_DECLS extern "C" {
49# define MCCI_BOOTLOADER_END_DECLS }
50#else
51# define MCCI_BOOTLOADER_BEGIN_DECLS /* nothing */
52# define MCCI_BOOTLOADER_END_DECLS /* nothing */
53#endif
54
55#ifdef _MSC_VER
56# define MCCI_BOOTLOADER_NORETURN_PFX __declspec(noreturn)
57# define MCCI_BOOTLOADER_NORETURN_SFX /* nothing */
58#else
59# define MCCI_BOOTLOADER_NORETURN_PFX /* nothing */
60# define MCCI_BOOTLOADER_NORETURN_SFX __attribute__((__noreturn__))
61#endif
62
63#define MCCI_BOOTLOADER_NOT_REACHED() __builtin_unreachable()
64
65/****************************************************************************\
66|
67| Scalar types and type handles.
68|
69\****************************************************************************/
70
72
73///
74/// \brief error codes for the bootloader
75///
76/// \note enum types don't have predictable width. So we declare this as
77/// a `uint32_t`, and have a separate declaration for the enum.
78///
79/// \see McciBootloaderError_e
80///
81typedef uint32_t McciBootloaderError_t;
82
83///
84/// \brief Abstract type for storage byte addresses
85///
86/// The bootloader assumes that boot images are wholly contained in the
87/// first 4 GiB of the storage device.
88///
90
91///
92/// \brief Current boot system state
93///
94/// \note enum types don't have predictable width. So we declare this as
95/// a `uint32_t`, and have a separate declaration for the enum.
96///
97/// \see McciBootloaderState_e
98///
99typedef uint32_t McciBootloaderState_t;
100
101///
102/// \brief The (ostensibly) architecture-neutral application header
103///
104typedef struct McciBootloader_AppInfo_s McciBootloader_AppInfo_t;
105
106///
107/// \brief The (ostensibly) architecture-neutral application header
108///
109typedef struct McciBootloader_SignatureBlock_s McciBootloader_SignatureBlock_t;
110
111///
112/// \brief Time (in milliseconds)
113///
114/// \note An unsigned integral type that represents time since boot in
115/// milliseconds. It's unsigned because that maakes deadline handling
116/// easier to understand in the face of overflows. Time is used for
117/// timeouts for I/O drivers.
118///
120
122
123#endif /* _MCCI_BOOTLOADER_TYPES_H_ */
#define MCCI_BOOTLOADER_BEGIN_DECLS
#define MCCI_BOOTLOADER_END_DECLS
uint32_t McciBootloader_Milliseconds_t
Time (in milliseconds)
uint32_t McciBootloaderState_t
Current boot system state.
uint32_t McciBootloaderError_t
error codes for the bootloader
uint32_t McciBootloaderStorageAddress_t
Abstract type for storage byte addresses.
Application information block.