Core: Minimize the memory usage for partition list

Split the rodata, data and bss of the partition list.

Change-Id: I1b7e876ceee38b65b871b6be664d46bc7bd49af3
Signed-off-by: Summer Qin <summer.qin@arm.com>
diff --git a/secure_fw/core/ipc/tfm_svcalls.c b/secure_fw/core/ipc/tfm_svcalls.c
index b657e63..9a0fe75 100644
--- a/secure_fw/core/ipc/tfm_svcalls.c
+++ b/secure_fw/core/ipc/tfm_svcalls.c
@@ -151,7 +151,7 @@
         tfm_panic();
     }
     privileged = tfm_spm_partition_get_privileged_mode(
-        partition->static_data.index);
+        partition->runtime_data.index);
 
     if (!ns_caller) {
         inptr = (psa_invec *)args[2];
@@ -423,7 +423,7 @@
         tfm_panic();
     }
     privileged = tfm_spm_partition_get_privileged_mode(
-        partition->static_data.index);
+        partition->runtime_data.index);
 
     /*
      * Write the message to the service buffer. It is a fatal error if the
@@ -554,7 +554,7 @@
 
     partition = msg->service->partition;
     privileged = tfm_spm_partition_get_privileged_mode(
-        partition->static_data.index);
+        partition->runtime_data.index);
 
     /*
      * It is a fatal error if message handle does not refer to a request
@@ -711,7 +711,7 @@
 
     partition = msg->service->partition;
     privileged = tfm_spm_partition_get_privileged_mode(
-        partition->static_data.index);
+        partition->runtime_data.index);
 
     /*
      * It is a fatal error if message handle does not refer to a request
@@ -1039,7 +1039,7 @@
         tfm_panic();
     }
 
-    ret = get_irq_line_for_signal(partition->static_data.partition_id,
+    ret = get_irq_line_for_signal(partition->static_data->partition_id,
                                   irq_signal, &irq_line);
     /* It is a fatal error if passed signal is not an interrupt signal. */
     if (ret != IPC_SUCCESS) {
@@ -1080,7 +1080,7 @@
         tfm_panic();
     }
 
-    ret = get_irq_line_for_signal(partition->static_data.partition_id,
+    ret = get_irq_line_for_signal(partition->static_data->partition_id,
                                   irq_signal, &irq_line);
     /* It is a fatal error if passed signal is not an interrupt signal. */
     if (ret != IPC_SUCCESS) {
@@ -1108,7 +1108,7 @@
         tfm_panic();
     }
 
-    ret = get_irq_line_for_signal(partition->static_data.partition_id,
+    ret = get_irq_line_for_signal(partition->static_data->partition_id,
                                   irq_signal, &irq_line);
     /* It is a fatal error if passed signal is not an interrupt signal. */
     if (ret != IPC_SUCCESS) {
diff --git a/secure_fw/core/tfm_boot_data.c b/secure_fw/core/tfm_boot_data.c
index 4fce3fc..d98cc79 100644
--- a/secure_fw/core/tfm_boot_data.c
+++ b/secure_fw/core/tfm_boot_data.c
@@ -101,7 +101,7 @@
         tfm_panic();
     }
     privileged =
-        tfm_spm_partition_get_privileged_mode(partition->static_data.index);
+        tfm_spm_partition_get_privileged_mode(partition->runtime_data.index);
 
     if (tfm_memory_check(buf_start, buf_size, false, TFM_MEMORY_ACCESS_RW,
         privileged) != IPC_SUCCESS) {
diff --git a/secure_fw/services/tfm_spm_db.inc b/secure_fw/services/tfm_spm_db.inc
index c531fc6..14a4020 100644
--- a/secure_fw/services/tfm_spm_db.inc
+++ b/secure_fw/services/tfm_spm_db.inc
@@ -56,6 +56,10 @@
 /**************************************************************************/
 /** Declarations of partition init functions */
 /**************************************************************************/
+#ifdef TFM_PSA_API
+extern psa_status_t tfm_nspm_thread_entry(void);
+#endif
+
 extern int32_t tfm_sst_req_mngr_init(void);
 
 #ifdef TFM_PARTITION_AUDIT_LOG
@@ -97,6 +101,10 @@
 /**************************************************************************/
 /** Memory region declarations */
 /**************************************************************************/
+#ifdef TFM_PSA_API
+REGION_DECLARE(Image$$, ARM_LIB_STACK, $$ZI$$Base);
+REGION_DECLARE(Image$$, ARM_LIB_STACK, $$ZI$$Limit);
+
 REGION_DECLARE(Image$$, TFM_SP_STORAGE, $$Base);
 REGION_DECLARE(Image$$, TFM_SP_STORAGE, $$Limit);
 REGION_DECLARE(Image$$, TFM_SP_STORAGE, $$RO$$Base);
@@ -234,6 +242,8 @@
 REGION_DECLARE(Image$$, TFM_IRQ_TEST_1, _STACK$$ZI$$Limit);
 #endif /* TFM_ENABLE_IRQ_TEST */
 
+#endif /* defined(TFM_PSA_API) */
+
 #ifndef TFM_PSA_API
 /**************************************************************************/
 /** Context stacks for IRQ handling */
@@ -247,6 +257,12 @@
  *   intr_ctx: Frame pushed when the partition is interrupted
  *   hndl_ctx: Frame pushed when the partition is handling an interrupt
  */
+static uint32_t ns_interrupt_ctx_stack[
+        sizeof(struct interrupted_ctx_stack_frame_t) / sizeof(uint32_t)];
+
+static uint32_t tfm_core_interrupt_ctx_stack[
+        sizeof(struct interrupted_ctx_stack_frame_t) / sizeof(uint32_t)];
+
 static uint32_t ctx_stack_TFM_SP_STORAGE[
         (sizeof(struct interrupted_ctx_stack_frame_t) +
             (TFM_PARTITION_TFM_SP_STORAGE_IRQ_COUNT) * (
@@ -340,99 +356,432 @@
         )) / sizeof(uint32_t)];
 #endif /* TFM_ENABLE_IRQ_TEST */
 
+
+uint32_t *ctx_stack_list[] =
+{
+    ns_interrupt_ctx_stack,
+    tfm_core_interrupt_ctx_stack,
+    ctx_stack_TFM_SP_STORAGE,
+#ifdef TFM_PARTITION_AUDIT_LOG
+    ctx_stack_TFM_SP_AUDIT_LOG,
+#endif /* TFM_PARTITION_AUDIT_LOG */
+    ctx_stack_TFM_SP_CRYPTO,
+#ifdef TFM_PARTITION_PLATFORM
+    ctx_stack_TFM_SP_PLATFORM,
+#endif /* TFM_PARTITION_PLATFORM */
+    ctx_stack_TFM_SP_INITIAL_ATTESTATION,
+#ifdef TFM_PARTITION_TEST_CORE
+    ctx_stack_TFM_SP_CORE_TEST,
+#endif /* TFM_PARTITION_TEST_CORE */
+#ifdef TFM_PARTITION_TEST_CORE
+    ctx_stack_TFM_SP_CORE_TEST_2,
+#endif /* TFM_PARTITION_TEST_CORE */
+#ifdef TFM_PARTITION_TEST_SECURE_SERVICES
+    ctx_stack_TFM_SP_SECURE_TEST_PARTITION,
+#endif /* TFM_PARTITION_TEST_SECURE_SERVICES */
+#ifdef TFM_PARTITION_TEST_CORE_IPC
+    ctx_stack_TFM_SP_IPC_SERVICE_TEST,
+#endif /* TFM_PARTITION_TEST_CORE_IPC */
+#ifdef TFM_PARTITION_TEST_CORE_IPC
+    ctx_stack_TFM_SP_IPC_CLIENT_TEST,
+#endif /* TFM_PARTITION_TEST_CORE_IPC */
+#ifdef TFM_ENABLE_IRQ_TEST
+    ctx_stack_TFM_IRQ_TEST_1,
+#endif /* TFM_ENABLE_IRQ_TEST */
+};
 #endif /* !defined(TFM_PSA_API) */
 
 /**************************************************************************/
+/** The static data of the partition list */
+/**************************************************************************/
+const struct spm_partition_static_data_t static_data_list[] =
+{
+    {
+        .partition_id         = TFM_SP_NON_SECURE_ID,
+#ifdef TFM_PSA_API
+        .partition_flags      = SPM_PART_FLAG_APP_ROT | SPM_PART_FLAG_IPC,
+        .partition_priority   = TFM_PRIORITY_LOW,
+        .partition_init       = tfm_nspm_thread_entry,
+#else
+        .partition_flags      = 0,
+#endif
+    },
+
+#ifndef TFM_PSA_API
+    {
+        .partition_id         = TFM_SP_CORE_ID,
+        .partition_flags      = SPM_PART_FLAG_APP_ROT | SPM_PART_FLAG_PSA_ROT,
+    },
+#endif
+
+    {
+        .partition_id         = TFM_SP_STORAGE_ID,
+        .partition_flags      = SPM_PART_FLAG_IPC
+                              | SPM_PART_FLAG_PSA_ROT | SPM_PART_FLAG_APP_ROT
+                              ,
+        .partition_priority   = TFM_PRIORITY(NORMAL),
+        .partition_init       = tfm_sst_req_mngr_init,
+    },
+
+#ifdef TFM_PARTITION_AUDIT_LOG
+    {
+        .partition_id         = TFM_SP_AUDIT_LOG_ID,
+        .partition_flags      = 0
+                              | SPM_PART_FLAG_PSA_ROT | SPM_PART_FLAG_APP_ROT
+                              ,
+        .partition_priority   = TFM_PRIORITY(NORMAL),
+        .partition_init       = audit_core_init,
+    },
+#endif /* TFM_PARTITION_AUDIT_LOG */
+
+    {
+        .partition_id         = TFM_SP_CRYPTO_ID,
+        .partition_flags      = SPM_PART_FLAG_IPC
+                              | SPM_PART_FLAG_PSA_ROT | SPM_PART_FLAG_APP_ROT
+                              ,
+        .partition_priority   = TFM_PRIORITY(NORMAL),
+        .partition_init       = tfm_crypto_init,
+    },
+
+#ifdef TFM_PARTITION_PLATFORM
+    {
+        .partition_id         = TFM_SP_PLATFORM_ID,
+        .partition_flags      = 0
+                              | SPM_PART_FLAG_PSA_ROT | SPM_PART_FLAG_APP_ROT
+                              ,
+        .partition_priority   = TFM_PRIORITY(NORMAL),
+        .partition_init       = platform_sp_init,
+    },
+#endif /* TFM_PARTITION_PLATFORM */
+
+    {
+        .partition_id         = TFM_SP_INITIAL_ATTESTATION_ID,
+        .partition_flags      = SPM_PART_FLAG_IPC
+                              | SPM_PART_FLAG_PSA_ROT | SPM_PART_FLAG_APP_ROT
+                              ,
+        .partition_priority   = TFM_PRIORITY(NORMAL),
+        .partition_init       = attest_partition_init,
+    },
+
+#ifdef TFM_PARTITION_TEST_CORE
+    {
+        .partition_id         = TFM_SP_CORE_TEST_ID,
+        .partition_flags      = SPM_PART_FLAG_IPC
+                              | SPM_PART_FLAG_APP_ROT
+                              ,
+        .partition_priority   = TFM_PRIORITY(NORMAL),
+        .partition_init       = core_test_init,
+    },
+#endif /* TFM_PARTITION_TEST_CORE */
+
+#ifdef TFM_PARTITION_TEST_CORE
+    {
+        .partition_id         = TFM_SP_CORE_TEST_2_ID,
+        .partition_flags      = SPM_PART_FLAG_IPC
+                              | SPM_PART_FLAG_APP_ROT
+                              ,
+        .partition_priority   = TFM_PRIORITY(NORMAL),
+        .partition_init       = core_test_2_init,
+    },
+#endif /* TFM_PARTITION_TEST_CORE */
+
+#ifdef TFM_PARTITION_TEST_SECURE_SERVICES
+    {
+        .partition_id         = TFM_SP_SECURE_TEST_PARTITION_ID,
+        .partition_flags      = SPM_PART_FLAG_IPC
+                              | SPM_PART_FLAG_PSA_ROT | SPM_PART_FLAG_APP_ROT
+                              ,
+        .partition_priority   = TFM_PRIORITY(NORMAL),
+        .partition_init       = tfm_secure_client_service_init,
+    },
+#endif /* TFM_PARTITION_TEST_SECURE_SERVICES */
+
+#ifdef TFM_PARTITION_TEST_CORE_IPC
+    {
+        .partition_id         = TFM_SP_IPC_SERVICE_TEST_ID,
+        .partition_flags      = SPM_PART_FLAG_IPC
+                              | SPM_PART_FLAG_PSA_ROT | SPM_PART_FLAG_APP_ROT
+                              ,
+        .partition_priority   = TFM_PRIORITY(HIGH),
+        .partition_init       = ipc_service_test_main,
+    },
+#endif /* TFM_PARTITION_TEST_CORE_IPC */
+
+#ifdef TFM_PARTITION_TEST_CORE_IPC
+    {
+        .partition_id         = TFM_SP_IPC_CLIENT_TEST_ID,
+        .partition_flags      = SPM_PART_FLAG_IPC
+                              | SPM_PART_FLAG_APP_ROT
+                              ,
+        .partition_priority   = TFM_PRIORITY(NORMAL),
+        .partition_init       = ipc_client_test_main,
+    },
+#endif /* TFM_PARTITION_TEST_CORE_IPC */
+
+#ifdef TFM_ENABLE_IRQ_TEST
+    {
+        .partition_id         = TFM_IRQ_TEST_1_ID,
+        .partition_flags      = SPM_PART_FLAG_IPC
+                              | SPM_PART_FLAG_APP_ROT
+                              ,
+        .partition_priority   = TFM_PRIORITY(NORMAL),
+        .partition_init       = tfm_irq_test_1_init,
+    },
+#endif /* TFM_ENABLE_IRQ_TEST */
+
+};
+
+/**************************************************************************/
+/** The platform data of the partition list */
+/**************************************************************************/
+const struct tfm_spm_partition_platform_data_t *platform_data_list[] =
+{
+    NULL,
+
+#ifndef TFM_PSA_API
+    NULL,
+#endif
+
+    NULL,
+
+#ifdef TFM_PARTITION_AUDIT_LOG
+    /* FIXME: Only adding the first mmio region */
+#ifdef AUDIT_UART_REDIRECTION
+    TFM_PERIPHERAL_UART1,
+#else /* AUDIT_UART_REDIRECTION */
+    NULL,
+#endif /* AUDIT_UART_REDIRECTION */
+#endif /* TFM_PARTITION_AUDIT_LOG */
+
+    NULL,
+
+#ifdef TFM_PARTITION_PLATFORM
+    NULL,
+#endif /* TFM_PARTITION_PLATFORM */
+
+    NULL,
+
+#ifdef TFM_PARTITION_TEST_CORE
+    /* FIXME: Only adding the first mmio region */
+    TFM_PERIPHERAL_FPGA_IO,
+#endif /* TFM_PARTITION_TEST_CORE */
+
+#ifdef TFM_PARTITION_TEST_CORE
+    NULL,
+#endif /* TFM_PARTITION_TEST_CORE */
+
+#ifdef TFM_PARTITION_TEST_SECURE_SERVICES
+    /* FIXME: Only adding the first mmio region */
+    TFM_PERIPHERAL_STD_UART,
+#endif /* TFM_PARTITION_TEST_SECURE_SERVICES */
+
+#ifdef TFM_PARTITION_TEST_CORE_IPC
+    NULL,
+#endif /* TFM_PARTITION_TEST_CORE_IPC */
+
+#ifdef TFM_PARTITION_TEST_CORE_IPC
+    NULL,
+#endif /* TFM_PARTITION_TEST_CORE_IPC */
+
+#ifdef TFM_ENABLE_IRQ_TEST
+    /* FIXME: Only adding the first mmio region */
+    TFM_PERIPHERAL_TIMER0,
+#endif /* TFM_ENABLE_IRQ_TEST */
+
+};
+
+/**************************************************************************/
+/** The memory data of the partition list */
+/**************************************************************************/
+#ifdef TFM_PSA_API
+const struct tfm_spm_partition_memory_data_t memory_data_list[] =
+{
+    {
+        .stack_bottom         = PART_REGION_ADDR(ARM_LIB_STACK, $$ZI$$Base),
+        .stack_top            = PART_REGION_ADDR(ARM_LIB_STACK, $$ZI$$Limit),
+        .rw_start             = PART_REGION_ADDR(ARM_LIB_STACK, $$ZI$$Base),
+    },
+    {
+        .code_start           = PART_REGION_ADDR(TFM_SP_STORAGE, $$Base),
+        .code_limit           = PART_REGION_ADDR(TFM_SP_STORAGE, $$Limit),
+        .ro_start             = PART_REGION_ADDR(TFM_SP_STORAGE, $$RO$$Base),
+        .ro_limit             = PART_REGION_ADDR(TFM_SP_STORAGE, $$RO$$Limit),
+        .rw_start             = PART_REGION_ADDR(TFM_SP_STORAGE, _DATA$$RW$$Base),
+        .rw_limit             = PART_REGION_ADDR(TFM_SP_STORAGE, _DATA$$RW$$Limit),
+        .zi_start             = PART_REGION_ADDR(TFM_SP_STORAGE, _DATA$$ZI$$Base),
+        .zi_limit             = PART_REGION_ADDR(TFM_SP_STORAGE, _DATA$$ZI$$Limit),
+        .stack_bottom         = PART_REGION_ADDR(TFM_SP_STORAGE, _STACK$$ZI$$Base),
+        .stack_top            = PART_REGION_ADDR(TFM_SP_STORAGE, _STACK$$ZI$$Limit),
+    },
+
+#ifdef TFM_PARTITION_AUDIT_LOG
+    {
+        .code_start           = PART_REGION_ADDR(TFM_SP_AUDIT_LOG, $$Base),
+        .code_limit           = PART_REGION_ADDR(TFM_SP_AUDIT_LOG, $$Limit),
+        .ro_start             = PART_REGION_ADDR(TFM_SP_AUDIT_LOG, $$RO$$Base),
+        .ro_limit             = PART_REGION_ADDR(TFM_SP_AUDIT_LOG, $$RO$$Limit),
+        .rw_start             = PART_REGION_ADDR(TFM_SP_AUDIT_LOG, _DATA$$RW$$Base),
+        .rw_limit             = PART_REGION_ADDR(TFM_SP_AUDIT_LOG, _DATA$$RW$$Limit),
+        .zi_start             = PART_REGION_ADDR(TFM_SP_AUDIT_LOG, _DATA$$ZI$$Base),
+        .zi_limit             = PART_REGION_ADDR(TFM_SP_AUDIT_LOG, _DATA$$ZI$$Limit),
+        .stack_bottom         = PART_REGION_ADDR(TFM_SP_AUDIT_LOG, _STACK$$ZI$$Base),
+        .stack_top            = PART_REGION_ADDR(TFM_SP_AUDIT_LOG, _STACK$$ZI$$Limit),
+    },
+#endif /* TFM_PARTITION_AUDIT_LOG */
+
+    {
+        .code_start           = PART_REGION_ADDR(TFM_SP_CRYPTO, $$Base),
+        .code_limit           = PART_REGION_ADDR(TFM_SP_CRYPTO, $$Limit),
+        .ro_start             = PART_REGION_ADDR(TFM_SP_CRYPTO, $$RO$$Base),
+        .ro_limit             = PART_REGION_ADDR(TFM_SP_CRYPTO, $$RO$$Limit),
+        .rw_start             = PART_REGION_ADDR(TFM_SP_CRYPTO, _DATA$$RW$$Base),
+        .rw_limit             = PART_REGION_ADDR(TFM_SP_CRYPTO, _DATA$$RW$$Limit),
+        .zi_start             = PART_REGION_ADDR(TFM_SP_CRYPTO, _DATA$$ZI$$Base),
+        .zi_limit             = PART_REGION_ADDR(TFM_SP_CRYPTO, _DATA$$ZI$$Limit),
+        .stack_bottom         = PART_REGION_ADDR(TFM_SP_CRYPTO, _STACK$$ZI$$Base),
+        .stack_top            = PART_REGION_ADDR(TFM_SP_CRYPTO, _STACK$$ZI$$Limit),
+    },
+
+#ifdef TFM_PARTITION_PLATFORM
+    {
+        .code_start           = PART_REGION_ADDR(TFM_SP_PLATFORM, $$Base),
+        .code_limit           = PART_REGION_ADDR(TFM_SP_PLATFORM, $$Limit),
+        .ro_start             = PART_REGION_ADDR(TFM_SP_PLATFORM, $$RO$$Base),
+        .ro_limit             = PART_REGION_ADDR(TFM_SP_PLATFORM, $$RO$$Limit),
+        .rw_start             = PART_REGION_ADDR(TFM_SP_PLATFORM, _DATA$$RW$$Base),
+        .rw_limit             = PART_REGION_ADDR(TFM_SP_PLATFORM, _DATA$$RW$$Limit),
+        .zi_start             = PART_REGION_ADDR(TFM_SP_PLATFORM, _DATA$$ZI$$Base),
+        .zi_limit             = PART_REGION_ADDR(TFM_SP_PLATFORM, _DATA$$ZI$$Limit),
+        .stack_bottom         = PART_REGION_ADDR(TFM_SP_PLATFORM, _STACK$$ZI$$Base),
+        .stack_top            = PART_REGION_ADDR(TFM_SP_PLATFORM, _STACK$$ZI$$Limit),
+    },
+#endif /* TFM_PARTITION_PLATFORM */
+
+    {
+        .code_start           = PART_REGION_ADDR(TFM_SP_INITIAL_ATTESTATION, $$Base),
+        .code_limit           = PART_REGION_ADDR(TFM_SP_INITIAL_ATTESTATION, $$Limit),
+        .ro_start             = PART_REGION_ADDR(TFM_SP_INITIAL_ATTESTATION, $$RO$$Base),
+        .ro_limit             = PART_REGION_ADDR(TFM_SP_INITIAL_ATTESTATION, $$RO$$Limit),
+        .rw_start             = PART_REGION_ADDR(TFM_SP_INITIAL_ATTESTATION, _DATA$$RW$$Base),
+        .rw_limit             = PART_REGION_ADDR(TFM_SP_INITIAL_ATTESTATION, _DATA$$RW$$Limit),
+        .zi_start             = PART_REGION_ADDR(TFM_SP_INITIAL_ATTESTATION, _DATA$$ZI$$Base),
+        .zi_limit             = PART_REGION_ADDR(TFM_SP_INITIAL_ATTESTATION, _DATA$$ZI$$Limit),
+        .stack_bottom         = PART_REGION_ADDR(TFM_SP_INITIAL_ATTESTATION, _STACK$$ZI$$Base),
+        .stack_top            = PART_REGION_ADDR(TFM_SP_INITIAL_ATTESTATION, _STACK$$ZI$$Limit),
+    },
+
+#ifdef TFM_PARTITION_TEST_CORE
+    {
+        .code_start           = PART_REGION_ADDR(TFM_SP_CORE_TEST, $$Base),
+        .code_limit           = PART_REGION_ADDR(TFM_SP_CORE_TEST, $$Limit),
+        .ro_start             = PART_REGION_ADDR(TFM_SP_CORE_TEST, $$RO$$Base),
+        .ro_limit             = PART_REGION_ADDR(TFM_SP_CORE_TEST, $$RO$$Limit),
+        .rw_start             = PART_REGION_ADDR(TFM_SP_CORE_TEST, _DATA$$RW$$Base),
+        .rw_limit             = PART_REGION_ADDR(TFM_SP_CORE_TEST, _DATA$$RW$$Limit),
+        .zi_start             = PART_REGION_ADDR(TFM_SP_CORE_TEST, _DATA$$ZI$$Base),
+        .zi_limit             = PART_REGION_ADDR(TFM_SP_CORE_TEST, _DATA$$ZI$$Limit),
+        .stack_bottom         = PART_REGION_ADDR(TFM_SP_CORE_TEST, _STACK$$ZI$$Base),
+        .stack_top            = PART_REGION_ADDR(TFM_SP_CORE_TEST, _STACK$$ZI$$Limit),
+    },
+#endif /* TFM_PARTITION_TEST_CORE */
+
+#ifdef TFM_PARTITION_TEST_CORE
+    {
+        .code_start           = PART_REGION_ADDR(TFM_SP_CORE_TEST_2, $$Base),
+        .code_limit           = PART_REGION_ADDR(TFM_SP_CORE_TEST_2, $$Limit),
+        .ro_start             = PART_REGION_ADDR(TFM_SP_CORE_TEST_2, $$RO$$Base),
+        .ro_limit             = PART_REGION_ADDR(TFM_SP_CORE_TEST_2, $$RO$$Limit),
+        .rw_start             = PART_REGION_ADDR(TFM_SP_CORE_TEST_2, _DATA$$RW$$Base),
+        .rw_limit             = PART_REGION_ADDR(TFM_SP_CORE_TEST_2, _DATA$$RW$$Limit),
+        .zi_start             = PART_REGION_ADDR(TFM_SP_CORE_TEST_2, _DATA$$ZI$$Base),
+        .zi_limit             = PART_REGION_ADDR(TFM_SP_CORE_TEST_2, _DATA$$ZI$$Limit),
+        .stack_bottom         = PART_REGION_ADDR(TFM_SP_CORE_TEST_2, _STACK$$ZI$$Base),
+        .stack_top            = PART_REGION_ADDR(TFM_SP_CORE_TEST_2, _STACK$$ZI$$Limit),
+    },
+#endif /* TFM_PARTITION_TEST_CORE */
+
+#ifdef TFM_PARTITION_TEST_SECURE_SERVICES
+    {
+        .code_start           = PART_REGION_ADDR(TFM_SP_SECURE_TEST_PARTITION, $$Base),
+        .code_limit           = PART_REGION_ADDR(TFM_SP_SECURE_TEST_PARTITION, $$Limit),
+        .ro_start             = PART_REGION_ADDR(TFM_SP_SECURE_TEST_PARTITION, $$RO$$Base),
+        .ro_limit             = PART_REGION_ADDR(TFM_SP_SECURE_TEST_PARTITION, $$RO$$Limit),
+        .rw_start             = PART_REGION_ADDR(TFM_SP_SECURE_TEST_PARTITION, _DATA$$RW$$Base),
+        .rw_limit             = PART_REGION_ADDR(TFM_SP_SECURE_TEST_PARTITION, _DATA$$RW$$Limit),
+        .zi_start             = PART_REGION_ADDR(TFM_SP_SECURE_TEST_PARTITION, _DATA$$ZI$$Base),
+        .zi_limit             = PART_REGION_ADDR(TFM_SP_SECURE_TEST_PARTITION, _DATA$$ZI$$Limit),
+        .stack_bottom         = PART_REGION_ADDR(TFM_SP_SECURE_TEST_PARTITION, _STACK$$ZI$$Base),
+        .stack_top            = PART_REGION_ADDR(TFM_SP_SECURE_TEST_PARTITION, _STACK$$ZI$$Limit),
+    },
+#endif /* TFM_PARTITION_TEST_SECURE_SERVICES */
+
+#ifdef TFM_PARTITION_TEST_CORE_IPC
+    {
+        .code_start           = PART_REGION_ADDR(TFM_SP_IPC_SERVICE_TEST, $$Base),
+        .code_limit           = PART_REGION_ADDR(TFM_SP_IPC_SERVICE_TEST, $$Limit),
+        .ro_start             = PART_REGION_ADDR(TFM_SP_IPC_SERVICE_TEST, $$RO$$Base),
+        .ro_limit             = PART_REGION_ADDR(TFM_SP_IPC_SERVICE_TEST, $$RO$$Limit),
+        .rw_start             = PART_REGION_ADDR(TFM_SP_IPC_SERVICE_TEST, _DATA$$RW$$Base),
+        .rw_limit             = PART_REGION_ADDR(TFM_SP_IPC_SERVICE_TEST, _DATA$$RW$$Limit),
+        .zi_start             = PART_REGION_ADDR(TFM_SP_IPC_SERVICE_TEST, _DATA$$ZI$$Base),
+        .zi_limit             = PART_REGION_ADDR(TFM_SP_IPC_SERVICE_TEST, _DATA$$ZI$$Limit),
+        .stack_bottom         = PART_REGION_ADDR(TFM_SP_IPC_SERVICE_TEST, _STACK$$ZI$$Base),
+        .stack_top            = PART_REGION_ADDR(TFM_SP_IPC_SERVICE_TEST, _STACK$$ZI$$Limit),
+    },
+#endif /* TFM_PARTITION_TEST_CORE_IPC */
+
+#ifdef TFM_PARTITION_TEST_CORE_IPC
+    {
+        .code_start           = PART_REGION_ADDR(TFM_SP_IPC_CLIENT_TEST, $$Base),
+        .code_limit           = PART_REGION_ADDR(TFM_SP_IPC_CLIENT_TEST, $$Limit),
+        .ro_start             = PART_REGION_ADDR(TFM_SP_IPC_CLIENT_TEST, $$RO$$Base),
+        .ro_limit             = PART_REGION_ADDR(TFM_SP_IPC_CLIENT_TEST, $$RO$$Limit),
+        .rw_start             = PART_REGION_ADDR(TFM_SP_IPC_CLIENT_TEST, _DATA$$RW$$Base),
+        .rw_limit             = PART_REGION_ADDR(TFM_SP_IPC_CLIENT_TEST, _DATA$$RW$$Limit),
+        .zi_start             = PART_REGION_ADDR(TFM_SP_IPC_CLIENT_TEST, _DATA$$ZI$$Base),
+        .zi_limit             = PART_REGION_ADDR(TFM_SP_IPC_CLIENT_TEST, _DATA$$ZI$$Limit),
+        .stack_bottom         = PART_REGION_ADDR(TFM_SP_IPC_CLIENT_TEST, _STACK$$ZI$$Base),
+        .stack_top            = PART_REGION_ADDR(TFM_SP_IPC_CLIENT_TEST, _STACK$$ZI$$Limit),
+    },
+#endif /* TFM_PARTITION_TEST_CORE_IPC */
+
+#ifdef TFM_ENABLE_IRQ_TEST
+    {
+        .code_start           = PART_REGION_ADDR(TFM_IRQ_TEST_1, $$Base),
+        .code_limit           = PART_REGION_ADDR(TFM_IRQ_TEST_1, $$Limit),
+        .ro_start             = PART_REGION_ADDR(TFM_IRQ_TEST_1, $$RO$$Base),
+        .ro_limit             = PART_REGION_ADDR(TFM_IRQ_TEST_1, $$RO$$Limit),
+        .rw_start             = PART_REGION_ADDR(TFM_IRQ_TEST_1, _DATA$$RW$$Base),
+        .rw_limit             = PART_REGION_ADDR(TFM_IRQ_TEST_1, _DATA$$RW$$Limit),
+        .zi_start             = PART_REGION_ADDR(TFM_IRQ_TEST_1, _DATA$$ZI$$Base),
+        .zi_limit             = PART_REGION_ADDR(TFM_IRQ_TEST_1, _DATA$$ZI$$Limit),
+        .stack_bottom         = PART_REGION_ADDR(TFM_IRQ_TEST_1, _STACK$$ZI$$Base),
+        .stack_top            = PART_REGION_ADDR(TFM_IRQ_TEST_1, _STACK$$ZI$$Limit),
+    },
+#endif /* TFM_ENABLE_IRQ_TEST */
+
+};
+#endif /* defined(TFM_PSA_API) */
+
+/**************************************************************************/
 /** The partition list for the DB */
 /**************************************************************************/
-struct spm_partition_desc_t partition_list [] =
+static struct spm_partition_desc_t partition_list [] =
 {
-    {{0}}, /* placeholder for Non-secure internal partition */
+    {{}}, /* placeholder for Non-secure internal partition */
 #ifndef TFM_PSA_API
-    {{0}}, /* placeholder for TF-M Core internal partition */
+    {{}}, /* placeholder for TF-M Core internal partition */
 #endif /* !ifndefined(TFM_PSA_API) */
 
     /* -----------------------------------------------------------------------*/
     /* - Partition DB record for TFM_SP_STORAGE */
     /* -----------------------------------------------------------------------*/
     {
-    /* Static data */
-        {
-            .partition_id         = TFM_SP_STORAGE_ID,
-            .partition_flags      = SPM_PART_FLAG_IPC
-                                  | SPM_PART_FLAG_PSA_ROT | SPM_PART_FLAG_APP_ROT
-                                  ,
-            .partition_priority   = TFM_PRIORITY(NORMAL),
-            .partition_init       = tfm_sst_req_mngr_init,
-        },
-
     /* Runtime data */
-        {
-#ifndef TFM_PSA_API
-            .partition_state      = SPM_PARTITION_STATE_UNINIT,
-            .caller_partition_idx = SPM_INVALID_PARTITION_IDX,
-            .caller_client_id     = TFM_INVALID_CLIENT_ID,
-            .share                = TFM_BUFFER_SHARE_DISABLE,
-            .stack_ptr            = 0,
-            .lr                   = 0,
-            .iovec_api            = TFM_SFN_API_IOVEC,
-            .iovec_args           =
-                {
-                    .in_vec       = {{0}},
-                    .in_len       = 0,
-                    .out_vec      = {{0}},
-                    .out_len      = 0,
-                },
-            .orig_outvec          = NULL,
-            .ctx_stack_ptr        = ctx_stack_TFM_SP_STORAGE,
-#else /* !defined(TFM_PSA_API) */
-            .signal_evnt          =
-                {
-                    .magic        = 0,
-                    .owner        = NULL,
-                },
-            .signals              = 0,
-            .service_list         =
-                {
-                    .prev         = NULL,
-                    .next         = NULL,
-                },
-#endif /* !defined(TFM_PSA_API) */
-            .signal_mask          = 0,
-        },
-
+        .runtime_data             = {},
+        .static_data              = NULL,
         .platform_data            = NULL,
 
-#ifdef TFM_PSA_API
-    /* memory_data */
-        .memory_data = {
-            .code_start           = PART_REGION_ADDR(TFM_SP_STORAGE, $$Base),
-            .code_limit           = PART_REGION_ADDR(TFM_SP_STORAGE, $$Limit),
-            .ro_start             = PART_REGION_ADDR(TFM_SP_STORAGE, $$RO$$Base),
-            .ro_limit             = PART_REGION_ADDR(TFM_SP_STORAGE, $$RO$$Limit),
-            .rw_start             = PART_REGION_ADDR(TFM_SP_STORAGE, _DATA$$RW$$Base),
-            .rw_limit             = PART_REGION_ADDR(TFM_SP_STORAGE, _DATA$$RW$$Limit),
-            .zi_start             = PART_REGION_ADDR(TFM_SP_STORAGE, _DATA$$ZI$$Base),
-            .zi_limit             = PART_REGION_ADDR(TFM_SP_STORAGE, _DATA$$ZI$$Limit),
-            .stack_bottom         = PART_REGION_ADDR(TFM_SP_STORAGE, _STACK$$ZI$$Base),
-            .stack_top            = PART_REGION_ADDR(TFM_SP_STORAGE, _STACK$$ZI$$Limit),
-        },
-
-    /* sp_thrd */
-        .sp_thrd = {
-                .pfn              = NULL,
-                .param            = NULL,
-                .sp_btm           = 0,
-                .sp_top           = 0,
-                .prior            = THRD_PRIOR_LOWEST,
-                .status           = THRD_STAT_INVALID,
-                .state_ctx        =
-                {
-                    .ctxb         = {0}, /* Fields are not detailed as they are architecture dependent*/
-                },
-                .next             = NULL,
-        },
-#endif /* defined(TFM_PSA_API) */
     },
 
     /* -----------------------------------------------------------------------*/
@@ -440,89 +789,11 @@
     /* -----------------------------------------------------------------------*/
 #ifdef TFM_PARTITION_AUDIT_LOG
     {
-    /* Static data */
-        {
-            .partition_id         = TFM_SP_AUDIT_LOG_ID,
-            .partition_flags      = 0
-                                  | SPM_PART_FLAG_PSA_ROT | SPM_PART_FLAG_APP_ROT
-                                  ,
-            .partition_priority   = TFM_PRIORITY(NORMAL),
-            .partition_init       = audit_core_init,
-        },
-
     /* Runtime data */
-        {
-#ifndef TFM_PSA_API
-            .partition_state      = SPM_PARTITION_STATE_UNINIT,
-            .caller_partition_idx = SPM_INVALID_PARTITION_IDX,
-            .caller_client_id     = TFM_INVALID_CLIENT_ID,
-            .share                = TFM_BUFFER_SHARE_DISABLE,
-            .stack_ptr            = 0,
-            .lr                   = 0,
-            .iovec_api            = TFM_SFN_API_IOVEC,
-            .iovec_args           =
-                {
-                    .in_vec       = {{0}},
-                    .in_len       = 0,
-                    .out_vec      = {{0}},
-                    .out_len      = 0,
-                },
-            .orig_outvec          = NULL,
-            .ctx_stack_ptr        = ctx_stack_TFM_SP_AUDIT_LOG,
-#else /* !defined(TFM_PSA_API) */
-            .signal_evnt          =
-                {
-                    .magic        = 0,
-                    .owner        = NULL,
-                },
-            .signals              = 0,
-            .service_list         =
-                {
-                    .prev         = NULL,
-                    .next         = NULL,
-                },
-#endif /* !defined(TFM_PSA_API) */
-            .signal_mask          = 0,
-        },
-
-    /* platform data */
-        /* FIXME: Only adding the first mmio region */
-#ifdef AUDIT_UART_REDIRECTION
-        .platform_data            = TFM_PERIPHERAL_UART1,
-#else /* AUDIT_UART_REDIRECTION */
+        .runtime_data             = {},
+        .static_data              = NULL,
         .platform_data            = NULL,
-#endif /* AUDIT_UART_REDIRECTION */
 
-#ifdef TFM_PSA_API
-    /* memory_data */
-        .memory_data = {
-            .code_start           = PART_REGION_ADDR(TFM_SP_AUDIT_LOG, $$Base),
-            .code_limit           = PART_REGION_ADDR(TFM_SP_AUDIT_LOG, $$Limit),
-            .ro_start             = PART_REGION_ADDR(TFM_SP_AUDIT_LOG, $$RO$$Base),
-            .ro_limit             = PART_REGION_ADDR(TFM_SP_AUDIT_LOG, $$RO$$Limit),
-            .rw_start             = PART_REGION_ADDR(TFM_SP_AUDIT_LOG, _DATA$$RW$$Base),
-            .rw_limit             = PART_REGION_ADDR(TFM_SP_AUDIT_LOG, _DATA$$RW$$Limit),
-            .zi_start             = PART_REGION_ADDR(TFM_SP_AUDIT_LOG, _DATA$$ZI$$Base),
-            .zi_limit             = PART_REGION_ADDR(TFM_SP_AUDIT_LOG, _DATA$$ZI$$Limit),
-            .stack_bottom         = PART_REGION_ADDR(TFM_SP_AUDIT_LOG, _STACK$$ZI$$Base),
-            .stack_top            = PART_REGION_ADDR(TFM_SP_AUDIT_LOG, _STACK$$ZI$$Limit),
-        },
-
-    /* sp_thrd */
-        .sp_thrd = {
-                .pfn              = NULL,
-                .param            = NULL,
-                .sp_btm           = 0,
-                .sp_top           = 0,
-                .prior            = THRD_PRIOR_LOWEST,
-                .status           = THRD_STAT_INVALID,
-                .state_ctx        =
-                {
-                    .ctxb         = {0}, /* Fields are not detailed as they are architecture dependent*/
-                },
-                .next             = NULL,
-        },
-#endif /* defined(TFM_PSA_API) */
     },
 #endif /* TFM_PARTITION_AUDIT_LOG */
 
@@ -530,83 +801,11 @@
     /* - Partition DB record for TFM_SP_CRYPTO */
     /* -----------------------------------------------------------------------*/
     {
-    /* Static data */
-        {
-            .partition_id         = TFM_SP_CRYPTO_ID,
-            .partition_flags      = SPM_PART_FLAG_IPC
-                                  | SPM_PART_FLAG_PSA_ROT | SPM_PART_FLAG_APP_ROT
-                                  ,
-            .partition_priority   = TFM_PRIORITY(NORMAL),
-            .partition_init       = tfm_crypto_init,
-        },
-
     /* Runtime data */
-        {
-#ifndef TFM_PSA_API
-            .partition_state      = SPM_PARTITION_STATE_UNINIT,
-            .caller_partition_idx = SPM_INVALID_PARTITION_IDX,
-            .caller_client_id     = TFM_INVALID_CLIENT_ID,
-            .share                = TFM_BUFFER_SHARE_DISABLE,
-            .stack_ptr            = 0,
-            .lr                   = 0,
-            .iovec_api            = TFM_SFN_API_IOVEC,
-            .iovec_args           =
-                {
-                    .in_vec       = {{0}},
-                    .in_len       = 0,
-                    .out_vec      = {{0}},
-                    .out_len      = 0,
-                },
-            .orig_outvec          = NULL,
-            .ctx_stack_ptr        = ctx_stack_TFM_SP_CRYPTO,
-#else /* !defined(TFM_PSA_API) */
-            .signal_evnt          =
-                {
-                    .magic        = 0,
-                    .owner        = NULL,
-                },
-            .signals              = 0,
-            .service_list         =
-                {
-                    .prev         = NULL,
-                    .next         = NULL,
-                },
-#endif /* !defined(TFM_PSA_API) */
-            .signal_mask          = 0,
-        },
-
+        .runtime_data             = {},
+        .static_data              = NULL,
         .platform_data            = NULL,
 
-#ifdef TFM_PSA_API
-    /* memory_data */
-        .memory_data = {
-            .code_start           = PART_REGION_ADDR(TFM_SP_CRYPTO, $$Base),
-            .code_limit           = PART_REGION_ADDR(TFM_SP_CRYPTO, $$Limit),
-            .ro_start             = PART_REGION_ADDR(TFM_SP_CRYPTO, $$RO$$Base),
-            .ro_limit             = PART_REGION_ADDR(TFM_SP_CRYPTO, $$RO$$Limit),
-            .rw_start             = PART_REGION_ADDR(TFM_SP_CRYPTO, _DATA$$RW$$Base),
-            .rw_limit             = PART_REGION_ADDR(TFM_SP_CRYPTO, _DATA$$RW$$Limit),
-            .zi_start             = PART_REGION_ADDR(TFM_SP_CRYPTO, _DATA$$ZI$$Base),
-            .zi_limit             = PART_REGION_ADDR(TFM_SP_CRYPTO, _DATA$$ZI$$Limit),
-            .stack_bottom         = PART_REGION_ADDR(TFM_SP_CRYPTO, _STACK$$ZI$$Base),
-            .stack_top            = PART_REGION_ADDR(TFM_SP_CRYPTO, _STACK$$ZI$$Limit),
-        },
-
-    /* sp_thrd */
-        .sp_thrd = {
-                .pfn              = NULL,
-                .param            = NULL,
-                .sp_btm           = 0,
-                .sp_top           = 0,
-                .prior            = THRD_PRIOR_LOWEST,
-                .status           = THRD_STAT_INVALID,
-                .state_ctx        =
-                {
-                    .ctxb         = {0}, /* Fields are not detailed as they are architecture dependent*/
-                },
-                .next             = NULL,
-        },
-#endif /* defined(TFM_PSA_API) */
     },
 
     /* -----------------------------------------------------------------------*/
@@ -614,83 +813,11 @@
     /* -----------------------------------------------------------------------*/
 #ifdef TFM_PARTITION_PLATFORM
     {
-    /* Static data */
-        {
-            .partition_id         = TFM_SP_PLATFORM_ID,
-            .partition_flags      = 0
-                                  | SPM_PART_FLAG_PSA_ROT | SPM_PART_FLAG_APP_ROT
-                                  ,
-            .partition_priority   = TFM_PRIORITY(NORMAL),
-            .partition_init       = platform_sp_init,
-        },
-
     /* Runtime data */
-        {
-#ifndef TFM_PSA_API
-            .partition_state      = SPM_PARTITION_STATE_UNINIT,
-            .caller_partition_idx = SPM_INVALID_PARTITION_IDX,
-            .caller_client_id     = TFM_INVALID_CLIENT_ID,
-            .share                = TFM_BUFFER_SHARE_DISABLE,
-            .stack_ptr            = 0,
-            .lr                   = 0,
-            .iovec_api            = TFM_SFN_API_IOVEC,
-            .iovec_args           =
-                {
-                    .in_vec       = {{0}},
-                    .in_len       = 0,
-                    .out_vec      = {{0}},
-                    .out_len      = 0,
-                },
-            .orig_outvec          = NULL,
-            .ctx_stack_ptr        = ctx_stack_TFM_SP_PLATFORM,
-#else /* !defined(TFM_PSA_API) */
-            .signal_evnt          =
-                {
-                    .magic        = 0,
-                    .owner        = NULL,
-                },
-            .signals              = 0,
-            .service_list         =
-                {
-                    .prev         = NULL,
-                    .next         = NULL,
-                },
-#endif /* !defined(TFM_PSA_API) */
-            .signal_mask          = 0,
-        },
-
+        .runtime_data             = {},
+        .static_data              = NULL,
         .platform_data            = NULL,
 
-#ifdef TFM_PSA_API
-    /* memory_data */
-        .memory_data = {
-            .code_start           = PART_REGION_ADDR(TFM_SP_PLATFORM, $$Base),
-            .code_limit           = PART_REGION_ADDR(TFM_SP_PLATFORM, $$Limit),
-            .ro_start             = PART_REGION_ADDR(TFM_SP_PLATFORM, $$RO$$Base),
-            .ro_limit             = PART_REGION_ADDR(TFM_SP_PLATFORM, $$RO$$Limit),
-            .rw_start             = PART_REGION_ADDR(TFM_SP_PLATFORM, _DATA$$RW$$Base),
-            .rw_limit             = PART_REGION_ADDR(TFM_SP_PLATFORM, _DATA$$RW$$Limit),
-            .zi_start             = PART_REGION_ADDR(TFM_SP_PLATFORM, _DATA$$ZI$$Base),
-            .zi_limit             = PART_REGION_ADDR(TFM_SP_PLATFORM, _DATA$$ZI$$Limit),
-            .stack_bottom         = PART_REGION_ADDR(TFM_SP_PLATFORM, _STACK$$ZI$$Base),
-            .stack_top            = PART_REGION_ADDR(TFM_SP_PLATFORM, _STACK$$ZI$$Limit),
-        },
-
-    /* sp_thrd */
-        .sp_thrd = {
-                .pfn              = NULL,
-                .param            = NULL,
-                .sp_btm           = 0,
-                .sp_top           = 0,
-                .prior            = THRD_PRIOR_LOWEST,
-                .status           = THRD_STAT_INVALID,
-                .state_ctx        =
-                {
-                    .ctxb         = {0}, /* Fields are not detailed as they are architecture dependent*/
-                },
-                .next             = NULL,
-        },
-#endif /* defined(TFM_PSA_API) */
     },
 #endif /* TFM_PARTITION_PLATFORM */
 
@@ -698,83 +825,11 @@
     /* - Partition DB record for TFM_SP_INITIAL_ATTESTATION */
     /* -----------------------------------------------------------------------*/
     {
-    /* Static data */
-        {
-            .partition_id         = TFM_SP_INITIAL_ATTESTATION_ID,
-            .partition_flags      = SPM_PART_FLAG_IPC
-                                  | SPM_PART_FLAG_PSA_ROT | SPM_PART_FLAG_APP_ROT
-                                  ,
-            .partition_priority   = TFM_PRIORITY(NORMAL),
-            .partition_init       = attest_partition_init,
-        },
-
     /* Runtime data */
-        {
-#ifndef TFM_PSA_API
-            .partition_state      = SPM_PARTITION_STATE_UNINIT,
-            .caller_partition_idx = SPM_INVALID_PARTITION_IDX,
-            .caller_client_id     = TFM_INVALID_CLIENT_ID,
-            .share                = TFM_BUFFER_SHARE_DISABLE,
-            .stack_ptr            = 0,
-            .lr                   = 0,
-            .iovec_api            = TFM_SFN_API_IOVEC,
-            .iovec_args           =
-                {
-                    .in_vec       = {{0}},
-                    .in_len       = 0,
-                    .out_vec      = {{0}},
-                    .out_len      = 0,
-                },
-            .orig_outvec          = NULL,
-            .ctx_stack_ptr        = ctx_stack_TFM_SP_INITIAL_ATTESTATION,
-#else /* !defined(TFM_PSA_API) */
-            .signal_evnt          =
-                {
-                    .magic        = 0,
-                    .owner        = NULL,
-                },
-            .signals              = 0,
-            .service_list         =
-                {
-                    .prev         = NULL,
-                    .next         = NULL,
-                },
-#endif /* !defined(TFM_PSA_API) */
-            .signal_mask          = 0,
-        },
-
+        .runtime_data             = {},
+        .static_data              = NULL,
         .platform_data            = NULL,
 
-#ifdef TFM_PSA_API
-    /* memory_data */
-        .memory_data = {
-            .code_start           = PART_REGION_ADDR(TFM_SP_INITIAL_ATTESTATION, $$Base),
-            .code_limit           = PART_REGION_ADDR(TFM_SP_INITIAL_ATTESTATION, $$Limit),
-            .ro_start             = PART_REGION_ADDR(TFM_SP_INITIAL_ATTESTATION, $$RO$$Base),
-            .ro_limit             = PART_REGION_ADDR(TFM_SP_INITIAL_ATTESTATION, $$RO$$Limit),
-            .rw_start             = PART_REGION_ADDR(TFM_SP_INITIAL_ATTESTATION, _DATA$$RW$$Base),
-            .rw_limit             = PART_REGION_ADDR(TFM_SP_INITIAL_ATTESTATION, _DATA$$RW$$Limit),
-            .zi_start             = PART_REGION_ADDR(TFM_SP_INITIAL_ATTESTATION, _DATA$$ZI$$Base),
-            .zi_limit             = PART_REGION_ADDR(TFM_SP_INITIAL_ATTESTATION, _DATA$$ZI$$Limit),
-            .stack_bottom         = PART_REGION_ADDR(TFM_SP_INITIAL_ATTESTATION, _STACK$$ZI$$Base),
-            .stack_top            = PART_REGION_ADDR(TFM_SP_INITIAL_ATTESTATION, _STACK$$ZI$$Limit),
-        },
-
-    /* sp_thrd */
-        .sp_thrd = {
-                .pfn              = NULL,
-                .param            = NULL,
-                .sp_btm           = 0,
-                .sp_top           = 0,
-                .prior            = THRD_PRIOR_LOWEST,
-                .status           = THRD_STAT_INVALID,
-                .state_ctx        =
-                {
-                    .ctxb         = {0}, /* Fields are not detailed as they are architecture dependent*/
-                },
-                .next             = NULL,
-        },
-#endif /* defined(TFM_PSA_API) */
     },
 
     /* -----------------------------------------------------------------------*/
@@ -782,85 +837,11 @@
     /* -----------------------------------------------------------------------*/
 #ifdef TFM_PARTITION_TEST_CORE
     {
-    /* Static data */
-        {
-            .partition_id         = TFM_SP_CORE_TEST_ID,
-            .partition_flags      = SPM_PART_FLAG_IPC
-                                  | SPM_PART_FLAG_APP_ROT
-                                  ,
-            .partition_priority   = TFM_PRIORITY(NORMAL),
-            .partition_init       = core_test_init,
-        },
-
     /* Runtime data */
-        {
-#ifndef TFM_PSA_API
-            .partition_state      = SPM_PARTITION_STATE_UNINIT,
-            .caller_partition_idx = SPM_INVALID_PARTITION_IDX,
-            .caller_client_id     = TFM_INVALID_CLIENT_ID,
-            .share                = TFM_BUFFER_SHARE_DISABLE,
-            .stack_ptr            = 0,
-            .lr                   = 0,
-            .iovec_api            = TFM_SFN_API_IOVEC,
-            .iovec_args           =
-                {
-                    .in_vec       = {{0}},
-                    .in_len       = 0,
-                    .out_vec      = {{0}},
-                    .out_len      = 0,
-                },
-            .orig_outvec          = NULL,
-            .ctx_stack_ptr        = ctx_stack_TFM_SP_CORE_TEST,
-#else /* !defined(TFM_PSA_API) */
-            .signal_evnt          =
-                {
-                    .magic        = 0,
-                    .owner        = NULL,
-                },
-            .signals              = 0,
-            .service_list         =
-                {
-                    .prev         = NULL,
-                    .next         = NULL,
-                },
-#endif /* !defined(TFM_PSA_API) */
-            .signal_mask          = 0,
-        },
+        .runtime_data             = {},
+        .static_data              = NULL,
+        .platform_data            = NULL,
 
-    /* platform data */
-        /* FIXME: Only adding the first mmio region */
-        .platform_data            = TFM_PERIPHERAL_FPGA_IO,
-
-#ifdef TFM_PSA_API
-    /* memory_data */
-        .memory_data = {
-            .code_start           = PART_REGION_ADDR(TFM_SP_CORE_TEST, $$Base),
-            .code_limit           = PART_REGION_ADDR(TFM_SP_CORE_TEST, $$Limit),
-            .ro_start             = PART_REGION_ADDR(TFM_SP_CORE_TEST, $$RO$$Base),
-            .ro_limit             = PART_REGION_ADDR(TFM_SP_CORE_TEST, $$RO$$Limit),
-            .rw_start             = PART_REGION_ADDR(TFM_SP_CORE_TEST, _DATA$$RW$$Base),
-            .rw_limit             = PART_REGION_ADDR(TFM_SP_CORE_TEST, _DATA$$RW$$Limit),
-            .zi_start             = PART_REGION_ADDR(TFM_SP_CORE_TEST, _DATA$$ZI$$Base),
-            .zi_limit             = PART_REGION_ADDR(TFM_SP_CORE_TEST, _DATA$$ZI$$Limit),
-            .stack_bottom         = PART_REGION_ADDR(TFM_SP_CORE_TEST, _STACK$$ZI$$Base),
-            .stack_top            = PART_REGION_ADDR(TFM_SP_CORE_TEST, _STACK$$ZI$$Limit),
-        },
-
-    /* sp_thrd */
-        .sp_thrd = {
-                .pfn              = NULL,
-                .param            = NULL,
-                .sp_btm           = 0,
-                .sp_top           = 0,
-                .prior            = THRD_PRIOR_LOWEST,
-                .status           = THRD_STAT_INVALID,
-                .state_ctx        =
-                {
-                    .ctxb         = {0}, /* Fields are not detailed as they are architecture dependent*/
-                },
-                .next             = NULL,
-        },
-#endif /* defined(TFM_PSA_API) */
     },
 #endif /* TFM_PARTITION_TEST_CORE */
 
@@ -869,83 +850,11 @@
     /* -----------------------------------------------------------------------*/
 #ifdef TFM_PARTITION_TEST_CORE
     {
-    /* Static data */
-        {
-            .partition_id         = TFM_SP_CORE_TEST_2_ID,
-            .partition_flags      = SPM_PART_FLAG_IPC
-                                  | SPM_PART_FLAG_APP_ROT
-                                  ,
-            .partition_priority   = TFM_PRIORITY(NORMAL),
-            .partition_init       = core_test_2_init,
-        },
-
     /* Runtime data */
-        {
-#ifndef TFM_PSA_API
-            .partition_state      = SPM_PARTITION_STATE_UNINIT,
-            .caller_partition_idx = SPM_INVALID_PARTITION_IDX,
-            .caller_client_id     = TFM_INVALID_CLIENT_ID,
-            .share                = TFM_BUFFER_SHARE_DISABLE,
-            .stack_ptr            = 0,
-            .lr                   = 0,
-            .iovec_api            = TFM_SFN_API_IOVEC,
-            .iovec_args           =
-                {
-                    .in_vec       = {{0}},
-                    .in_len       = 0,
-                    .out_vec      = {{0}},
-                    .out_len      = 0,
-                },
-            .orig_outvec          = NULL,
-            .ctx_stack_ptr        = ctx_stack_TFM_SP_CORE_TEST_2,
-#else /* !defined(TFM_PSA_API) */
-            .signal_evnt          =
-                {
-                    .magic        = 0,
-                    .owner        = NULL,
-                },
-            .signals              = 0,
-            .service_list         =
-                {
-                    .prev         = NULL,
-                    .next         = NULL,
-                },
-#endif /* !defined(TFM_PSA_API) */
-            .signal_mask          = 0,
-        },
-
+        .runtime_data             = {},
+        .static_data              = NULL,
         .platform_data            = NULL,
 
-#ifdef TFM_PSA_API
-    /* memory_data */
-        .memory_data = {
-            .code_start           = PART_REGION_ADDR(TFM_SP_CORE_TEST_2, $$Base),
-            .code_limit           = PART_REGION_ADDR(TFM_SP_CORE_TEST_2, $$Limit),
-            .ro_start             = PART_REGION_ADDR(TFM_SP_CORE_TEST_2, $$RO$$Base),
-            .ro_limit             = PART_REGION_ADDR(TFM_SP_CORE_TEST_2, $$RO$$Limit),
-            .rw_start             = PART_REGION_ADDR(TFM_SP_CORE_TEST_2, _DATA$$RW$$Base),
-            .rw_limit             = PART_REGION_ADDR(TFM_SP_CORE_TEST_2, _DATA$$RW$$Limit),
-            .zi_start             = PART_REGION_ADDR(TFM_SP_CORE_TEST_2, _DATA$$ZI$$Base),
-            .zi_limit             = PART_REGION_ADDR(TFM_SP_CORE_TEST_2, _DATA$$ZI$$Limit),
-            .stack_bottom         = PART_REGION_ADDR(TFM_SP_CORE_TEST_2, _STACK$$ZI$$Base),
-            .stack_top            = PART_REGION_ADDR(TFM_SP_CORE_TEST_2, _STACK$$ZI$$Limit),
-        },
-
-    /* sp_thrd */
-        .sp_thrd = {
-                .pfn              = NULL,
-                .param            = NULL,
-                .sp_btm           = 0,
-                .sp_top           = 0,
-                .prior            = THRD_PRIOR_LOWEST,
-                .status           = THRD_STAT_INVALID,
-                .state_ctx        =
-                {
-                    .ctxb         = {0}, /* Fields are not detailed as they are architecture dependent*/
-                },
-                .next             = NULL,
-        },
-#endif /* defined(TFM_PSA_API) */
     },
 #endif /* TFM_PARTITION_TEST_CORE */
 
@@ -954,85 +863,11 @@
     /* -----------------------------------------------------------------------*/
 #ifdef TFM_PARTITION_TEST_SECURE_SERVICES
     {
-    /* Static data */
-        {
-            .partition_id         = TFM_SP_SECURE_TEST_PARTITION_ID,
-            .partition_flags      = SPM_PART_FLAG_IPC
-                                  | SPM_PART_FLAG_PSA_ROT | SPM_PART_FLAG_APP_ROT
-                                  ,
-            .partition_priority   = TFM_PRIORITY(NORMAL),
-            .partition_init       = tfm_secure_client_service_init,
-        },
-
     /* Runtime data */
-        {
-#ifndef TFM_PSA_API
-            .partition_state      = SPM_PARTITION_STATE_UNINIT,
-            .caller_partition_idx = SPM_INVALID_PARTITION_IDX,
-            .caller_client_id     = TFM_INVALID_CLIENT_ID,
-            .share                = TFM_BUFFER_SHARE_DISABLE,
-            .stack_ptr            = 0,
-            .lr                   = 0,
-            .iovec_api            = TFM_SFN_API_IOVEC,
-            .iovec_args           =
-                {
-                    .in_vec       = {{0}},
-                    .in_len       = 0,
-                    .out_vec      = {{0}},
-                    .out_len      = 0,
-                },
-            .orig_outvec          = NULL,
-            .ctx_stack_ptr        = ctx_stack_TFM_SP_SECURE_TEST_PARTITION,
-#else /* !defined(TFM_PSA_API) */
-            .signal_evnt          =
-                {
-                    .magic        = 0,
-                    .owner        = NULL,
-                },
-            .signals              = 0,
-            .service_list         =
-                {
-                    .prev         = NULL,
-                    .next         = NULL,
-                },
-#endif /* !defined(TFM_PSA_API) */
-            .signal_mask          = 0,
-        },
+        .runtime_data             = {},
+        .static_data              = NULL,
+        .platform_data            = NULL,
 
-    /* platform data */
-        /* FIXME: Only adding the first mmio region */
-        .platform_data            = TFM_PERIPHERAL_STD_UART,
-
-#ifdef TFM_PSA_API
-    /* memory_data */
-        .memory_data = {
-            .code_start           = PART_REGION_ADDR(TFM_SP_SECURE_TEST_PARTITION, $$Base),
-            .code_limit           = PART_REGION_ADDR(TFM_SP_SECURE_TEST_PARTITION, $$Limit),
-            .ro_start             = PART_REGION_ADDR(TFM_SP_SECURE_TEST_PARTITION, $$RO$$Base),
-            .ro_limit             = PART_REGION_ADDR(TFM_SP_SECURE_TEST_PARTITION, $$RO$$Limit),
-            .rw_start             = PART_REGION_ADDR(TFM_SP_SECURE_TEST_PARTITION, _DATA$$RW$$Base),
-            .rw_limit             = PART_REGION_ADDR(TFM_SP_SECURE_TEST_PARTITION, _DATA$$RW$$Limit),
-            .zi_start             = PART_REGION_ADDR(TFM_SP_SECURE_TEST_PARTITION, _DATA$$ZI$$Base),
-            .zi_limit             = PART_REGION_ADDR(TFM_SP_SECURE_TEST_PARTITION, _DATA$$ZI$$Limit),
-            .stack_bottom         = PART_REGION_ADDR(TFM_SP_SECURE_TEST_PARTITION, _STACK$$ZI$$Base),
-            .stack_top            = PART_REGION_ADDR(TFM_SP_SECURE_TEST_PARTITION, _STACK$$ZI$$Limit),
-        },
-
-    /* sp_thrd */
-        .sp_thrd = {
-                .pfn              = NULL,
-                .param            = NULL,
-                .sp_btm           = 0,
-                .sp_top           = 0,
-                .prior            = THRD_PRIOR_LOWEST,
-                .status           = THRD_STAT_INVALID,
-                .state_ctx        =
-                {
-                    .ctxb         = {0}, /* Fields are not detailed as they are architecture dependent*/
-                },
-                .next             = NULL,
-        },
-#endif /* defined(TFM_PSA_API) */
     },
 #endif /* TFM_PARTITION_TEST_SECURE_SERVICES */
 
@@ -1041,83 +876,11 @@
     /* -----------------------------------------------------------------------*/
 #ifdef TFM_PARTITION_TEST_CORE_IPC
     {
-    /* Static data */
-        {
-            .partition_id         = TFM_SP_IPC_SERVICE_TEST_ID,
-            .partition_flags      = SPM_PART_FLAG_IPC
-                                  | SPM_PART_FLAG_PSA_ROT | SPM_PART_FLAG_APP_ROT
-                                  ,
-            .partition_priority   = TFM_PRIORITY(HIGH),
-            .partition_init       = ipc_service_test_main,
-        },
-
     /* Runtime data */
-        {
-#ifndef TFM_PSA_API
-            .partition_state      = SPM_PARTITION_STATE_UNINIT,
-            .caller_partition_idx = SPM_INVALID_PARTITION_IDX,
-            .caller_client_id     = TFM_INVALID_CLIENT_ID,
-            .share                = TFM_BUFFER_SHARE_DISABLE,
-            .stack_ptr            = 0,
-            .lr                   = 0,
-            .iovec_api            = TFM_SFN_API_IOVEC,
-            .iovec_args           =
-                {
-                    .in_vec       = {{0}},
-                    .in_len       = 0,
-                    .out_vec      = {{0}},
-                    .out_len      = 0,
-                },
-            .orig_outvec          = NULL,
-            .ctx_stack_ptr        = ctx_stack_TFM_SP_IPC_SERVICE_TEST,
-#else /* !defined(TFM_PSA_API) */
-            .signal_evnt          =
-                {
-                    .magic        = 0,
-                    .owner        = NULL,
-                },
-            .signals              = 0,
-            .service_list         =
-                {
-                    .prev         = NULL,
-                    .next         = NULL,
-                },
-#endif /* !defined(TFM_PSA_API) */
-            .signal_mask          = 0,
-        },
-
+        .runtime_data             = {},
+        .static_data              = NULL,
         .platform_data            = NULL,
 
-#ifdef TFM_PSA_API
-    /* memory_data */
-        .memory_data = {
-            .code_start           = PART_REGION_ADDR(TFM_SP_IPC_SERVICE_TEST, $$Base),
-            .code_limit           = PART_REGION_ADDR(TFM_SP_IPC_SERVICE_TEST, $$Limit),
-            .ro_start             = PART_REGION_ADDR(TFM_SP_IPC_SERVICE_TEST, $$RO$$Base),
-            .ro_limit             = PART_REGION_ADDR(TFM_SP_IPC_SERVICE_TEST, $$RO$$Limit),
-            .rw_start             = PART_REGION_ADDR(TFM_SP_IPC_SERVICE_TEST, _DATA$$RW$$Base),
-            .rw_limit             = PART_REGION_ADDR(TFM_SP_IPC_SERVICE_TEST, _DATA$$RW$$Limit),
-            .zi_start             = PART_REGION_ADDR(TFM_SP_IPC_SERVICE_TEST, _DATA$$ZI$$Base),
-            .zi_limit             = PART_REGION_ADDR(TFM_SP_IPC_SERVICE_TEST, _DATA$$ZI$$Limit),
-            .stack_bottom         = PART_REGION_ADDR(TFM_SP_IPC_SERVICE_TEST, _STACK$$ZI$$Base),
-            .stack_top            = PART_REGION_ADDR(TFM_SP_IPC_SERVICE_TEST, _STACK$$ZI$$Limit),
-        },
-
-    /* sp_thrd */
-        .sp_thrd = {
-                .pfn              = NULL,
-                .param            = NULL,
-                .sp_btm           = 0,
-                .sp_top           = 0,
-                .prior            = THRD_PRIOR_LOWEST,
-                .status           = THRD_STAT_INVALID,
-                .state_ctx        =
-                {
-                    .ctxb         = {0}, /* Fields are not detailed as they are architecture dependent*/
-                },
-                .next             = NULL,
-        },
-#endif /* defined(TFM_PSA_API) */
     },
 #endif /* TFM_PARTITION_TEST_CORE_IPC */
 
@@ -1126,83 +889,11 @@
     /* -----------------------------------------------------------------------*/
 #ifdef TFM_PARTITION_TEST_CORE_IPC
     {
-    /* Static data */
-        {
-            .partition_id         = TFM_SP_IPC_CLIENT_TEST_ID,
-            .partition_flags      = SPM_PART_FLAG_IPC
-                                  | SPM_PART_FLAG_APP_ROT
-                                  ,
-            .partition_priority   = TFM_PRIORITY(NORMAL),
-            .partition_init       = ipc_client_test_main,
-        },
-
     /* Runtime data */
-        {
-#ifndef TFM_PSA_API
-            .partition_state      = SPM_PARTITION_STATE_UNINIT,
-            .caller_partition_idx = SPM_INVALID_PARTITION_IDX,
-            .caller_client_id     = TFM_INVALID_CLIENT_ID,
-            .share                = TFM_BUFFER_SHARE_DISABLE,
-            .stack_ptr            = 0,
-            .lr                   = 0,
-            .iovec_api            = TFM_SFN_API_IOVEC,
-            .iovec_args           =
-                {
-                    .in_vec       = {{0}},
-                    .in_len       = 0,
-                    .out_vec      = {{0}},
-                    .out_len      = 0,
-                },
-            .orig_outvec          = NULL,
-            .ctx_stack_ptr        = ctx_stack_TFM_SP_IPC_CLIENT_TEST,
-#else /* !defined(TFM_PSA_API) */
-            .signal_evnt          =
-                {
-                    .magic        = 0,
-                    .owner        = NULL,
-                },
-            .signals              = 0,
-            .service_list         =
-                {
-                    .prev         = NULL,
-                    .next         = NULL,
-                },
-#endif /* !defined(TFM_PSA_API) */
-            .signal_mask          = 0,
-        },
-
+        .runtime_data             = {},
+        .static_data              = NULL,
         .platform_data            = NULL,
 
-#ifdef TFM_PSA_API
-    /* memory_data */
-        .memory_data = {
-            .code_start           = PART_REGION_ADDR(TFM_SP_IPC_CLIENT_TEST, $$Base),
-            .code_limit           = PART_REGION_ADDR(TFM_SP_IPC_CLIENT_TEST, $$Limit),
-            .ro_start             = PART_REGION_ADDR(TFM_SP_IPC_CLIENT_TEST, $$RO$$Base),
-            .ro_limit             = PART_REGION_ADDR(TFM_SP_IPC_CLIENT_TEST, $$RO$$Limit),
-            .rw_start             = PART_REGION_ADDR(TFM_SP_IPC_CLIENT_TEST, _DATA$$RW$$Base),
-            .rw_limit             = PART_REGION_ADDR(TFM_SP_IPC_CLIENT_TEST, _DATA$$RW$$Limit),
-            .zi_start             = PART_REGION_ADDR(TFM_SP_IPC_CLIENT_TEST, _DATA$$ZI$$Base),
-            .zi_limit             = PART_REGION_ADDR(TFM_SP_IPC_CLIENT_TEST, _DATA$$ZI$$Limit),
-            .stack_bottom         = PART_REGION_ADDR(TFM_SP_IPC_CLIENT_TEST, _STACK$$ZI$$Base),
-            .stack_top            = PART_REGION_ADDR(TFM_SP_IPC_CLIENT_TEST, _STACK$$ZI$$Limit),
-        },
-
-    /* sp_thrd */
-        .sp_thrd = {
-                .pfn              = NULL,
-                .param            = NULL,
-                .sp_btm           = 0,
-                .sp_top           = 0,
-                .prior            = THRD_PRIOR_LOWEST,
-                .status           = THRD_STAT_INVALID,
-                .state_ctx        =
-                {
-                    .ctxb         = {0}, /* Fields are not detailed as they are architecture dependent*/
-                },
-                .next             = NULL,
-        },
-#endif /* defined(TFM_PSA_API) */
     },
 #endif /* TFM_PARTITION_TEST_CORE_IPC */
 
@@ -1211,85 +902,11 @@
     /* -----------------------------------------------------------------------*/
 #ifdef TFM_ENABLE_IRQ_TEST
     {
-    /* Static data */
-        {
-            .partition_id         = TFM_IRQ_TEST_1_ID,
-            .partition_flags      = SPM_PART_FLAG_IPC
-                                  | SPM_PART_FLAG_APP_ROT
-                                  ,
-            .partition_priority   = TFM_PRIORITY(NORMAL),
-            .partition_init       = tfm_irq_test_1_init,
-        },
-
     /* Runtime data */
-        {
-#ifndef TFM_PSA_API
-            .partition_state      = SPM_PARTITION_STATE_UNINIT,
-            .caller_partition_idx = SPM_INVALID_PARTITION_IDX,
-            .caller_client_id     = TFM_INVALID_CLIENT_ID,
-            .share                = TFM_BUFFER_SHARE_DISABLE,
-            .stack_ptr            = 0,
-            .lr                   = 0,
-            .iovec_api            = TFM_SFN_API_IOVEC,
-            .iovec_args           =
-                {
-                    .in_vec       = {{0}},
-                    .in_len       = 0,
-                    .out_vec      = {{0}},
-                    .out_len      = 0,
-                },
-            .orig_outvec          = NULL,
-            .ctx_stack_ptr        = ctx_stack_TFM_IRQ_TEST_1,
-#else /* !defined(TFM_PSA_API) */
-            .signal_evnt          =
-                {
-                    .magic        = 0,
-                    .owner        = NULL,
-                },
-            .signals              = 0,
-            .service_list         =
-                {
-                    .prev         = NULL,
-                    .next         = NULL,
-                },
-#endif /* !defined(TFM_PSA_API) */
-            .signal_mask          = 0,
-        },
+        .runtime_data             = {},
+        .static_data              = NULL,
+        .platform_data            = NULL,
 
-    /* platform data */
-        /* FIXME: Only adding the first mmio region */
-        .platform_data            = TFM_PERIPHERAL_TIMER0,
-
-#ifdef TFM_PSA_API
-    /* memory_data */
-        .memory_data = {
-            .code_start           = PART_REGION_ADDR(TFM_IRQ_TEST_1, $$Base),
-            .code_limit           = PART_REGION_ADDR(TFM_IRQ_TEST_1, $$Limit),
-            .ro_start             = PART_REGION_ADDR(TFM_IRQ_TEST_1, $$RO$$Base),
-            .ro_limit             = PART_REGION_ADDR(TFM_IRQ_TEST_1, $$RO$$Limit),
-            .rw_start             = PART_REGION_ADDR(TFM_IRQ_TEST_1, _DATA$$RW$$Base),
-            .rw_limit             = PART_REGION_ADDR(TFM_IRQ_TEST_1, _DATA$$RW$$Limit),
-            .zi_start             = PART_REGION_ADDR(TFM_IRQ_TEST_1, _DATA$$ZI$$Base),
-            .zi_limit             = PART_REGION_ADDR(TFM_IRQ_TEST_1, _DATA$$ZI$$Limit),
-            .stack_bottom         = PART_REGION_ADDR(TFM_IRQ_TEST_1, _STACK$$ZI$$Base),
-            .stack_top            = PART_REGION_ADDR(TFM_IRQ_TEST_1, _STACK$$ZI$$Limit),
-        },
-
-    /* sp_thrd */
-        .sp_thrd = {
-                .pfn              = NULL,
-                .param            = NULL,
-                .sp_btm           = 0,
-                .sp_top           = 0,
-                .prior            = THRD_PRIOR_LOWEST,
-                .status           = THRD_STAT_INVALID,
-                .state_ctx        =
-                {
-                    .ctxb         = {0}, /* Fields are not detailed as they are architecture dependent*/
-                },
-                .next             = NULL,
-        },
-#endif /* defined(TFM_PSA_API) */
     },
 #endif /* TFM_ENABLE_IRQ_TEST */
 
diff --git a/secure_fw/services/tfm_spm_db.inc.template b/secure_fw/services/tfm_spm_db.inc.template
index f647639..f58dd30 100644
--- a/secure_fw/services/tfm_spm_db.inc.template
+++ b/secure_fw/services/tfm_spm_db.inc.template
@@ -32,6 +32,10 @@
 /**************************************************************************/
 /** Declarations of partition init functions */
 /**************************************************************************/
+#ifdef TFM_PSA_API
+extern psa_status_t tfm_nspm_thread_entry(void);
+#endif
+
 {% for manifest in manifests %}
     {% if manifest.attr.conditional %}
 #ifdef {{manifest.attr.conditional}}
@@ -45,6 +49,10 @@
 /**************************************************************************/
 /** Memory region declarations */
 /**************************************************************************/
+#ifdef TFM_PSA_API
+REGION_DECLARE(Image$$, ARM_LIB_STACK, $$ZI$$Base);
+REGION_DECLARE(Image$$, ARM_LIB_STACK, $$ZI$$Limit);
+
 {% for manifest in manifests %}
     {% if manifest.attr.conditional %}
 #ifdef {{manifest.attr.conditional}}
@@ -64,6 +72,8 @@
     {% endif %}
 
 {% endfor %}
+#endif /* defined(TFM_PSA_API) */
+
 #ifndef TFM_PSA_API
 /**************************************************************************/
 /** Context stacks for IRQ handling */
@@ -77,6 +87,12 @@
  *   intr_ctx: Frame pushed when the partition is interrupted
  *   hndl_ctx: Frame pushed when the partition is handling an interrupt
  */
+static uint32_t ns_interrupt_ctx_stack[
+        sizeof(struct interrupted_ctx_stack_frame_t) / sizeof(uint32_t)];
+
+static uint32_t tfm_core_interrupt_ctx_stack[
+        sizeof(struct interrupted_ctx_stack_frame_t) / sizeof(uint32_t)];
+
 {% for manifest in manifests %}
     {% if manifest.attr.conditional %}
 #ifdef {{manifest.attr.conditional}}
@@ -92,16 +108,158 @@
     {% endif %}
 
 {% endfor %}
+
+uint32_t *ctx_stack_list[] =
+{
+    ns_interrupt_ctx_stack,
+    tfm_core_interrupt_ctx_stack,
+{% for manifest in manifests %}
+    {% if manifest.attr.conditional %}
+#ifdef {{manifest.attr.conditional}}
+    {% endif %}
+    ctx_stack_{{manifest.manifest.name}},
+    {% if manifest.attr.conditional %}
+#endif /* {{manifest.attr.conditional}} */
+    {% endif %}
+{% endfor %}
+};
 #endif /* !defined(TFM_PSA_API) */
 
 /**************************************************************************/
+/** The static data of the partition list */
+/**************************************************************************/
+const struct spm_partition_static_data_t static_data_list[] =
+{
+    {
+        .partition_id         = TFM_SP_NON_SECURE_ID,
+#ifdef TFM_PSA_API
+        .partition_flags      = SPM_PART_FLAG_APP_ROT | SPM_PART_FLAG_IPC,
+        .partition_priority   = TFM_PRIORITY_LOW,
+        .partition_init       = tfm_nspm_thread_entry,
+#else
+        .partition_flags      = 0,
+#endif
+    },
+
+#ifndef TFM_PSA_API
+    {
+        .partition_id         = TFM_SP_CORE_ID,
+        .partition_flags      = SPM_PART_FLAG_APP_ROT | SPM_PART_FLAG_PSA_ROT,
+    },
+#endif
+
+{% for manifest in manifests %}
+    {% if manifest.attr.conditional %}
+#ifdef {{manifest.attr.conditional}}
+    {% endif %}
+    {{'{'}}
+        .partition_id         = {{manifest.manifest.name}}_ID,
+    {% if manifest.attr.tfm_partition_ipc %}
+        .partition_flags      = SPM_PART_FLAG_IPC
+    {% else %}
+        .partition_flags      = 0
+    {% endif %}
+    {% if manifest.manifest.type == "APPLICATION-ROT" %}
+                              | SPM_PART_FLAG_APP_ROT
+    {% elif manifest.manifest.type == "PSA-ROT" %}
+                              | SPM_PART_FLAG_PSA_ROT | SPM_PART_FLAG_APP_ROT
+    {% else %}
+#error "Unsupported type '{{manifest.manifest.type}}' for partition '{{manifest.manifest.name}}'!"
+    {% endif %}
+                              ,
+        .partition_priority   = TFM_PRIORITY({{manifest.manifest.priority}}),
+        .partition_init       = {{manifest.manifest.entry_point}},
+    {{'},'}}
+    {% if manifest.attr.conditional %}
+#endif /* {{manifest.attr.conditional}} */
+    {% endif %}
+
+{% endfor %}
+};
+
+/**************************************************************************/
+/** The platform data of the partition list */
+/**************************************************************************/
+const struct tfm_spm_partition_platform_data_t *platform_data_list[] =
+{
+    NULL,
+
+#ifndef TFM_PSA_API
+    NULL,
+#endif
+
+{% for manifest in manifests %}
+    {% if manifest.attr.conditional %}
+#ifdef {{manifest.attr.conditional}}
+    {% endif %}
+    {% if manifest.manifest.mmio_regions %}
+    /* FIXME: Only adding the first mmio region */
+        {% for region in manifest.manifest.mmio_regions %}
+            {% if loop.first %}
+                {% if region.conditional %}
+#ifdef {{region.conditional}}
+                {% endif %}
+    {{region.name}},
+                {% if region.conditional %}
+#else /* {{region.conditional}} */
+    NULL,
+#endif /* {{region.conditional}} */
+                {% endif %}
+            {% else %} {# print nothing #} {% endif %}
+        {% endfor %}
+    {% else %}
+    NULL,
+    {% endif %}
+    {% if manifest.attr.conditional %}
+#endif /* {{manifest.attr.conditional}} */
+    {% endif %}
+
+{% endfor %}
+};
+
+/**************************************************************************/
+/** The memory data of the partition list */
+/**************************************************************************/
+#ifdef TFM_PSA_API
+const struct tfm_spm_partition_memory_data_t memory_data_list[] =
+{
+    {
+        .stack_bottom         = PART_REGION_ADDR(ARM_LIB_STACK, $$ZI$$Base),
+        .stack_top            = PART_REGION_ADDR(ARM_LIB_STACK, $$ZI$$Limit),
+        .rw_start             = PART_REGION_ADDR(ARM_LIB_STACK, $$ZI$$Base),
+    },
+{% for manifest in manifests %}
+    {% if manifest.attr.conditional %}
+#ifdef {{manifest.attr.conditional}}
+    {% endif %}
+    {{'{'}}
+        .code_start           = PART_REGION_ADDR({{manifest.manifest.name}}, $$Base),
+        .code_limit           = PART_REGION_ADDR({{manifest.manifest.name}}, $$Limit),
+        .ro_start             = PART_REGION_ADDR({{manifest.manifest.name}}, $$RO$$Base),
+        .ro_limit             = PART_REGION_ADDR({{manifest.manifest.name}}, $$RO$$Limit),
+        .rw_start             = PART_REGION_ADDR({{manifest.manifest.name}}, _DATA$$RW$$Base),
+        .rw_limit             = PART_REGION_ADDR({{manifest.manifest.name}}, _DATA$$RW$$Limit),
+        .zi_start             = PART_REGION_ADDR({{manifest.manifest.name}}, _DATA$$ZI$$Base),
+        .zi_limit             = PART_REGION_ADDR({{manifest.manifest.name}}, _DATA$$ZI$$Limit),
+        .stack_bottom         = PART_REGION_ADDR({{manifest.manifest.name}}, _STACK$$ZI$$Base),
+        .stack_top            = PART_REGION_ADDR({{manifest.manifest.name}}, _STACK$$ZI$$Limit),
+    {{'},'}}
+    {% if manifest.attr.conditional %}
+#endif /* {{manifest.attr.conditional}} */
+    {% endif %}
+
+{% endfor %}
+};
+#endif /* defined(TFM_PSA_API) */
+
+/**************************************************************************/
 /** The partition list for the DB */
 /**************************************************************************/
-struct spm_partition_desc_t partition_list [] =
+static struct spm_partition_desc_t partition_list [] =
 {
-    {{'{{0}}'}}, /* placeholder for Non-secure internal partition */
+    {{'{{}}'}}, /* placeholder for Non-secure internal partition */
 #ifndef TFM_PSA_API
-    {{'{{0}}'}}, /* placeholder for TF-M Core internal partition */
+    {{'{{}}'}}, /* placeholder for TF-M Core internal partition */
 #endif /* !ifndefined(TFM_PSA_API) */
 
 {% for manifest in manifests %}
@@ -112,111 +270,11 @@
 #ifdef {{manifest.attr.conditional}}
     {% endif %}
     {{'{'}}
-    /* Static data */
-        {{'{'}}
-            .partition_id         = {{manifest.manifest.name}}_ID,
-        {% if manifest.attr.tfm_partition_ipc %}
-            .partition_flags      = SPM_PART_FLAG_IPC
-        {% else %}
-            .partition_flags      = 0
-        {% endif %}
-        {% if manifest.manifest.type == "APPLICATION-ROT" %}
-                                  | SPM_PART_FLAG_APP_ROT
-        {% elif manifest.manifest.type == "PSA-ROT" %}
-                                  | SPM_PART_FLAG_PSA_ROT | SPM_PART_FLAG_APP_ROT
-        {% else %}
-#error "Unsupported type '{{manifest.manifest.type}}' for partition '{{manifest.manifest.name}}'!"
-        {% endif %}
-                                  ,
-            .partition_priority   = TFM_PRIORITY({{manifest.manifest.priority}}),
-            .partition_init       = {{manifest.manifest.entry_point}},
-        {{'},'}}
-
     /* Runtime data */
-        {{'{'}}
-#ifndef TFM_PSA_API
-            .partition_state      = SPM_PARTITION_STATE_UNINIT,
-            .caller_partition_idx = SPM_INVALID_PARTITION_IDX,
-            .caller_client_id     = TFM_INVALID_CLIENT_ID,
-            .share                = TFM_BUFFER_SHARE_DISABLE,
-            .stack_ptr            = 0,
-            .lr                   = 0,
-            .iovec_api            = TFM_SFN_API_IOVEC,
-            .iovec_args           =
-                {
-                    .in_vec       = {{'{{0}}'}},
-                    .in_len       = 0,
-                    .out_vec      = {{'{{0}}'}},
-                    .out_len      = 0,
-                },
-            .orig_outvec          = NULL,
-            .ctx_stack_ptr        = ctx_stack_{{manifest.manifest.name}},
-#else /* !defined(TFM_PSA_API) */
-            .signal_evnt          =
-                {
-                    .magic        = 0,
-                    .owner        = NULL,
-                },
-            .signals              = 0,
-            .service_list         =
-                {
-                    .prev         = NULL,
-                    .next         = NULL,
-                },
-#endif /* !defined(TFM_PSA_API) */
-            .signal_mask          = 0,
-        {{'},'}}
-
-        {% if manifest.manifest.mmio_regions %}
-    /* platform data */
-        /* FIXME: Only adding the first mmio region */
-            {% for region in manifest.manifest.mmio_regions %}
-                {% if loop.first %}
-                    {% if region.conditional %}
-#ifdef {{region.conditional}}
-                    {% endif %}
-        .platform_data            = {{region.name}},
-                    {% if region.conditional %}
-#else /* {{region.conditional}} */
+        .runtime_data             = {},
+        .static_data              = NULL,
         .platform_data            = NULL,
-#endif /* {{region.conditional}} */
-                    {% endif %}
-                {% else %} {# print nothing #} {% endif %}
-            {% endfor %}
-        {% else %}
-        .platform_data            = NULL,
-        {% endif %}
 
-#ifdef TFM_PSA_API
-    /* memory_data */
-        .memory_data = {{'{'}}
-            .code_start           = PART_REGION_ADDR({{manifest.manifest.name}}, $$Base),
-            .code_limit           = PART_REGION_ADDR({{manifest.manifest.name}}, $$Limit),
-            .ro_start             = PART_REGION_ADDR({{manifest.manifest.name}}, $$RO$$Base),
-            .ro_limit             = PART_REGION_ADDR({{manifest.manifest.name}}, $$RO$$Limit),
-            .rw_start             = PART_REGION_ADDR({{manifest.manifest.name}}, _DATA$$RW$$Base),
-            .rw_limit             = PART_REGION_ADDR({{manifest.manifest.name}}, _DATA$$RW$$Limit),
-            .zi_start             = PART_REGION_ADDR({{manifest.manifest.name}}, _DATA$$ZI$$Base),
-            .zi_limit             = PART_REGION_ADDR({{manifest.manifest.name}}, _DATA$$ZI$$Limit),
-            .stack_bottom         = PART_REGION_ADDR({{manifest.manifest.name}}, _STACK$$ZI$$Base),
-            .stack_top            = PART_REGION_ADDR({{manifest.manifest.name}}, _STACK$$ZI$$Limit),
-        {{'},'}}
-
-    /* sp_thrd */
-        .sp_thrd = {
-                .pfn              = NULL,
-                .param            = NULL,
-                .sp_btm           = 0,
-                .sp_top           = 0,
-                .prior            = THRD_PRIOR_LOWEST,
-                .status           = THRD_STAT_INVALID,
-                .state_ctx        =
-                {
-                    .ctxb         = {0}, /* Fields are not detailed as they are architecture dependent*/
-                },
-                .next             = NULL,
-        },
-#endif /* defined(TFM_PSA_API) */
     {{'},'}}
     {% if manifest.attr.conditional %}
 #endif /* {{manifest.attr.conditional}} */
diff --git a/secure_fw/spm/spm_api.c b/secure_fw/spm/spm_api.c
index b8af146..51bce88 100644
--- a/secure_fw/spm/spm_api.c
+++ b/secure_fw/spm/spm_api.c
@@ -35,7 +35,7 @@
     }
 
     for (i = 0; i < g_spm_partition_db.partition_count; ++i) {
-        if (g_spm_partition_db.partitions[i].static_data.partition_id ==
+        if (g_spm_partition_db.partitions[i].static_data->partition_id ==
                 partition_id) {
             return i;
         }
@@ -45,65 +45,36 @@
 
 enum spm_err_t tfm_spm_db_init(void)
 {
-    struct spm_partition_desc_t *part_ptr;
-#ifndef TFM_PSA_API
-    static uint32_t ns_interrupt_ctx_stack[
-           sizeof(struct interrupted_ctx_stack_frame_t)/sizeof(uint32_t)] = {0};
-    static uint32_t tfm_core_interrupt_ctx_stack[
-           sizeof(struct interrupted_ctx_stack_frame_t)/sizeof(uint32_t)] = {0};
-#endif /* !defined(TFM_PSA_API) */
+    uint32_t i;
 
     /* This function initialises partition db */
 
-    /* There are a few partitions that are used by TF-M internally.
-     * These are explicitly added to the partition db here.
-     */
-
     /* For the non secure Execution environment */
-#ifdef TFM_PSA_API
-    extern uint32_t Image$$ARM_LIB_STACK$$ZI$$Base[];
-    extern uint32_t Image$$ARM_LIB_STACK$$ZI$$Limit[];
-    uint32_t psp_stack_bottom = (uint32_t)Image$$ARM_LIB_STACK$$ZI$$Base;
-    uint32_t psp_stack_top    = (uint32_t)Image$$ARM_LIB_STACK$$ZI$$Limit;
-#endif
-
-    part_ptr = &(g_spm_partition_db.partitions[
-                                         NON_SECURE_INTERNAL_PARTITION_DB_IDX]);
-    part_ptr->static_data.partition_id = TFM_SP_NON_SECURE_ID;
-#ifdef TFM_PSA_API
-    part_ptr->static_data.partition_flags = SPM_PART_FLAG_APP_ROT |
-                                            SPM_PART_FLAG_IPC;
-    part_ptr->static_data.partition_priority = TFM_PRIORITY_LOW;
-    part_ptr->static_data.partition_init = tfm_nspm_thread_entry;
-#else
-    part_ptr->static_data.partition_flags = 0;
-#endif
-
-#ifdef TFM_PSA_API
-    part_ptr->memory_data.stack_bottom = psp_stack_bottom;
-    part_ptr->memory_data.stack_top    = psp_stack_top;
-    /* Since RW, ZI and stack are configured as one MPU region, configure
-     * RW start address to psp_stack_bottom to get RW access to stack
-     */
-    part_ptr->memory_data.rw_start     = psp_stack_bottom;
-#endif
-
 #ifndef TFM_PSA_API
-    part_ptr->runtime_data.partition_state = SPM_PARTITION_STATE_UNINIT;
-    part_ptr->runtime_data.ctx_stack_ptr = ns_interrupt_ctx_stack;
-
     tfm_nspm_configure_clients();
+#endif
 
-    /* For the TF-M core environment itself */
-    part_ptr = &(g_spm_partition_db.partitions[
-                                           TFM_CORE_INTERNAL_PARTITION_DB_IDX]);
-    part_ptr->static_data.partition_id = TFM_SP_CORE_ID;
-    part_ptr->static_data.partition_flags =
-                    SPM_PART_FLAG_APP_ROT | SPM_PART_FLAG_PSA_ROT;
-    part_ptr->runtime_data.partition_state = SPM_PARTITION_STATE_UNINIT;
-    part_ptr->runtime_data.ctx_stack_ptr = tfm_core_interrupt_ctx_stack;
+    for (i = 0; i < g_spm_partition_db.partition_count; i++) {
+#ifndef TFM_PSA_API
+        g_spm_partition_db.partitions[i].runtime_data.partition_state =
+            SPM_PARTITION_STATE_UNINIT;
+        g_spm_partition_db.partitions[i].runtime_data.caller_partition_idx =
+            SPM_INVALID_PARTITION_IDX;
+        g_spm_partition_db.partitions[i].runtime_data.caller_client_id =
+            TFM_INVALID_CLIENT_ID;
+        g_spm_partition_db.partitions[i].runtime_data.share =
+            TFM_BUFFER_SHARE_DISABLE;
+        g_spm_partition_db.partitions[i].runtime_data.iovec_api =
+            TFM_SFN_API_IOVEC;
+        g_spm_partition_db.partitions[i].runtime_data.ctx_stack_ptr =
+            ctx_stack_list[i];
 #endif /* !defined(TFM_PSA_API) */
-
+        g_spm_partition_db.partitions[i].static_data = &static_data_list[i];
+        g_spm_partition_db.partitions[i].platform_data = platform_data_list[i];
+#ifdef TFM_PSA_API
+        g_spm_partition_db.partitions[i].memory_data = &memory_data_list[i];
+#endif
+    }
     g_spm_partition_db.is_init = 1;
 
     return SPM_ERR_OK;
@@ -111,13 +82,13 @@
 
 uint32_t tfm_spm_partition_get_partition_id(uint32_t partition_idx)
 {
-    return g_spm_partition_db.partitions[partition_idx].static_data.
+    return g_spm_partition_db.partitions[partition_idx].static_data->
             partition_id;
 }
 
 uint32_t tfm_spm_partition_get_flags(uint32_t partition_idx)
 {
-    return g_spm_partition_db.partitions[partition_idx].static_data.
+    return g_spm_partition_db.partitions[partition_idx].static_data->
             partition_flags;
 }
 
diff --git a/secure_fw/spm/spm_api.h b/secure_fw/spm/spm_api.h
index 99d35a2..75b921c 100644
--- a/secure_fw/spm/spm_api.h
+++ b/secure_fw/spm/spm_api.h
@@ -106,6 +106,7 @@
                                          * Service signal mask passed by
                                          * psa_wait()
                                          */
+    uint32_t index;                     /* Partition index */
 };
 
 #ifdef TFM_PSA_API
diff --git a/secure_fw/spm/spm_api_func.c b/secure_fw/spm/spm_api_func.c
index 763a543..f425679 100644
--- a/secure_fw/spm/spm_api_func.c
+++ b/secure_fw/spm/spm_api_func.c
@@ -39,17 +39,17 @@
 #ifdef TFM_CORE_DEBUG
     if (err_type == TFM_INIT_FAILURE) {
         printf("Partition init failed for partition id 0x%08X\r\n",
-               partition->static_data.partition_id);
+               partition->static_data->partition_id);
     } else {
         printf(
             "Unknown partition error %d (code: %d) for partition id 0x%08X\r\n",
-            err_type, err_code, partition->static_data.partition_id);
+            err_type, err_code, partition->static_data->partition_id);
     }
 #else
     (void)err_type;
     (void)err_code;
 #endif
-    tfm_spm_partition_set_state(partition->static_data.partition_id,
+    tfm_spm_partition_set_state(partition->static_data->partition_id,
                                 SPM_PARTITION_STATE_CLOSED);
 }
 
@@ -65,7 +65,7 @@
     for (idx = 0; idx < g_spm_partition_db.partition_count; ++idx) {
         part = &g_spm_partition_db.partitions[idx];
         tfm_spm_hal_configure_default_isolation(part->platform_data);
-        if (part->static_data.partition_init == NULL) {
+        if (part->static_data->partition_init == NULL) {
             tfm_spm_partition_set_state(idx, SPM_PARTITION_STATE_IDLE);
             tfm_spm_partition_set_caller_partition_idx(idx,
                                                        SPM_INVALID_PARTITION_IDX);
@@ -75,8 +75,8 @@
             desc.args = args;
             desc.ns_caller = 0U;
             desc.iovec_api = TFM_SFN_API_IOVEC;
-            desc.sfn = (sfn_t)part->static_data.partition_init;
-            desc.sp_id = part->static_data.partition_id;
+            desc.sfn = (sfn_t)part->static_data->partition_init;
+            desc.sp_id = part->static_data->partition_id;
             res = tfm_core_sfn_request(&desc);
             if (res == TFM_SUCCESS) {
                 tfm_spm_partition_set_state(idx, SPM_PARTITION_STATE_IDLE);
@@ -261,4 +261,4 @@
     }
     partition->runtime_data.orig_outvec = 0;
     partition->runtime_data.iovec_api = 0;
-}
\ No newline at end of file
+}
diff --git a/secure_fw/spm/spm_api_ipc.c b/secure_fw/spm/spm_api_ipc.c
index 3db55b5..7f773d2 100644
--- a/secure_fw/spm/spm_api_ipc.c
+++ b/secure_fw/spm/spm_api_ipc.c
@@ -264,7 +264,7 @@
 
     /* For condition 2: check if the partition ID is same */
     partition_id = tfm_spm_partition_get_running_partition_id();
-    if (partition_id != msg->service->partition->static_data.partition_id) {
+    if (partition_id != msg->service->partition->static_data->partition_id) {
         return NULL;
     }
 
@@ -364,12 +364,12 @@
 uint32_t tfm_spm_partition_get_stack_bottom(uint32_t partition_idx)
 {
     return g_spm_partition_db.partitions[partition_idx].
-            memory_data.stack_bottom;
+            memory_data->stack_bottom;
 }
 
 uint32_t tfm_spm_partition_get_stack_top(uint32_t partition_idx)
 {
-    return g_spm_partition_db.partitions[partition_idx].memory_data.stack_top;
+    return g_spm_partition_db.partitions[partition_idx].memory_data->stack_top;
 }
 
 uint32_t tfm_spm_partition_get_running_partition_id(void)
@@ -379,7 +379,7 @@
 
     partition = TFM_GET_CONTAINER_PTR(pth, struct spm_partition_desc_t,
                                       sp_thrd);
-    return partition->static_data.partition_id;
+    return partition->static_data->partition_id;
 }
 
 static struct tfm_thrd_ctx *
@@ -392,12 +392,12 @@
     tfm_spm_partition_get_init_func(uint32_t partition_idx)
 {
     return (tfm_thrd_func_t)(g_spm_partition_db.partitions[partition_idx].
-                             static_data.partition_init);
+                             static_data->partition_init);
 }
 
 static uint32_t tfm_spm_partition_get_priority(uint32_t partition_idx)
 {
-    return g_spm_partition_db.partitions[partition_idx].static_data.
+    return g_spm_partition_db.partitions[partition_idx].static_data->
                     partition_priority;
 }
 
@@ -460,7 +460,7 @@
     for (i = 0; i < g_spm_partition_db.partition_count; i++) {
         partition = &g_spm_partition_db.partitions[i];
         tfm_spm_hal_configure_default_isolation(partition->platform_data);
-        partition->static_data.index = i;
+        partition->runtime_data.index = i;
         if ((tfm_spm_partition_get_flags(i) & SPM_PART_FLAG_IPC) == 0) {
             continue;
         }
@@ -536,7 +536,7 @@
                                                  struct spm_partition_desc_t,
                                                  sp_thrd);
 
-        if (p_next_partition->static_data.partition_flags &
+        if (p_next_partition->static_data->partition_flags &
             SPM_PART_FLAG_PSA_ROT) {
             is_privileged = TFM_PARTITION_PRIVILEGED_MODE;
         } else {
diff --git a/secure_fw/spm/spm_db.h b/secure_fw/spm/spm_db.h
index 2ee69f6..90e071c 100644
--- a/secure_fw/spm/spm_db.h
+++ b/secure_fw/spm/spm_db.h
@@ -39,7 +39,6 @@
  * phase.
  */
 struct spm_partition_static_data_t {
-    int32_t index;                      /* Partition index */
     uint32_t partition_id;
     uint32_t partition_flags;
     uint32_t partition_priority;
@@ -51,11 +50,11 @@
  * divided to structures, to keep the related fields close to each other.
  */
 struct spm_partition_desc_t {
-    struct spm_partition_static_data_t static_data;
     struct spm_partition_runtime_data_t runtime_data;
-    struct tfm_spm_partition_platform_data_t *platform_data;
+    const struct spm_partition_static_data_t *static_data;
+    const struct tfm_spm_partition_platform_data_t *platform_data;
 #if TFM_PSA_API
-    struct tfm_spm_partition_memory_data_t memory_data;
+    const struct tfm_spm_partition_memory_data_t *memory_data;
     struct tfm_thrd_ctx sp_thrd;
 #endif
 };