SPM: Only loads partition irqs when exist
In case of no irqs in all partitions, there is no need
to keep the partition irqs load logic code and irqs context
in partition load info.
This patch decrease 200 bytes code size.
Signed-off-by: Sherry Zhang <sherry.zhang2@arm.com>
Change-Id: I93f72fb180aac7035f51ed8af4700220d54feb85
diff --git a/platform/ext/target/arm/mps2/an519/CMakeLists.txt b/platform/ext/target/arm/mps2/an519/CMakeLists.txt
index 5cbb7ed..c350af9 100644
--- a/platform/ext/target/arm/mps2/an519/CMakeLists.txt
+++ b/platform/ext/target/arm/mps2/an519/CMakeLists.txt
@@ -88,7 +88,7 @@
native_drivers/mpu_armv8m_drv.c
native_drivers/ppc_sse200_drv.c
spm_hal.c
- $<$<BOOL:${TFM_PSA_API}>:${CMAKE_CURRENT_SOURCE_DIR}/tfm_interrupts.c>
+ $<$<OR:$<BOOL:${CONFIG_TFM_FLIH_API}>,$<BOOL:${CONFIG_TFM_SLIH_API}>>:${CMAKE_CURRENT_SOURCE_DIR}/tfm_interrupts.c>
tfm_hal_isolation.c
tfm_hal_platform.c
target_cfg.c
diff --git a/platform/ext/target/arm/mps2/an521/CMakeLists.txt b/platform/ext/target/arm/mps2/an521/CMakeLists.txt
index baadb8d..407ca4d 100644
--- a/platform/ext/target/arm/mps2/an521/CMakeLists.txt
+++ b/platform/ext/target/arm/mps2/an521/CMakeLists.txt
@@ -95,7 +95,7 @@
native_drivers/mpu_armv8m_drv.c
native_drivers/ppc_sse200_drv.c
spm_hal.c
- $<$<BOOL:${TFM_PSA_API}>:${CMAKE_CURRENT_SOURCE_DIR}/tfm_interrupts.c>
+ $<$<OR:$<BOOL:${CONFIG_TFM_FLIH_API}>,$<BOOL:${CONFIG_TFM_SLIH_API}>>:${CMAKE_CURRENT_SOURCE_DIR}/tfm_interrupts.c>
tfm_hal_isolation.c
tfm_hal_platform.c
target_cfg.c
diff --git a/platform/ext/target/arm/mps3/an524/CMakeLists.txt b/platform/ext/target/arm/mps3/an524/CMakeLists.txt
index dddab33..052db77 100644
--- a/platform/ext/target/arm/mps3/an524/CMakeLists.txt
+++ b/platform/ext/target/arm/mps3/an524/CMakeLists.txt
@@ -91,7 +91,7 @@
native_drivers/uart_cmsdk_drv.c
native_drivers/timer_cmsdk_drv.c
spm_hal.c
- $<$<BOOL:${TFM_PSA_API}>:${CMAKE_CURRENT_SOURCE_DIR}/tfm_interrupts.c>
+ $<$<OR:$<BOOL:${CONFIG_TFM_FLIH_API}>,$<BOOL:${CONFIG_TFM_SLIH_API}>>:${CMAKE_CURRENT_SOURCE_DIR}/tfm_interrupts.c>
tfm_hal_isolation.c
tfm_hal_platform.c
target_cfg.c
diff --git a/platform/ext/target/arm/mps3/an547/CMakeLists.txt b/platform/ext/target/arm/mps3/an547/CMakeLists.txt
index 4f0b546..a1f82d1 100644
--- a/platform/ext/target/arm/mps3/an547/CMakeLists.txt
+++ b/platform/ext/target/arm/mps3/an547/CMakeLists.txt
@@ -96,7 +96,7 @@
native_drivers/syscounter_armv8-m_cntrl_drv.c
native_drivers/uart_cmsdk_drv.c
spm_hal.c
- $<$<BOOL:${TFM_PSA_API}>:${CMAKE_CURRENT_SOURCE_DIR}/tfm_interrupts.c>
+ $<$<OR:$<BOOL:${CONFIG_TFM_FLIH_API}>,$<BOOL:${CONFIG_TFM_SLIH_API}>>:${CMAKE_CURRENT_SOURCE_DIR}/tfm_interrupts.c>
target_cfg.c
tfm_peripherals_def.c
tfm_hal_isolation.c
diff --git a/platform/ext/target/arm/mps3/corstone310_fvp/CMakeLists.txt b/platform/ext/target/arm/mps3/corstone310_fvp/CMakeLists.txt
index 5c0a165..246aa3b 100644
--- a/platform/ext/target/arm/mps3/corstone310_fvp/CMakeLists.txt
+++ b/platform/ext/target/arm/mps3/corstone310_fvp/CMakeLists.txt
@@ -102,7 +102,7 @@
native_drivers/dma350_drv.c
libraries/dma350_lib.c
spm_hal.c
- $<$<BOOL:${TFM_PSA_API}>:${CMAKE_CURRENT_SOURCE_DIR}/tfm_interrupts.c>
+ $<$<OR:$<BOOL:${CONFIG_TFM_FLIH_API}>,$<BOOL:${CONFIG_TFM_SLIH_API}>>:${CMAKE_CURRENT_SOURCE_DIR}/tfm_interrupts.c>
target_cfg.c
tfm_hal_isolation.c
tfm_hal_platform.c
diff --git a/platform/ext/target/arm/musca_b1/sse_200/CMakeLists.txt b/platform/ext/target/arm/musca_b1/sse_200/CMakeLists.txt
index 69a3116..a48a072 100644
--- a/platform/ext/target/arm/musca_b1/sse_200/CMakeLists.txt
+++ b/platform/ext/target/arm/musca_b1/sse_200/CMakeLists.txt
@@ -116,7 +116,7 @@
$<$<NOT:$<BOOL:${FORWARD_PROT_MSG}>>:${CMAKE_MUSCA_B1_COMMON_DIR}/Native_Driver/musca_b1_eflash_drv.c>
Native_Driver/musca_b1_scc_drv.c
spm_hal.c
- $<$<BOOL:${TFM_PSA_API}>:${CMAKE_CURRENT_SOURCE_DIR}/tfm_interrupts.c>
+ $<$<OR:$<BOOL:${CONFIG_TFM_FLIH_API}>,$<BOOL:${CONFIG_TFM_SLIH_API}>>:${CMAKE_CURRENT_SOURCE_DIR}/tfm_interrupts.c>
tfm_hal_isolation.c
tfm_hal_platform.c
target_cfg.c
diff --git a/platform/ext/target/nordic_nrf/common/nrf5340/CMakeLists.txt b/platform/ext/target/nordic_nrf/common/nrf5340/CMakeLists.txt
index 19394ec..b419199 100644
--- a/platform/ext/target/nordic_nrf/common/nrf5340/CMakeLists.txt
+++ b/platform/ext/target/nordic_nrf/common/nrf5340/CMakeLists.txt
@@ -43,7 +43,7 @@
target_sources(platform_s
PRIVATE
target_cfg.c
- $<$<BOOL:${TFM_PSA_API}>:${CMAKE_CURRENT_SOURCE_DIR}/tfm_interrupts.c>
+ $<$<OR:$<BOOL:${CONFIG_TFM_FLIH_API}>,$<BOOL:${CONFIG_TFM_SLIH_API}>>:${CMAKE_CURRENT_SOURCE_DIR}/tfm_interrupts.c>
${HAL_NORDIC_PATH}/nrfx/mdk/system_nrf5340_application.c
)
diff --git a/platform/ext/target/nordic_nrf/common/nrf9160/CMakeLists.txt b/platform/ext/target/nordic_nrf/common/nrf9160/CMakeLists.txt
index 66f7eb8..0ba23c1 100644
--- a/platform/ext/target/nordic_nrf/common/nrf9160/CMakeLists.txt
+++ b/platform/ext/target/nordic_nrf/common/nrf9160/CMakeLists.txt
@@ -43,7 +43,7 @@
target_sources(platform_s
PRIVATE
target_cfg.c
- $<$<BOOL:${TFM_PSA_API}>:${CMAKE_CURRENT_SOURCE_DIR}/tfm_interrupts.c>
+ $<$<OR:$<BOOL:${CONFIG_TFM_FLIH_API}>,$<BOOL:${CONFIG_TFM_SLIH_API}>>:${CMAKE_CURRENT_SOURCE_DIR}/tfm_interrupts.c>
${HAL_NORDIC_PATH}/nrfx/mdk/system_nrf9160.c
)
diff --git a/secure_fw/spm/CMakeLists.txt b/secure_fw/spm/CMakeLists.txt
index 78e437a..9279fe7 100755
--- a/secure_fw/spm/CMakeLists.txt
+++ b/secure_fw/spm/CMakeLists.txt
@@ -54,7 +54,7 @@
$<$<BOOL:${TFM_PSA_API}>:ffm/psa_api.c>
$<$<BOOL:${CONFIG_TFM_SPM_BACKEND_IPC}>:ffm/backend_ipc.c>
$<$<BOOL:${CONFIG_TFM_SPM_BACKEND_SFN}>:ffm/backend_sfn.c>
- $<$<BOOL:${TFM_PSA_API}>:ffm/interrupt.c>
+ $<$<OR:$<BOOL:${CONFIG_TFM_FLIH_API}>,$<BOOL:${CONFIG_TFM_SLIH_API}>>:ffm/interrupt.c>
$<$<BOOL:${CONFIG_TFM_STACK_WATERMARKS}>:ffm/stack_watermark.c>
$<$<BOOL:${TFM_PSA_API}>:cmsis_psa/tfm_core_svcalls_ipc.c>
$<$<BOOL:${TFM_PSA_API}>:cmsis_psa/tfm_pools.c>
diff --git a/secure_fw/spm/cmsis_psa/static_loader.c b/secure_fw/spm/cmsis_psa/static_loader.c
index adc799d..6c8907b 100644
--- a/secure_fw/spm/cmsis_psa/static_loader.c
+++ b/secure_fw/spm/cmsis_psa/static_loader.c
@@ -171,6 +171,7 @@
void load_irqs_assuredly(struct partition_t *p_partition)
{
+#if CONFIG_TFM_FLIH_API == 1 || CONFIG_TFM_SLIH_API == 1
struct irq_load_info_t *p_irq_info;
const struct partition_load_info_t *p_ldinf;
uint32_t i;
@@ -197,4 +198,5 @@
}
p_irq_info++;
}
+#endif
}
diff --git a/secure_fw/spm/cmsis_psa/tfm_core_svcalls_ipc.c b/secure_fw/spm/cmsis_psa/tfm_core_svcalls_ipc.c
index 91b8a95..acb3fbb 100644
--- a/secure_fw/spm/cmsis_psa/tfm_core_svcalls_ipc.c
+++ b/secure_fw/spm/cmsis_psa/tfm_core_svcalls_ipc.c
@@ -172,7 +172,7 @@
case TFM_SVC_GET_BOOT_DATA:
tfm_core_get_boot_data_handler(svc_args);
break;
-#if TFM_LVL != 1
+#if (TFM_LVL != 1) && (CONFIG_TFM_FLIH_API == 1)
case TFM_SVC_PREPARE_DEPRIV_FLIH:
exc_return = tfm_flih_prepare_depriv_flih(
(struct partition_t *)svc_args[0],
diff --git a/tools/config_impl.cmake.template b/tools/config_impl.cmake.template
index 00bd4ed..721603d 100644
--- a/tools/config_impl.cmake.template
+++ b/tools/config_impl.cmake.template
@@ -16,4 +16,7 @@
if((CONFIG_TFM_FP GREATER 0) AND CONFIG_TFM_SPM_BACKEND_SFN)
message(FATAL_ERROR "FP is not supported for SFN model.")
endif()
+
+ set(CONFIG_TFM_FLIH_API {{config_impl['CONFIG_TFM_FLIH_API']}} PARENT_SCOPE)
+ set(CONFIG_TFM_SLIH_API {{config_impl['CONFIG_TFM_SLIH_API']}} PARENT_SCOPE)
endif()