Support CMSIS_device_header macro provided in CMSIS
This patch creates the tfm_hal_device_header.h to make the device header
in TF-M compliant with CMSIS.
CMSIS uses a preprocessor define CMSIS_device_header that reflects the
actual device name.
With this patch, if the CMSIS_device_header is defined, then the device
header defined by the macro will be included, otherwise the original
cmsis.h.
To be noted that the existing platform ports are not affected.
Change-Id: If24337be37188335ea514769fd90de75365925d9
Signed-off-by: Kevin Peng <kevin.peng@arm.com>
diff --git a/bl2/ext/mcuboot/bl2_main.c b/bl2/ext/mcuboot/bl2_main.c
index 081d88f..6ff4197 100644
--- a/bl2/ext/mcuboot/bl2_main.c
+++ b/bl2/ext/mcuboot/bl2_main.c
@@ -18,7 +18,7 @@
#include <assert.h>
#include "bl2_util.h"
#include "target.h"
-#include "cmsis.h"
+#include "tfm_hal_device_header.h"
#include "Driver_Flash.h"
#include "mbedtls/memory_buffer_alloc.h"
#include "bootutil/bootutil_log.h"
diff --git a/platform/include/tfm_hal_device_header.h b/platform/include/tfm_hal_device_header.h
new file mode 100644
index 0000000..ee095cd
--- /dev/null
+++ b/platform/include/tfm_hal_device_header.h
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2019, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#ifndef __TFM_HAL_DEVICE_HEADER_H__
+#define __TFM_HAL_DEVICE_HEADER_H__
+
+#ifdef CMSIS_device_header
+#include CMSIS_device_header
+#else
+#include "cmsis.h"
+#endif
+
+#endif /* __TFM_HAL_DEVICE_HEADER_H__ */
diff --git a/secure_fw/core/arch/include/tfm_arch.h b/secure_fw/core/arch/include/tfm_arch.h
index 75188c7..8645963 100644
--- a/secure_fw/core/arch/include/tfm_arch.h
+++ b/secure_fw/core/arch/include/tfm_arch.h
@@ -10,7 +10,7 @@
/* This header file collects the architecture related operations. */
#include <inttypes.h>
-#include "cmsis.h"
+#include "tfm_hal_device_header.h"
#include "cmsis_compiler.h"
#if defined(__ARM_ARCH_8M_MAIN__) || defined(__ARM_ARCH_8M_BASE__)
diff --git a/secure_fw/core/arch/tfm_arch_v6m_v7m.c b/secure_fw/core/arch/tfm_arch_v6m_v7m.c
index b0a2b5a..494c14f 100644
--- a/secure_fw/core/arch/tfm_arch_v6m_v7m.c
+++ b/secure_fw/core/arch/tfm_arch_v6m_v7m.c
@@ -6,7 +6,7 @@
*/
#include <inttypes.h>
-#include "cmsis.h"
+#include "tfm_hal_device_header.h"
#include "tfm_arch.h"
#if !defined(__ARM_ARCH_6M__) && !defined(__ARM_ARCH_7M__) && \
diff --git a/secure_fw/core/arch/tfm_arch_v8m_base.c b/secure_fw/core/arch/tfm_arch_v8m_base.c
index 9dd9819..39ab57f 100644
--- a/secure_fw/core/arch/tfm_arch_v8m_base.c
+++ b/secure_fw/core/arch/tfm_arch_v8m_base.c
@@ -6,7 +6,7 @@
*/
#include <inttypes.h>
-#include "cmsis.h"
+#include "tfm_hal_device_header.h"
#include "secure_utilities.h"
#include "tfm_arch.h"
#include "tfm_secure_api.h"
diff --git a/secure_fw/core/arch/tfm_arch_v8m_main.c b/secure_fw/core/arch/tfm_arch_v8m_main.c
index 61bd86a..b917cf5 100644
--- a/secure_fw/core/arch/tfm_arch_v8m_main.c
+++ b/secure_fw/core/arch/tfm_arch_v8m_main.c
@@ -6,7 +6,7 @@
*/
#include <inttypes.h>
-#include "cmsis.h"
+#include "tfm_hal_device_header.h"
#include "region_defs.h"
#include "secure_utilities.h"
#include "tfm_arch.h"
diff --git a/secure_fw/core/include/tfm_core_topology.h b/secure_fw/core/include/tfm_core_topology.h
index 7e2e1e4..9e1362c 100644
--- a/secure_fw/core/include/tfm_core_topology.h
+++ b/secure_fw/core/include/tfm_core_topology.h
@@ -8,7 +8,7 @@
#ifndef _TFM_CORE_TOPOLOGY_H_
#define _TFM_CORE_TOPOLOGY_H_
-#include "cmsis.h"
+#include "tfm_hal_device_header.h"
#include "cmsis_compiler.h"
#ifdef TFM_MULTI_CORE_TOPOLOGY
diff --git a/secure_fw/core/include/tfm_svc.h b/secure_fw/core/include/tfm_svc.h
index b81ff73..945a745 100644
--- a/secure_fw/core/include/tfm_svc.h
+++ b/secure_fw/core/include/tfm_svc.h
@@ -8,7 +8,7 @@
#ifndef __TFM_SVC_H__
#define __TFM_SVC_H__
-#include "cmsis.h"
+#include "tfm_hal_device_header.h"
typedef enum {
TFM_SVC_SFN_REQUEST = 0,