Tools: Generate SPM configurations in script
The manifest tool has two places (config_impl.h and config_impl.cmake)
to check SFN/IPC Partitions numbers.
This doubles the maintainance effort.
This patch moves those checks forward to the manifest script.
This patch also adds back all the SPM configurations to config_impl.h
so that all sources need them only have to include the head file but
no need to add compiler definitions.
This patch removes the backend.c and builds the backend_ipc/sfn.c
according to the configurations.
Change-Id: I8da72bccc547df6ee4b2503869daf490b04bcf8b
Signed-off-by: Kevin Peng <kevin.peng@arm.com>
diff --git a/secure_fw/spm/ffm/backend.c b/secure_fw/spm/ffm/backend.c
deleted file mode 100644
index 9df5de7..0000000
--- a/secure_fw/spm/ffm/backend.c
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * Copyright (c) 2021, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-#include "config_impl.h"
-
-#if CONFIG_TFM_SPM_BACKEND_SFN == 1
-#include "backend_sfn.c"
-#elif CONFIG_TFM_SPM_BACKEND_IPC == 1
-#include "backend_ipc.c"
-#else
-#error "Invalid configuration."
-#endif
diff --git a/secure_fw/spm/ffm/backend_ipc.c b/secure_fw/spm/ffm/backend_ipc.c
index 443c5da..543282a 100644
--- a/secure_fw/spm/ffm/backend_ipc.c
+++ b/secure_fw/spm/ffm/backend_ipc.c
@@ -23,7 +23,7 @@
/* Declare the global component list */
struct partition_head_t partition_listhead;
-#ifdef CONFIG_TFM_PSA_API_CROSS_CALL
+#if CONFIG_TFM_PSA_API_CROSS_CALL == 1
#ifdef TFM_MULTI_CORE_TOPOLOGY
/* TODO: To be checked when RPC design updates. */
@@ -115,7 +115,7 @@
THRD_INIT(&p_pt->thrd, &p_pt->ctx_ctrl,
TO_THREAD_PRIORITY(PARTITION_PRIORITY(p_pldi->flags)));
-#if defined(CONFIG_TFM_PSA_API_CROSS_CALL) && !defined(TFM_MULTI_CORE_TOPOLOGY)
+#if (CONFIG_TFM_PSA_API_CROSS_CALL == 1) && !defined(TFM_MULTI_CORE_TOPOLOGY)
if (p_pldi->pid == TFM_SP_NON_SECURE_ID) {
SPM_THREAD_CONTEXT = &p_pt->ctx_ctrl;
}
@@ -132,7 +132,7 @@
uint32_t control;
struct partition_t *p_cur_pt;
-#ifdef CONFIG_TFM_PSA_API_THREAD_CALL
+#if CONFIG_TFM_PSA_API_THREAD_CALL == 1
TFM_CORE_ASSERT(SPM_THREAD_CONTEXT);
#endif