blob: 72e33eb132e95a0aab05cc5f39c73705d6033439 [file] [log] [blame]
Marti Bolivarf91bca52018-04-12 12:40:46 -04001/*
2 * Copyright (c) 2018 Open Source Foundries Limited
David Vinczeb75c12a2019-03-22 14:58:33 +01003 * Copyright (c) 2019 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
36
37/*
38 * Upgrade mode
39 *
David Vinczee574f2d2020-07-10 11:42:03 +020040 * The default is to support A/B image swapping with rollback. Other modes
41 * with simpler code path, which only supports overwriting the existing image
42 * with the update image or running the newest image directly from its flash
43 * partition, are also available.
44 *
45 * You can enable only one mode at a time from the list below to override
46 * the default upgrade mode.
Marti Bolivarf91bca52018-04-12 12:40:46 -040047 */
48
49/* Uncomment to enable the overwrite-only code path. */
50/* #define MCUBOOT_OVERWRITE_ONLY */
51
52#ifdef MCUBOOT_OVERWRITE_ONLY
David Vincze2d736ad2019-02-18 11:50:22 +010053/* Uncomment to only erase and overwrite those primary slot sectors needed
Marti Bolivarf91bca52018-04-12 12:40:46 -040054 * to install the new image, rather than the entire image slot. */
55/* #define MCUBOOT_OVERWRITE_ONLY_FAST */
56#endif
57
David Vinczee574f2d2020-07-10 11:42:03 +020058/* Uncomment to enable the direct-xip code path. */
59/* #define MCUBOOT_DIRECT_XIP */
60
Marti Bolivarf91bca52018-04-12 12:40:46 -040061/*
62 * Cryptographic settings
63 *
64 * You must choose between mbedTLS and Tinycrypt as source of
65 * cryptographic primitives. Other cryptographic settings are also
66 * available.
67 */
68
69/* Uncomment to use ARM's mbedTLS cryptographic primitives */
70/* #define MCUBOOT_USE_MBED_TLS */
71/* Uncomment to use Tinycrypt's. */
72/* #define MCUBOOT_USE_TINYCRYPT */
73
74/*
David Vincze2d736ad2019-02-18 11:50:22 +010075 * Always check the signature of the image in the primary slot before booting,
Marti Bolivarf91bca52018-04-12 12:40:46 -040076 * even if no upgrade was performed. This is recommended if the boot
77 * time penalty is acceptable.
78 */
David Vincze2d736ad2019-02-18 11:50:22 +010079#define MCUBOOT_VALIDATE_PRIMARY_SLOT
Marti Bolivarf91bca52018-04-12 12:40:46 -040080
81/*
82 * Flash abstraction
83 */
84
85/* Uncomment if your flash map API supports flash_area_get_sectors().
86 * See the flash APIs for more details. */
87/* #define MCUBOOT_USE_FLASH_AREA_GET_SECTORS */
88
Marti Bolivarf9bfddd2018-04-24 14:28:33 -040089/* Default maximum number of flash sectors per image slot; change
90 * as desirable. */
91#define MCUBOOT_MAX_IMG_SECTORS 128
92
David Vinczeb75c12a2019-03-22 14:58:33 +010093/* Default number of separately updateable images; change in case of
94 * multiple images. */
95#define MCUBOOT_IMAGE_NUMBER 1
96
Marti Bolivar248da082018-04-24 15:11:39 -040097/*
Fabio Utzig7d817862018-05-07 08:09:01 -030098 * Logging
99 */
100
101/*
102 * If logging is enabled the following functions must be defined by the
103 * platform:
104 *
Emanuele Di Santo20ba65e2019-01-10 13:38:16 +0100105 * MCUBOOT_LOG_MODULE_REGISTER(domain)
106 * Register a new log module and add the current C file to it.
107 *
108 * MCUBOOT_LOG_MODULE_DECLARE(domain)
109 * Add the current C file to an existing log module.
110 *
Fabio Utzig7d817862018-05-07 08:09:01 -0300111 * MCUBOOT_LOG_ERR(...)
112 * MCUBOOT_LOG_WRN(...)
113 * MCUBOOT_LOG_INF(...)
114 * MCUBOOT_LOG_DBG(...)
115 *
Emanuele Di Santoccc98aa2019-01-09 14:17:54 +0100116 * The function priority is:
Fabio Utzig7d817862018-05-07 08:09:01 -0300117 *
118 * MCUBOOT_LOG_ERR > MCUBOOT_LOG_WRN > MCUBOOT_LOG_INF > MCUBOOT_LOG_DBG
Fabio Utzig7d817862018-05-07 08:09:01 -0300119 */
120#define MCUBOOT_HAVE_LOGGING 1
121
122/*
Marti Bolivar248da082018-04-24 15:11:39 -0400123 * Assertions
124 */
125
126/* Uncomment if your platform has its own mcuboot_config/mcuboot_assert.h.
127 * If so, it must provide an ASSERT macro for use by bootutil. Otherwise,
128 * "assert" is used. */
129/* #define MCUBOOT_HAVE_ASSERT_H */
130
Fabio Utzig853657c2019-05-07 08:06:07 -0300131/*
132 * Watchdog feeding
133 */
134
135/* This macro might be implemented if the OS / HW watchdog is enabled while
136 * doing a swap upgrade and the time it takes for a swapping is long enough
137 * to cause an unwanted reset. If implementing this, the OS main.c must also
138 * enable the watchdog (if required)!
139 *
140 * #define MCUBOOT_WATCHDOG_FEED()
141 * do { do watchdog feeding here! } while (0)
142 */
143
Marti Bolivarf91bca52018-04-12 12:40:46 -0400144#endif /* __MCUBOOT_CONFIG_H__ */