Mandate the presence of mcuboot_config/mcuboot_config.h
Mynewt uses this file to convert MYNEWT_VAL(xxx) to MCUBOOT_xxx config
options. Zephyr currently adds config options via the compiler command
line, but it should use this instead.
As prep work for that conversion, add an empty mcuboot_config.h to the
Zephyr port, and include this file unconditionally wherever it's
needed. This takes care of the simulator as well, since that puts
boot/zephyr/include on its C file include path.
This turned up a couple of files (bootutil_priv.h and caps.c) that
were using the MCUBOOT_xxx config values without including the
file. Add the includes there, as they'll be needed later.
To make this official, add it to the requirements in the porting guide
and provide a template file porters can use while getting started.
Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
fixup! Mandate the presence of mcuboot_config/mcuboot_config.h
diff --git a/boot/bootutil/include/bootutil/sha256.h b/boot/bootutil/include/bootutil/sha256.h
index cc52b07..63ad480 100644
--- a/boot/bootutil/include/bootutil/sha256.h
+++ b/boot/bootutil/include/bootutil/sha256.h
@@ -29,9 +29,7 @@
#ifndef __BOOTUTIL_CRYPTO_H_
#define __BOOTUTIL_CRYPTO_H_
-#ifdef MCUBOOT_MYNEWT
#include "mcuboot_config/mcuboot_config.h"
-#endif
#if defined(MCUBOOT_USE_MBED_TLS) && defined(MCUBOOT_USE_TINYCRYPT)
#error "Cannot define both MBED_TLS and TINYCRYPT"
diff --git a/boot/bootutil/src/bootutil_priv.h b/boot/bootutil/src/bootutil_priv.h
index 1889aae..d7ab258 100644
--- a/boot/bootutil/src/bootutil_priv.h
+++ b/boot/bootutil/src/bootutil_priv.h
@@ -23,6 +23,7 @@
#include "sysflash/sysflash.h"
#include "flash_map/flash_map.h"
#include "bootutil/image.h"
+#include "mcuboot_config/mcuboot_config.h"
#ifdef __cplusplus
extern "C" {
diff --git a/boot/bootutil/src/caps.c b/boot/bootutil/src/caps.c
index 61d4f3f..dc91849 100644
--- a/boot/bootutil/src/caps.c
+++ b/boot/bootutil/src/caps.c
@@ -15,6 +15,7 @@
*/
#include <bootutil/caps.h>
+#include "mcuboot_config/mcuboot_config.h"
uint32_t bootutil_get_caps(void)
{
diff --git a/boot/bootutil/src/image_ec.c b/boot/bootutil/src/image_ec.c
index 6c3d5b2..63050c7 100644
--- a/boot/bootutil/src/image_ec.c
+++ b/boot/bootutil/src/image_ec.c
@@ -19,9 +19,7 @@
#include <string.h>
-#ifdef MCUBOOT_MYNEWT
#include "mcuboot_config/mcuboot_config.h"
-#endif
#ifdef MCUBOOT_SIGN_EC
#include "bootutil/sign_key.h"
diff --git a/boot/bootutil/src/image_ec256.c b/boot/bootutil/src/image_ec256.c
index 87e0c3f..f1b0a0b 100644
--- a/boot/bootutil/src/image_ec256.c
+++ b/boot/bootutil/src/image_ec256.c
@@ -19,9 +19,7 @@
#include <string.h>
-#ifdef MCUBOOT_MYNEWT
#include "mcuboot_config/mcuboot_config.h"
-#endif
#ifdef MCUBOOT_SIGN_EC256
#include "bootutil/sign_key.h"
diff --git a/boot/bootutil/src/image_rsa.c b/boot/bootutil/src/image_rsa.c
index 79eb61b..7a9ca15 100644
--- a/boot/bootutil/src/image_rsa.c
+++ b/boot/bootutil/src/image_rsa.c
@@ -19,9 +19,7 @@
#include <string.h>
-#ifdef MCUBOOT_MYNEWT
#include "mcuboot_config/mcuboot_config.h"
-#endif
#ifdef MCUBOOT_SIGN_RSA
#include "bootutil/sign_key.h"
diff --git a/boot/bootutil/src/image_validate.c b/boot/bootutil/src/image_validate.c
index a854fd3..496ed27 100644
--- a/boot/bootutil/src/image_validate.c
+++ b/boot/bootutil/src/image_validate.c
@@ -28,9 +28,7 @@
#include "bootutil/sha256.h"
#include "bootutil/sign_key.h"
-#ifdef MCUBOOT_MYNEWT
#include "mcuboot_config/mcuboot_config.h"
-#endif
#ifdef MCUBOOT_SIGN_RSA
#include "mbedtls/rsa.h"
diff --git a/boot/bootutil/src/loader.c b/boot/bootutil/src/loader.c
index e2762bd..a76d056 100644
--- a/boot/bootutil/src/loader.c
+++ b/boot/bootutil/src/loader.c
@@ -37,9 +37,7 @@
#define BOOT_LOG_LEVEL BOOT_LOG_LEVEL_INFO
#include "bootutil/bootutil_log.h"
-#ifdef MCUBOOT_MYNEWT
#include "mcuboot_config/mcuboot_config.h"
-#endif
static struct boot_loader_state boot_data;