blob: 24e65f1977f84af9be8356024ecf45f8dd6edc0a [file] [log] [blame]
Marti Bolivarf91bca52018-04-12 12:40:46 -04001/*
2 * Copyright (c) 2018 Open Source Foundries Limited
David Vinczee3697842024-04-03 10:24:26 +02003 * Copyright (c) 2019-2024 Arm Limited
Marti Bolivarf91bca52018-04-12 12:40:46 -04004 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
8#ifndef __MCUBOOT_CONFIG_H__
9#define __MCUBOOT_CONFIG_H__
10
11/*
12 * Template configuration file for MCUboot.
13 *
14 * When porting MCUboot to a new target, copy it somewhere that your
15 * include path can find it as mcuboot_config/mcuboot_config.h, and
16 * make adjustments to suit your platform.
17 *
18 * For examples, see:
19 *
20 * boot/zephyr/include/mcuboot_config/mcuboot_config.h
21 * boot/mynewt/mcuboot_config/include/mcuboot_config/mcuboot_config.h
22 */
23
24/*
25 * Signature types
26 *
27 * You must choose exactly one signature type.
28 */
29
30/* Uncomment for RSA signature support */
31/* #define MCUBOOT_SIGN_RSA */
32
33/* Uncomment for ECDSA signatures using curve P-256. */
34/* #define MCUBOOT_SIGN_EC256 */
35
David Vinczee3697842024-04-03 10:24:26 +020036/*
37 * Public key handling
38 *
39 * Choose one or none from the different public key handling options.
40 */
41
42/* Uncomment to use key hash(es) instead of incorporating
43 * the public key into the code. */
44/* #define MCUBOOT_HW_KEY */
45/* Uncomment to use builtin key(s) instead of incorporating
46 * the public key into the code. */
47/* #define MCUBOOT_BUILTIN_KEY */
Marti Bolivarf91bca52018-04-12 12:40:46 -040048
49/*
50 * Upgrade mode
51 *
David Vinczee574f2d2020-07-10 11:42:03 +020052 * The default is to support A/B image swapping with rollback. Other modes
53 * with simpler code path, which only supports overwriting the existing image
54 * with the update image or running the newest image directly from its flash
55 * partition, are also available.
56 *
57 * You can enable only one mode at a time from the list below to override
58 * the default upgrade mode.
Marti Bolivarf91bca52018-04-12 12:40:46 -040059 */
60
61/* Uncomment to enable the overwrite-only code path. */
62/* #define MCUBOOT_OVERWRITE_ONLY */
63
64#ifdef MCUBOOT_OVERWRITE_ONLY
David Vincze2d736ad2019-02-18 11:50:22 +010065/* Uncomment to only erase and overwrite those primary slot sectors needed
Marti Bolivarf91bca52018-04-12 12:40:46 -040066 * to install the new image, rather than the entire image slot. */
67/* #define MCUBOOT_OVERWRITE_ONLY_FAST */
68#endif
69
David Vinczee574f2d2020-07-10 11:42:03 +020070/* Uncomment to enable the direct-xip code path. */
71/* #define MCUBOOT_DIRECT_XIP */
David Vincze505fba22020-10-22 13:53:29 +020072/* Uncomment to enable the revert mechanism in direct-xip mode. */
73/* #define MCUBOOT_DIRECT_XIP_REVERT */
David Vinczee574f2d2020-07-10 11:42:03 +020074
Tamas Banfe031092020-09-10 17:32:39 +020075/* Uncomment to enable the ram-load code path. */
76/* #define MCUBOOT_RAM_LOAD */
77
Marti Bolivarf91bca52018-04-12 12:40:46 -040078/*
79 * Cryptographic settings
80 *
81 * You must choose between mbedTLS and Tinycrypt as source of
82 * cryptographic primitives. Other cryptographic settings are also
83 * available.
84 */
85
86/* Uncomment to use ARM's mbedTLS cryptographic primitives */
87/* #define MCUBOOT_USE_MBED_TLS */
88/* Uncomment to use Tinycrypt's. */
89/* #define MCUBOOT_USE_TINYCRYPT */
90
91/*
David Vincze2d736ad2019-02-18 11:50:22 +010092 * Always check the signature of the image in the primary slot before booting,
Marti Bolivarf91bca52018-04-12 12:40:46 -040093 * even if no upgrade was performed. This is recommended if the boot
94 * time penalty is acceptable.
95 */
David Vincze2d736ad2019-02-18 11:50:22 +010096#define MCUBOOT_VALIDATE_PRIMARY_SLOT
Marti Bolivarf91bca52018-04-12 12:40:46 -040097
98/*
99 * Flash abstraction
100 */
101
102/* Uncomment if your flash map API supports flash_area_get_sectors().
103 * See the flash APIs for more details. */
104/* #define MCUBOOT_USE_FLASH_AREA_GET_SECTORS */
105
Marti Bolivarf9bfddd2018-04-24 14:28:33 -0400106/* Default maximum number of flash sectors per image slot; change
107 * as desirable. */
108#define MCUBOOT_MAX_IMG_SECTORS 128
109
David Vinczeb75c12a2019-03-22 14:58:33 +0100110/* Default number of separately updateable images; change in case of
111 * multiple images. */
112#define MCUBOOT_IMAGE_NUMBER 1
113
Marti Bolivar248da082018-04-24 15:11:39 -0400114/*
Fabio Utzig7d817862018-05-07 08:09:01 -0300115 * Logging
116 */
117
118/*
119 * If logging is enabled the following functions must be defined by the
120 * platform:
121 *
Emanuele Di Santo20ba65e2019-01-10 13:38:16 +0100122 * MCUBOOT_LOG_MODULE_REGISTER(domain)
123 * Register a new log module and add the current C file to it.
124 *
125 * MCUBOOT_LOG_MODULE_DECLARE(domain)
126 * Add the current C file to an existing log module.
127 *
Fabio Utzig7d817862018-05-07 08:09:01 -0300128 * MCUBOOT_LOG_ERR(...)
129 * MCUBOOT_LOG_WRN(...)
130 * MCUBOOT_LOG_INF(...)
131 * MCUBOOT_LOG_DBG(...)
132 *
Emanuele Di Santoccc98aa2019-01-09 14:17:54 +0100133 * The function priority is:
Fabio Utzig7d817862018-05-07 08:09:01 -0300134 *
135 * MCUBOOT_LOG_ERR > MCUBOOT_LOG_WRN > MCUBOOT_LOG_INF > MCUBOOT_LOG_DBG
Fabio Utzig7d817862018-05-07 08:09:01 -0300136 */
137#define MCUBOOT_HAVE_LOGGING 1
138
139/*
Marti Bolivar248da082018-04-24 15:11:39 -0400140 * Assertions
141 */
142
143/* Uncomment if your platform has its own mcuboot_config/mcuboot_assert.h.
144 * If so, it must provide an ASSERT macro for use by bootutil. Otherwise,
145 * "assert" is used. */
146/* #define MCUBOOT_HAVE_ASSERT_H */
147
Fabio Utzig853657c2019-05-07 08:06:07 -0300148/*
149 * Watchdog feeding
150 */
151
152/* This macro might be implemented if the OS / HW watchdog is enabled while
153 * doing a swap upgrade and the time it takes for a swapping is long enough
154 * to cause an unwanted reset. If implementing this, the OS main.c must also
155 * enable the watchdog (if required)!
156 *
157 * #define MCUBOOT_WATCHDOG_FEED()
158 * do { do watchdog feeding here! } while (0)
159 */
160
Andrzej Puzdrowski142b3392021-06-11 12:26:42 +0200161/* If a OS ports support single thread mode or is bare-metal then:
162 * This macro implements call that switches CPU to an idle state, from which
163 * the CPU may be woken up by, for example, UART transmission event.
David Vinczee3697842024-04-03 10:24:26 +0200164 *
Andrzej Puzdrowski142b3392021-06-11 12:26:42 +0200165 * Otherwise this macro should be no-op.
166 */
167#define MCUBOOT_CPU_IDLE() \
168 do { \
169 } while (0)
170
Marti Bolivarf91bca52018-04-12 12:40:46 -0400171#endif /* __MCUBOOT_CONFIG_H__ */