blob: 14ad21873dd461b40e5648170056961251ab2254 [file] [log] [blame]
Marti Bolivarf91bca52018-04-12 12:40:46 -04001/*
2 * Copyright (c) 2018 Open Source Foundries Limited
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef __MCUBOOT_CONFIG_H__
8#define __MCUBOOT_CONFIG_H__
9
10/*
11 * Template configuration file for MCUboot.
12 *
13 * When porting MCUboot to a new target, copy it somewhere that your
14 * include path can find it as mcuboot_config/mcuboot_config.h, and
15 * make adjustments to suit your platform.
16 *
17 * For examples, see:
18 *
19 * boot/zephyr/include/mcuboot_config/mcuboot_config.h
20 * boot/mynewt/mcuboot_config/include/mcuboot_config/mcuboot_config.h
21 */
22
23/*
24 * Signature types
25 *
26 * You must choose exactly one signature type.
27 */
28
29/* Uncomment for RSA signature support */
30/* #define MCUBOOT_SIGN_RSA */
31
32/* Uncomment for ECDSA signatures using curve P-256. */
33/* #define MCUBOOT_SIGN_EC256 */
34
35
36/*
37 * Upgrade mode
38 *
39 * The default is to support A/B image swapping with rollback. A
40 * simpler code path, which only supports overwriting the
41 * existing image with the update image, is also available.
42 */
43
44/* Uncomment to enable the overwrite-only code path. */
45/* #define MCUBOOT_OVERWRITE_ONLY */
46
47#ifdef MCUBOOT_OVERWRITE_ONLY
David Vincze2d736ad2019-02-18 11:50:22 +010048/* Uncomment to only erase and overwrite those primary slot sectors needed
Marti Bolivarf91bca52018-04-12 12:40:46 -040049 * to install the new image, rather than the entire image slot. */
50/* #define MCUBOOT_OVERWRITE_ONLY_FAST */
51#endif
52
53/*
54 * Cryptographic settings
55 *
56 * You must choose between mbedTLS and Tinycrypt as source of
57 * cryptographic primitives. Other cryptographic settings are also
58 * available.
59 */
60
61/* Uncomment to use ARM's mbedTLS cryptographic primitives */
62/* #define MCUBOOT_USE_MBED_TLS */
63/* Uncomment to use Tinycrypt's. */
64/* #define MCUBOOT_USE_TINYCRYPT */
65
66/*
David Vincze2d736ad2019-02-18 11:50:22 +010067 * Always check the signature of the image in the primary slot before booting,
Marti Bolivarf91bca52018-04-12 12:40:46 -040068 * even if no upgrade was performed. This is recommended if the boot
69 * time penalty is acceptable.
70 */
David Vincze2d736ad2019-02-18 11:50:22 +010071#define MCUBOOT_VALIDATE_PRIMARY_SLOT
Marti Bolivarf91bca52018-04-12 12:40:46 -040072
73/*
74 * Flash abstraction
75 */
76
77/* Uncomment if your flash map API supports flash_area_get_sectors().
78 * See the flash APIs for more details. */
79/* #define MCUBOOT_USE_FLASH_AREA_GET_SECTORS */
80
Marti Bolivarf9bfddd2018-04-24 14:28:33 -040081/* Default maximum number of flash sectors per image slot; change
82 * as desirable. */
83#define MCUBOOT_MAX_IMG_SECTORS 128
84
Marti Bolivar248da082018-04-24 15:11:39 -040085/*
Fabio Utzig7d817862018-05-07 08:09:01 -030086 * Logging
87 */
88
89/*
90 * If logging is enabled the following functions must be defined by the
91 * platform:
92 *
Emanuele Di Santo20ba65e2019-01-10 13:38:16 +010093 * MCUBOOT_LOG_MODULE_REGISTER(domain)
94 * Register a new log module and add the current C file to it.
95 *
96 * MCUBOOT_LOG_MODULE_DECLARE(domain)
97 * Add the current C file to an existing log module.
98 *
Fabio Utzig7d817862018-05-07 08:09:01 -030099 * MCUBOOT_LOG_ERR(...)
100 * MCUBOOT_LOG_WRN(...)
101 * MCUBOOT_LOG_INF(...)
102 * MCUBOOT_LOG_DBG(...)
103 *
Emanuele Di Santoccc98aa2019-01-09 14:17:54 +0100104 * The function priority is:
Fabio Utzig7d817862018-05-07 08:09:01 -0300105 *
106 * MCUBOOT_LOG_ERR > MCUBOOT_LOG_WRN > MCUBOOT_LOG_INF > MCUBOOT_LOG_DBG
Fabio Utzig7d817862018-05-07 08:09:01 -0300107 */
108#define MCUBOOT_HAVE_LOGGING 1
109
110/*
Marti Bolivar248da082018-04-24 15:11:39 -0400111 * Assertions
112 */
113
114/* Uncomment if your platform has its own mcuboot_config/mcuboot_assert.h.
115 * If so, it must provide an ASSERT macro for use by bootutil. Otherwise,
116 * "assert" is used. */
117/* #define MCUBOOT_HAVE_ASSERT_H */
118
Fabio Utzig853657c2019-05-07 08:06:07 -0300119/*
120 * Watchdog feeding
121 */
122
123/* This macro might be implemented if the OS / HW watchdog is enabled while
124 * doing a swap upgrade and the time it takes for a swapping is long enough
125 * to cause an unwanted reset. If implementing this, the OS main.c must also
126 * enable the watchdog (if required)!
127 *
128 * #define MCUBOOT_WATCHDOG_FEED()
129 * do { do watchdog feeding here! } while (0)
130 */
131
Marti Bolivarf91bca52018-04-12 12:40:46 -0400132#endif /* __MCUBOOT_CONFIG_H__ */