aboutsummaryrefslogtreecommitdiff
path: root/platform/ext/common
diff options
context:
space:
mode:
authorTamas Ban <tamas.ban@arm.com>2020-11-24 14:13:30 +0000
committerTamas Ban <tamas.ban@arm.com>2020-12-17 13:06:19 +0000
commitec109eabcfca540ffbee5dcbf1f629740f9de5dd (patch)
treece12a30fa1e1bbdce0cd02e5dd2cdc10670e1feb /platform/ext/common
parent3a7cb3c07cbec3b2dbf92faafdf0eb06d5c06382 (diff)
downloadtrusted-firmware-m-ec109eabcfca540ffbee5dcbf1f629740f9de5dd.tar.gz
Platform: Place global variables in shared code to dedicated section
The code sharing between bootloader and runtime firmware requires to share the global variables as well. Because the RAM area is reused by SPE when bootloader has finished its job, therefore it must be ensured that global variables are placed by the linker to the same place during both linking operation (MCUboot and SPE). This location is a dedicated section which has a fixed place at the beginning of the RAM and hence not colliding with other sections. If code sharing is disabled then this special section is not created. Change-Id: I4b6c181f924c1ab8c1733b99806e824526fb820b Signed-off-by: Tamas Ban <tamas.ban@arm.com>
Diffstat (limited to 'platform/ext/common')
-rw-r--r--platform/ext/common/armclang/tfm_common_s.sct.template8
-rw-r--r--platform/ext/common/gcc/tfm_common_s.ld.template10
2 files changed, 18 insertions, 0 deletions
diff --git a/platform/ext/common/armclang/tfm_common_s.sct.template b/platform/ext/common/armclang/tfm_common_s.sct.template
index 627ca06866..d2e9ba70d5 100644
--- a/platform/ext/common/armclang/tfm_common_s.sct.template
+++ b/platform/ext/common/armclang/tfm_common_s.sct.template
@@ -141,6 +141,14 @@ LR_CODE S_CODE_START S_CODE_SIZE {
* beginning of privileged data region in multi-core topology.
*/
#ifndef TFM_MULTI_CORE_TOPOLOGY
+#ifdef CODE_SHARING
+ /* The code sharing between bootloader and runtime requires to share the
+ * global variables.
+ */
+ TFM_SHARED_SYMBOLS +0 ALIGN 32 EMPTY SHARED_SYMBOL_AREA_SIZE {
+ }
+#endif
+
/* Shared area between BL2 and runtime to exchange data */
TFM_SHARED_DATA +0 ALIGN 32 OVERLAY EMPTY BOOT_TFM_SHARED_DATA_SIZE {
}
diff --git a/platform/ext/common/gcc/tfm_common_s.ld.template b/platform/ext/common/gcc/tfm_common_s.ld.template
index d596cea8b7..f530492023 100644
--- a/platform/ext/common/gcc/tfm_common_s.ld.template
+++ b/platform/ext/common/gcc/tfm_common_s.ld.template
@@ -313,6 +313,16 @@ SECTIONS
* beginning of privileged data region in multi-core topology.
*/
#ifndef TFM_MULTI_CORE_TOPOLOGY
+#ifdef CODE_SHARING
+ /* The code sharing between bootloader and runtime requires to share the
+ * global variables.
+ */
+ .TFM_SHARED_SYMBOLS : ALIGN(32)
+ {
+ . += SHARED_SYMBOL_AREA_SIZE;
+ } > RAM
+#endif
+
/* shared_data and msp_stack are overlapping on purpose when
* msp_stack is extended until the beginning of RAM, when shared_date
* was read out by partitions