1/*
2 * Copyright (c) 2018 Open Source Foundries Limited
3 * Copyright (c) 2019-2022 Arm Limited
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
8/*
9 * Original code taken from mcuboot project at:
10 * https://github.com/mcu-tools/mcuboot
11 * Git SHA of the original version: ac55554059147fff718015be9f4bd3108123f50a
12 */
13
14#ifndef __MCUBOOT_CONFIG_H__
15#define __MCUBOOT_CONFIG_H__
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21/*
22 * This file is also included by the simulator, but we don't want to
23 * define anything here in simulator builds.
24 *
25 * Instead of using mcuboot_config.h, the simulator adds MCUBOOT_xxx
26 * configuration flags to the compiler command lines based on the
27 * values of environment variables. However, the file still must
28 * exist, or bootutil won't build.
29 */
30#ifndef __BOOTSIM__
31
32#define MCUBOOT_VALIDATE_PRIMARY_SLOT
33#define MCUBOOT_USE_FLASH_AREA_GET_SECTORS
34#define MCUBOOT_TARGET_CONFIG "flash_layout.h"
35
36#cmakedefine MCUBOOT_HW_ROLLBACK_PROT
37#cmakedefine MCUBOOT_MEASURED_BOOT
38#cmakedefine MCUBOOT_DATA_SHARING
39
40#cmakedefine MCUBOOT_BOOTSTRAP
41/*
42 * Maximum size of the measured boot record.
43 *
44 * Its size can be calculated based on the following aspects:
45 *     - There are 5 allowed software component claims,
46 *     - SHA256 is used as the measurement method for the other claims.
47 * Considering these aspects, the only claim which size can vary is the type
48 * of the software component with a maximum length of 12 bytes, which means
49 * the boot record size can be up to 100 bytes.
50 */
51#define MAX_BOOT_RECORD_SZ  (100u)
52
53#cmakedefine MCUBOOT_ENC_IMAGES
54#cmakedefine MCUBOOT_ENCRYPT_RSA
55
56#ifdef MCUBOOT_ENC_IMAGES
57#define MCUBOOT_AES_@MCUBOOT_ENC_KEY_LEN@
58#endif /* MCUBOOT_ENC_IMAGES */
59
60#define MCUBOOT_BOOT_MAX_ALIGN @MCUBOOT_BOOT_MAX_ALIGN@
61
62/*
63 * Cryptographic settings
64 */
65#define MCUBOOT_USE_MBED_TLS
66
67/*
68 * Logging
69 */
70#define MCUBOOT_HAVE_LOGGING    1
71#define MCUBOOT_LOG_LEVEL       @LOG_LEVEL_ID@
72
73#endif /* !__BOOTSIM__ */
74
75/*
76 * Watchdog feeding
77 */
78#define MCUBOOT_WATCHDOG_FEED()     \
79    do {                            \
80        /* Do nothing. */           \
81    } while (0)
82
83#ifdef __cplusplus
84}
85#endif
86
87#endif /* __MCUBOOT_CONFIG_H__ */
88