Core: Use data region in linker file as thread stack
Use the data region which predefined in the manifest
as thread stack.
Change-Id: I9f5dad0cdc3fb151563346cdea53128701c982b3
Signed-off-by: Edison Ai <edison.ai@arm.com>
diff --git a/secure_fw/core/ipc/tfm_spm.c b/secure_fw/core/ipc/tfm_spm.c
index 1ecc1a4..1dde4e6 100644
--- a/secure_fw/core/ipc/tfm_spm.c
+++ b/secure_fw/core/ipc/tfm_spm.c
@@ -431,6 +431,7 @@
return &g_spm_partition_db.partitions[partition_idx].sp_thrd;
}
+#if TFM_LVL == 1
static uint32_t tfm_spm_partition_get_stack_base_ext(uint32_t partition_idx)
{
return (uint32_t)&(g_spm_partition_db.partitions[partition_idx].
@@ -441,6 +442,7 @@
{
return (uint32_t)&g_spm_partition_db.partitions[partition_idx].stack;
}
+#endif
static tfm_thrd_func_t
tfm_spm_partition_get_init_func_ext(uint32_t partition_idx)
@@ -536,8 +538,14 @@
tfm_thrd_init(pth,
tfm_spm_partition_get_init_func_ext(i),
NULL,
+#if TFM_LVL == 1
(uint8_t *)tfm_spm_partition_get_stack_base_ext(i),
(uint8_t *)tfm_spm_partition_get_stack_limit_ext(i));
+#else
+ (uint8_t *)tfm_spm_partition_get_stack_top(i),
+ (uint8_t *)tfm_spm_partition_get_stack_bottom(i));
+#endif
+
pth->prior = tfm_spm_partition_get_priority_ext(i);
/* Kick off */
diff --git a/secure_fw/spm/spm_db.h b/secure_fw/spm/spm_db.h
index 7bfaa3c..8a9568b 100644
--- a/secure_fw/spm/spm_db.h
+++ b/secure_fw/spm/spm_db.h
@@ -21,7 +21,9 @@
#define TFM_PARTITION_TYPE_APP "APPLICATION-ROT"
#define TFM_PARTITION_TYPE_PSA "PSA-ROT"
+#if TFM_LVL == 1
#define TFM_STACK_SIZE (1024 * 5)
+#endif
#ifdef TFM_PSA_API
enum tfm_partition_priority {
@@ -69,8 +71,10 @@
* manifest. It will use the partition stacks in the linker scripts/sct
* files include Level 1 to 3.
*/
+#if TFM_LVL == 1
uint8_t stack[TFM_STACK_SIZE] __attribute__((aligned(8)));
#endif
+#endif
};
/* Macros to pick linker symbols and allow to form the partition data base */