2018-04-13 00:40:46 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2018 Open Source Foundries Limited
|
2024-04-03 16:24:26 +08:00
|
|
|
* Copyright (c) 2019-2024 Arm Limited
|
2018-04-13 00:40:46 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __MCUBOOT_CONFIG_H__
|
|
|
|
#define __MCUBOOT_CONFIG_H__
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Template configuration file for MCUboot.
|
|
|
|
*
|
|
|
|
* When porting MCUboot to a new target, copy it somewhere that your
|
|
|
|
* include path can find it as mcuboot_config/mcuboot_config.h, and
|
|
|
|
* make adjustments to suit your platform.
|
|
|
|
*
|
|
|
|
* For examples, see:
|
|
|
|
*
|
|
|
|
* boot/zephyr/include/mcuboot_config/mcuboot_config.h
|
|
|
|
* boot/mynewt/mcuboot_config/include/mcuboot_config/mcuboot_config.h
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Signature types
|
|
|
|
*
|
|
|
|
* You must choose exactly one signature type.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Uncomment for RSA signature support */
|
|
|
|
/* #define MCUBOOT_SIGN_RSA */
|
|
|
|
|
|
|
|
/* Uncomment for ECDSA signatures using curve P-256. */
|
|
|
|
/* #define MCUBOOT_SIGN_EC256 */
|
|
|
|
|
2024-04-03 16:24:26 +08:00
|
|
|
/*
|
|
|
|
* Public key handling
|
|
|
|
*
|
|
|
|
* Choose one or none from the different public key handling options.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Uncomment to use key hash(es) instead of incorporating
|
|
|
|
* the public key into the code. */
|
|
|
|
/* #define MCUBOOT_HW_KEY */
|
|
|
|
/* Uncomment to use builtin key(s) instead of incorporating
|
|
|
|
* the public key into the code. */
|
|
|
|
/* #define MCUBOOT_BUILTIN_KEY */
|
2018-04-13 00:40:46 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Upgrade mode
|
|
|
|
*
|
2020-07-10 17:42:03 +08:00
|
|
|
* The default is to support A/B image swapping with rollback. Other modes
|
|
|
|
* with simpler code path, which only supports overwriting the existing image
|
|
|
|
* with the update image or running the newest image directly from its flash
|
|
|
|
* partition, are also available.
|
|
|
|
*
|
|
|
|
* You can enable only one mode at a time from the list below to override
|
|
|
|
* the default upgrade mode.
|
2018-04-13 00:40:46 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* Uncomment to enable the overwrite-only code path. */
|
|
|
|
/* #define MCUBOOT_OVERWRITE_ONLY */
|
|
|
|
|
|
|
|
#ifdef MCUBOOT_OVERWRITE_ONLY
|
2019-02-18 18:50:22 +08:00
|
|
|
/* Uncomment to only erase and overwrite those primary slot sectors needed
|
2018-04-13 00:40:46 +08:00
|
|
|
* to install the new image, rather than the entire image slot. */
|
|
|
|
/* #define MCUBOOT_OVERWRITE_ONLY_FAST */
|
|
|
|
#endif
|
|
|
|
|
2020-07-10 17:42:03 +08:00
|
|
|
/* Uncomment to enable the direct-xip code path. */
|
|
|
|
/* #define MCUBOOT_DIRECT_XIP */
|
2020-10-22 19:53:29 +08:00
|
|
|
/* Uncomment to enable the revert mechanism in direct-xip mode. */
|
|
|
|
/* #define MCUBOOT_DIRECT_XIP_REVERT */
|
2020-07-10 17:42:03 +08:00
|
|
|
|
2020-09-10 23:32:39 +08:00
|
|
|
/* Uncomment to enable the ram-load code path. */
|
|
|
|
/* #define MCUBOOT_RAM_LOAD */
|
|
|
|
|
2018-04-13 00:40:46 +08:00
|
|
|
/*
|
|
|
|
* Cryptographic settings
|
|
|
|
*
|
|
|
|
* You must choose between mbedTLS and Tinycrypt as source of
|
|
|
|
* cryptographic primitives. Other cryptographic settings are also
|
|
|
|
* available.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Uncomment to use ARM's mbedTLS cryptographic primitives */
|
|
|
|
/* #define MCUBOOT_USE_MBED_TLS */
|
|
|
|
/* Uncomment to use Tinycrypt's. */
|
|
|
|
/* #define MCUBOOT_USE_TINYCRYPT */
|
|
|
|
|
|
|
|
/*
|
2019-02-18 18:50:22 +08:00
|
|
|
* Always check the signature of the image in the primary slot before booting,
|
2018-04-13 00:40:46 +08:00
|
|
|
* even if no upgrade was performed. This is recommended if the boot
|
|
|
|
* time penalty is acceptable.
|
|
|
|
*/
|
2019-02-18 18:50:22 +08:00
|
|
|
#define MCUBOOT_VALIDATE_PRIMARY_SLOT
|
2018-04-13 00:40:46 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Flash abstraction
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Uncomment if your flash map API supports flash_area_get_sectors().
|
|
|
|
* See the flash APIs for more details. */
|
|
|
|
/* #define MCUBOOT_USE_FLASH_AREA_GET_SECTORS */
|
|
|
|
|
2018-04-25 02:28:33 +08:00
|
|
|
/* Default maximum number of flash sectors per image slot; change
|
|
|
|
* as desirable. */
|
|
|
|
#define MCUBOOT_MAX_IMG_SECTORS 128
|
|
|
|
|
2019-03-22 21:58:33 +08:00
|
|
|
/* Default number of separately updateable images; change in case of
|
|
|
|
* multiple images. */
|
|
|
|
#define MCUBOOT_IMAGE_NUMBER 1
|
|
|
|
|
2018-05-07 19:09:01 +08:00
|
|
|
/*
|
|
|
|
* Logging
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If logging is enabled the following functions must be defined by the
|
|
|
|
* platform:
|
|
|
|
*
|
2019-01-10 20:38:16 +08:00
|
|
|
* MCUBOOT_LOG_MODULE_REGISTER(domain)
|
|
|
|
* Register a new log module and add the current C file to it.
|
|
|
|
*
|
|
|
|
* MCUBOOT_LOG_MODULE_DECLARE(domain)
|
|
|
|
* Add the current C file to an existing log module.
|
|
|
|
*
|
2018-05-07 19:09:01 +08:00
|
|
|
* MCUBOOT_LOG_ERR(...)
|
|
|
|
* MCUBOOT_LOG_WRN(...)
|
|
|
|
* MCUBOOT_LOG_INF(...)
|
|
|
|
* MCUBOOT_LOG_DBG(...)
|
|
|
|
*
|
2019-01-09 21:17:54 +08:00
|
|
|
* The function priority is:
|
2018-05-07 19:09:01 +08:00
|
|
|
*
|
|
|
|
* MCUBOOT_LOG_ERR > MCUBOOT_LOG_WRN > MCUBOOT_LOG_INF > MCUBOOT_LOG_DBG
|
|
|
|
*/
|
|
|
|
#define MCUBOOT_HAVE_LOGGING 1
|
|
|
|
|
2018-04-25 03:11:39 +08:00
|
|
|
/*
|
|
|
|
* Assertions
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Uncomment if your platform has its own mcuboot_config/mcuboot_assert.h.
|
|
|
|
* If so, it must provide an ASSERT macro for use by bootutil. Otherwise,
|
|
|
|
* "assert" is used. */
|
|
|
|
/* #define MCUBOOT_HAVE_ASSERT_H */
|
|
|
|
|
2019-05-07 19:06:07 +08:00
|
|
|
/*
|
|
|
|
* Watchdog feeding
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* This macro might be implemented if the OS / HW watchdog is enabled while
|
|
|
|
* doing a swap upgrade and the time it takes for a swapping is long enough
|
|
|
|
* to cause an unwanted reset. If implementing this, the OS main.c must also
|
|
|
|
* enable the watchdog (if required)!
|
|
|
|
*
|
|
|
|
* #define MCUBOOT_WATCHDOG_FEED()
|
|
|
|
* do { do watchdog feeding here! } while (0)
|
|
|
|
*/
|
|
|
|
|
2021-06-11 18:26:42 +08:00
|
|
|
/* If a OS ports support single thread mode or is bare-metal then:
|
|
|
|
* This macro implements call that switches CPU to an idle state, from which
|
|
|
|
* the CPU may be woken up by, for example, UART transmission event.
|
2024-04-03 16:24:26 +08:00
|
|
|
*
|
2021-06-11 18:26:42 +08:00
|
|
|
* Otherwise this macro should be no-op.
|
|
|
|
*/
|
|
|
|
#define MCUBOOT_CPU_IDLE() \
|
|
|
|
do { \
|
|
|
|
} while (0)
|
|
|
|
|
2018-04-13 00:40:46 +08:00
|
|
|
#endif /* __MCUBOOT_CONFIG_H__ */
|