Marti Bolivar | f91bca5 | 2018-04-12 12:40:46 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2018 Open Source Foundries Limited |
David Vincze | b75c12a | 2019-03-22 14:58:33 +0100 | [diff] [blame] | 3 | * Copyright (c) 2019 Arm Limited |
Marti Bolivar | f91bca5 | 2018-04-12 12:40:46 -0400 | [diff] [blame] | 4 | * |
| 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 Vincze | e574f2d | 2020-07-10 11:42:03 +0200 | [diff] [blame] | 40 | * 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 Bolivar | f91bca5 | 2018-04-12 12:40:46 -0400 | [diff] [blame] | 47 | */ |
| 48 | |
| 49 | /* Uncomment to enable the overwrite-only code path. */ |
| 50 | /* #define MCUBOOT_OVERWRITE_ONLY */ |
| 51 | |
| 52 | #ifdef MCUBOOT_OVERWRITE_ONLY |
David Vincze | 2d736ad | 2019-02-18 11:50:22 +0100 | [diff] [blame] | 53 | /* Uncomment to only erase and overwrite those primary slot sectors needed |
Marti Bolivar | f91bca5 | 2018-04-12 12:40:46 -0400 | [diff] [blame] | 54 | * to install the new image, rather than the entire image slot. */ |
| 55 | /* #define MCUBOOT_OVERWRITE_ONLY_FAST */ |
| 56 | #endif |
| 57 | |
David Vincze | e574f2d | 2020-07-10 11:42:03 +0200 | [diff] [blame] | 58 | /* Uncomment to enable the direct-xip code path. */ |
| 59 | /* #define MCUBOOT_DIRECT_XIP */ |
David Vincze | 505fba2 | 2020-10-22 13:53:29 +0200 | [diff] [blame] | 60 | /* Uncomment to enable the revert mechanism in direct-xip mode. */ |
| 61 | /* #define MCUBOOT_DIRECT_XIP_REVERT */ |
David Vincze | e574f2d | 2020-07-10 11:42:03 +0200 | [diff] [blame] | 62 | |
Tamas Ban | fe03109 | 2020-09-10 17:32:39 +0200 | [diff] [blame] | 63 | /* Uncomment to enable the ram-load code path. */ |
| 64 | /* #define MCUBOOT_RAM_LOAD */ |
| 65 | |
Marti Bolivar | f91bca5 | 2018-04-12 12:40:46 -0400 | [diff] [blame] | 66 | /* |
| 67 | * Cryptographic settings |
| 68 | * |
| 69 | * You must choose between mbedTLS and Tinycrypt as source of |
| 70 | * cryptographic primitives. Other cryptographic settings are also |
| 71 | * available. |
| 72 | */ |
| 73 | |
| 74 | /* Uncomment to use ARM's mbedTLS cryptographic primitives */ |
| 75 | /* #define MCUBOOT_USE_MBED_TLS */ |
| 76 | /* Uncomment to use Tinycrypt's. */ |
| 77 | /* #define MCUBOOT_USE_TINYCRYPT */ |
| 78 | |
| 79 | /* |
David Vincze | 2d736ad | 2019-02-18 11:50:22 +0100 | [diff] [blame] | 80 | * Always check the signature of the image in the primary slot before booting, |
Marti Bolivar | f91bca5 | 2018-04-12 12:40:46 -0400 | [diff] [blame] | 81 | * even if no upgrade was performed. This is recommended if the boot |
| 82 | * time penalty is acceptable. |
| 83 | */ |
David Vincze | 2d736ad | 2019-02-18 11:50:22 +0100 | [diff] [blame] | 84 | #define MCUBOOT_VALIDATE_PRIMARY_SLOT |
Marti Bolivar | f91bca5 | 2018-04-12 12:40:46 -0400 | [diff] [blame] | 85 | |
| 86 | /* |
| 87 | * Flash abstraction |
| 88 | */ |
| 89 | |
| 90 | /* Uncomment if your flash map API supports flash_area_get_sectors(). |
| 91 | * See the flash APIs for more details. */ |
| 92 | /* #define MCUBOOT_USE_FLASH_AREA_GET_SECTORS */ |
| 93 | |
Marti Bolivar | f9bfddd | 2018-04-24 14:28:33 -0400 | [diff] [blame] | 94 | /* Default maximum number of flash sectors per image slot; change |
| 95 | * as desirable. */ |
| 96 | #define MCUBOOT_MAX_IMG_SECTORS 128 |
| 97 | |
David Vincze | b75c12a | 2019-03-22 14:58:33 +0100 | [diff] [blame] | 98 | /* Default number of separately updateable images; change in case of |
| 99 | * multiple images. */ |
| 100 | #define MCUBOOT_IMAGE_NUMBER 1 |
| 101 | |
Marti Bolivar | 248da08 | 2018-04-24 15:11:39 -0400 | [diff] [blame] | 102 | /* |
Fabio Utzig | 7d81786 | 2018-05-07 08:09:01 -0300 | [diff] [blame] | 103 | * Logging |
| 104 | */ |
| 105 | |
| 106 | /* |
| 107 | * If logging is enabled the following functions must be defined by the |
| 108 | * platform: |
| 109 | * |
Emanuele Di Santo | 20ba65e | 2019-01-10 13:38:16 +0100 | [diff] [blame] | 110 | * MCUBOOT_LOG_MODULE_REGISTER(domain) |
| 111 | * Register a new log module and add the current C file to it. |
| 112 | * |
| 113 | * MCUBOOT_LOG_MODULE_DECLARE(domain) |
| 114 | * Add the current C file to an existing log module. |
| 115 | * |
Fabio Utzig | 7d81786 | 2018-05-07 08:09:01 -0300 | [diff] [blame] | 116 | * MCUBOOT_LOG_ERR(...) |
| 117 | * MCUBOOT_LOG_WRN(...) |
| 118 | * MCUBOOT_LOG_INF(...) |
| 119 | * MCUBOOT_LOG_DBG(...) |
| 120 | * |
Emanuele Di Santo | ccc98aa | 2019-01-09 14:17:54 +0100 | [diff] [blame] | 121 | * The function priority is: |
Fabio Utzig | 7d81786 | 2018-05-07 08:09:01 -0300 | [diff] [blame] | 122 | * |
| 123 | * MCUBOOT_LOG_ERR > MCUBOOT_LOG_WRN > MCUBOOT_LOG_INF > MCUBOOT_LOG_DBG |
Fabio Utzig | 7d81786 | 2018-05-07 08:09:01 -0300 | [diff] [blame] | 124 | */ |
| 125 | #define MCUBOOT_HAVE_LOGGING 1 |
| 126 | |
| 127 | /* |
Marti Bolivar | 248da08 | 2018-04-24 15:11:39 -0400 | [diff] [blame] | 128 | * Assertions |
| 129 | */ |
| 130 | |
| 131 | /* Uncomment if your platform has its own mcuboot_config/mcuboot_assert.h. |
| 132 | * If so, it must provide an ASSERT macro for use by bootutil. Otherwise, |
| 133 | * "assert" is used. */ |
| 134 | /* #define MCUBOOT_HAVE_ASSERT_H */ |
| 135 | |
Fabio Utzig | 853657c | 2019-05-07 08:06:07 -0300 | [diff] [blame] | 136 | /* |
| 137 | * Watchdog feeding |
| 138 | */ |
| 139 | |
| 140 | /* This macro might be implemented if the OS / HW watchdog is enabled while |
| 141 | * doing a swap upgrade and the time it takes for a swapping is long enough |
| 142 | * to cause an unwanted reset. If implementing this, the OS main.c must also |
| 143 | * enable the watchdog (if required)! |
| 144 | * |
| 145 | * #define MCUBOOT_WATCHDOG_FEED() |
| 146 | * do { do watchdog feeding here! } while (0) |
| 147 | */ |
| 148 | |
Roman Okhrimenko | 977b375 | 2022-03-31 14:40:48 +0300 | [diff] [blame] | 149 | /* If a OS ports support single thread mode or is bare-metal then: |
| 150 | * This macro implements call that switches CPU to an idle state, from which |
| 151 | * the CPU may be woken up by, for example, UART transmission event. |
| 152 | * |
| 153 | * Otherwise this macro should be no-op. |
| 154 | */ |
| 155 | #define MCUBOOT_CPU_IDLE() \ |
| 156 | do { \ |
| 157 | } while (0) |
| 158 | |
Marti Bolivar | f91bca5 | 2018-04-12 12:40:46 -0400 | [diff] [blame] | 159 | #endif /* __MCUBOOT_CONFIG_H__ */ |