Test: Add an option to select/deselect IRQ test cases

Some topologies and platforms don't support IRQ in TF-M yet. The
IRQ test should be temporarily skipped during test on those
topologies or platforms.
Add TFM_ENABLE_IRQ_TEST to select/deselect IRQ test cases.
Update the auto-generated files.

Change-Id: I6ce90fd15a8bc51bfd91741acd548bd471e43089
Signed-off-by: David Hu <david.hu@arm.com>
diff --git a/secure_fw/CMakeLists.txt b/secure_fw/CMakeLists.txt
index cad51b6..63a8ba3 100644
--- a/secure_fw/CMakeLists.txt
+++ b/secure_fw/CMakeLists.txt
@@ -263,6 +263,12 @@
 	endif()
 	embedded_set_target_link_includes(TARGET ${EXE_NAME} INCLUDES "${PLATFORM_LINK_INCLUDES}")
 
+	if (NOT DEFINED TFM_ENABLE_IRQ_TEST)
+		message(FATAL_ERROR "ERROR: Incomplete Configuration: TFM_ENABLE_IRQ_TEST is not defined.")
+	elseif (TFM_ENABLE_IRQ_TEST)
+		embedded_set_target_link_defines(TARGET ${EXE_NAME} DEFINES "TFM_ENABLE_IRQ_TEST")
+	endif()
+
 	#Generate binary file from executable
 	compiler_generate_binary_output(${EXE_NAME})
 
diff --git a/secure_fw/core/ipc/tfm_secure_irq_handlers_ipc.inc b/secure_fw/core/ipc/tfm_secure_irq_handlers_ipc.inc
index 999ee09..cc67b02 100644
--- a/secure_fw/core/ipc/tfm_secure_irq_handlers_ipc.inc
+++ b/secure_fw/core/ipc/tfm_secure_irq_handlers_ipc.inc
@@ -22,16 +22,16 @@
 
 /* Definitions of the signals of the IRQs (if any) */
 const struct tfm_core_irq_signal_data_t tfm_core_irq_signals[] = {
-#ifdef TFM_PARTITION_TEST_CORE
+#ifdef TFM_ENABLE_IRQ_TEST
     { TFM_IRQ_TEST_1_ID, SPM_CORE_IRQ_TEST_1_SIGNAL_TIMER_0_IRQ, TFM_TIMER0_IRQ, 64 },
-#endif /* TFM_PARTITION_TEST_CORE */
+#endif /* TFM_ENABLE_IRQ_TEST */
 };
 
 const size_t tfm_core_irq_signals_count = sizeof(tfm_core_irq_signals) /
                                           sizeof(*tfm_core_irq_signals);
 
 /* Definitions of privileged IRQ handlers (if any) */
-#ifdef TFM_PARTITION_TEST_CORE
+#ifdef TFM_ENABLE_IRQ_TEST
 void TFM_TIMER0_IRQ_Handler(void)
 {
     __disable_irq();
@@ -42,5 +42,5 @@
     __enable_irq();
 }
 
-#endif /* TFM_PARTITION_TEST_CORE */
+#endif /* TFM_ENABLE_IRQ_TEST */
 
diff --git a/secure_fw/core/tfm_secure_irq_handlers.inc b/secure_fw/core/tfm_secure_irq_handlers.inc
index 98da9f4..9c12be3 100644
--- a/secure_fw/core/tfm_secure_irq_handlers.inc
+++ b/secure_fw/core/tfm_secure_irq_handlers.inc
@@ -22,9 +22,9 @@
 
 /* Definitions of the signals of the IRQs */
 const struct tfm_core_irq_signal_data_t tfm_core_irq_signals[] = {
-#ifdef TFM_PARTITION_TEST_CORE
+#ifdef TFM_ENABLE_IRQ_TEST
     { TFM_IRQ_TEST_1_ID, SPM_CORE_IRQ_TEST_1_SIGNAL_TIMER_0_IRQ, TFM_TIMER0_IRQ, 64 },
-#endif /* TFM_PARTITION_TEST_CORE */
+#endif /* TFM_ENABLE_IRQ_TEST */
 };
 
 const size_t tfm_core_irq_signals_count = sizeof(tfm_core_irq_signals) /
@@ -36,13 +36,13 @@
                                   uint32_t irq_line);
 
 /* Forward declarations of unpriv IRQ handlers*/
-#ifdef TFM_PARTITION_TEST_CORE
+#ifdef TFM_ENABLE_IRQ_TEST
 extern void SPM_CORE_IRQ_TEST_1_SIGNAL_TIMER_0_IRQ_isr(void);
-#endif /* TFM_PARTITION_TEST_CORE */
+#endif /* TFM_ENABLE_IRQ_TEST */
 
 
 /* Definitions of privileged IRQ handlers */
-#ifdef TFM_PARTITION_TEST_CORE
+#ifdef TFM_ENABLE_IRQ_TEST
 void TFM_TIMER0_IRQ_Handler(void)
 {
     priv_irq_handler_main(TFM_IRQ_TEST_1_ID,
@@ -51,5 +51,5 @@
                           TFM_TIMER0_IRQ);
 }
 
-#endif /* TFM_PARTITION_TEST_CORE */
+#endif /* TFM_ENABLE_IRQ_TEST */
 
diff --git a/secure_fw/ns_callable/tfm_veneers.c b/secure_fw/ns_callable/tfm_veneers.c
index 023ce36..fa8aacf 100644
--- a/secure_fw/ns_callable/tfm_veneers.c
+++ b/secure_fw/ns_callable/tfm_veneers.c
@@ -111,11 +111,11 @@
 /******** TFM_SP_IPC_CLIENT_TEST ********/
 #endif /* TFM_PARTITION_TEST_CORE_IPC */
 
-#ifdef TFM_PARTITION_TEST_CORE
+#ifdef TFM_ENABLE_IRQ_TEST
 /******** TFM_IRQ_TEST_1 ********/
 psa_status_t spm_irq_test_1_prepare_test_scenario(psa_invec *, size_t, psa_outvec *, size_t);
 psa_status_t spm_irq_test_1_execute_test_scenario(psa_invec *, size_t, psa_outvec *, size_t);
-#endif /* TFM_PARTITION_TEST_CORE */
+#endif /* TFM_ENABLE_IRQ_TEST */
 
 
 #define TFM_VENEER_FUNCTION(partition_name, sfn_name) \
@@ -231,9 +231,9 @@
 /******** TFM_SP_IPC_CLIENT_TEST ********/
 #endif /* TFM_PARTITION_TEST_CORE_IPC */
 
-#ifdef TFM_PARTITION_TEST_CORE
+#ifdef TFM_ENABLE_IRQ_TEST
 /******** TFM_IRQ_TEST_1 ********/
 TFM_VENEER_FUNCTION(TFM_IRQ_TEST_1, spm_irq_test_1_prepare_test_scenario)
 TFM_VENEER_FUNCTION(TFM_IRQ_TEST_1, spm_irq_test_1_execute_test_scenario)
-#endif /* TFM_PARTITION_TEST_CORE */
+#endif /* TFM_ENABLE_IRQ_TEST */
 
diff --git a/secure_fw/services/tfm_partition_defs.inc b/secure_fw/services/tfm_partition_defs.inc
index bf195a3..b81f8c5 100644
--- a/secure_fw/services/tfm_partition_defs.inc
+++ b/secure_fw/services/tfm_partition_defs.inc
@@ -44,9 +44,9 @@
 #define TFM_SP_IPC_CLIENT_TEST_ID (TFM_SP_BASE + 9)
 #endif /* TFM_PARTITION_TEST_CORE_IPC */
 
-#ifdef TFM_PARTITION_TEST_CORE
+#ifdef TFM_ENABLE_IRQ_TEST
 #define TFM_IRQ_TEST_1_ID (TFM_SP_BASE + 10)
-#endif /* TFM_PARTITION_TEST_CORE */
+#endif /* TFM_ENABLE_IRQ_TEST */
 
 #define TFM_MAX_USER_PARTITIONS (11)
 
diff --git a/secure_fw/services/tfm_service_list.inc b/secure_fw/services/tfm_service_list.inc
index 3ff8d7b..08ffd7d 100644
--- a/secure_fw/services/tfm_service_list.inc
+++ b/secure_fw/services/tfm_service_list.inc
@@ -608,7 +608,7 @@
     },
 #endif /* TFM_PARTITION_TEST_CORE_IPC */
 
-#ifdef TFM_PARTITION_TEST_CORE
+#ifdef TFM_ENABLE_IRQ_TEST
     /******** TFM_IRQ_TEST_1 ********/
     {
         .service_db = {
@@ -640,7 +640,7 @@
         .msg_queue = {0},
         .list = {0},
     },
-#endif /* TFM_PARTITION_TEST_CORE */
+#endif /* TFM_ENABLE_IRQ_TEST */
 
 };
 #endif /* __TFM_SERVICE_LIST_INC__ */
diff --git a/secure_fw/services/tfm_spm_db.inc b/secure_fw/services/tfm_spm_db.inc
index afd17fd..c531fc6 100644
--- a/secure_fw/services/tfm_spm_db.inc
+++ b/secure_fw/services/tfm_spm_db.inc
@@ -49,9 +49,9 @@
 #define TFM_PARTITION_TFM_SP_IPC_CLIENT_TEST_IRQ_COUNT 0
 #endif /* TFM_PARTITION_TEST_CORE_IPC */
 
-#ifdef TFM_PARTITION_TEST_CORE
+#ifdef TFM_ENABLE_IRQ_TEST
 #define TFM_PARTITION_TFM_IRQ_TEST_1_IRQ_COUNT 1
-#endif /* TFM_PARTITION_TEST_CORE */
+#endif /* TFM_ENABLE_IRQ_TEST */
 
 /**************************************************************************/
 /** Declarations of partition init functions */
@@ -90,9 +90,9 @@
 extern int32_t ipc_client_test_main(void);
 #endif /* TFM_PARTITION_TEST_CORE_IPC */
 
-#ifdef TFM_PARTITION_TEST_CORE
+#ifdef TFM_ENABLE_IRQ_TEST
 extern int32_t tfm_irq_test_1_init(void);
-#endif /* TFM_PARTITION_TEST_CORE */
+#endif /* TFM_ENABLE_IRQ_TEST */
 
 /**************************************************************************/
 /** Memory region declarations */
@@ -221,7 +221,7 @@
 REGION_DECLARE(Image$$, TFM_SP_IPC_CLIENT_TEST, _STACK$$ZI$$Limit);
 #endif /* TFM_PARTITION_TEST_CORE_IPC */
 
-#ifdef TFM_PARTITION_TEST_CORE
+#ifdef TFM_ENABLE_IRQ_TEST
 REGION_DECLARE(Image$$, TFM_IRQ_TEST_1, $$Base);
 REGION_DECLARE(Image$$, TFM_IRQ_TEST_1, $$Limit);
 REGION_DECLARE(Image$$, TFM_IRQ_TEST_1, $$RO$$Base);
@@ -232,7 +232,7 @@
 REGION_DECLARE(Image$$, TFM_IRQ_TEST_1, _DATA$$ZI$$Limit);
 REGION_DECLARE(Image$$, TFM_IRQ_TEST_1, _STACK$$ZI$$Base);
 REGION_DECLARE(Image$$, TFM_IRQ_TEST_1, _STACK$$ZI$$Limit);
-#endif /* TFM_PARTITION_TEST_CORE */
+#endif /* TFM_ENABLE_IRQ_TEST */
 
 #ifndef TFM_PSA_API
 /**************************************************************************/
@@ -331,14 +331,14 @@
         )) / sizeof(uint32_t)];
 #endif /* TFM_PARTITION_TEST_CORE_IPC */
 
-#ifdef TFM_PARTITION_TEST_CORE
+#ifdef TFM_ENABLE_IRQ_TEST
 static uint32_t ctx_stack_TFM_IRQ_TEST_1[
         (sizeof(struct interrupted_ctx_stack_frame_t) +
             (TFM_PARTITION_TFM_IRQ_TEST_1_IRQ_COUNT) * (
                 sizeof(struct interrupted_ctx_stack_frame_t) +
                 sizeof(struct handler_ctx_stack_frame_t)
         )) / sizeof(uint32_t)];
-#endif /* TFM_PARTITION_TEST_CORE */
+#endif /* TFM_ENABLE_IRQ_TEST */
 
 #endif /* !defined(TFM_PSA_API) */
 
@@ -1209,7 +1209,7 @@
     /* -----------------------------------------------------------------------*/
     /* - Partition DB record for TFM_IRQ_TEST_1 */
     /* -----------------------------------------------------------------------*/
-#ifdef TFM_PARTITION_TEST_CORE
+#ifdef TFM_ENABLE_IRQ_TEST
     {
     /* Static data */
         {
@@ -1291,7 +1291,7 @@
         },
 #endif /* defined(TFM_PSA_API) */
     },
-#endif /* TFM_PARTITION_TEST_CORE */
+#endif /* TFM_ENABLE_IRQ_TEST */
 
 };