aboutsummaryrefslogtreecommitdiff
path: root/platform/ext/common
diff options
context:
space:
mode:
authorTTornblom <thomas.tornblom@iar.com>2020-06-05 08:54:57 +0200
committerAnton Komlev <Anton.Komlev@arm.com>2020-11-03 09:39:16 +0000
commit7fd851db4f7792fe860e055d61a9947b50f91782 (patch)
tree549fadf974229f82f734c9aa6c85fd586ec3411a /platform/ext/common
parent8a6b5c5edd73ca77002fa54576b69a11c4892943 (diff)
downloadtrusted-firmware-m-7fd851db4f7792fe860e055d61a9947b50f91782.tar.gz
Platform: Cleanup and simplification of IAR link scripts
Removed some unused clutter and simplified linking at specific addresses. Place __ramfunc functions in TFM_RAM_CODE block if S_RAM_CODE_START is defined otherwise place it in ROM. Fixes psoc64 issues. Disable packed initializers for secure image, may cause link errors otherwise. Renamed stm32l5xx_flash_ns.icf to stm32l5xx_ns.icf Signed-off-by: TTornblom <thomas.tornblom@iar.com> Change-Id: Ief0f0cb6e6faa607f86dc723579124ffb09ed93c
Diffstat (limited to 'platform/ext/common')
-rw-r--r--platform/ext/common/iar/tfm_common_s.icf.template38
1 files changed, 24 insertions, 14 deletions
diff --git a/platform/ext/common/iar/tfm_common_s.icf.template b/platform/ext/common/iar/tfm_common_s.icf.template
index 12c8cc1481..6bd08dab41 100644
--- a/platform/ext/common/iar/tfm_common_s.icf.template
+++ b/platform/ext/common/iar/tfm_common_s.icf.template
@@ -20,9 +20,13 @@
#include "region_defs.h"
-define memory mem with size = 4G;
-
-define block ER_TFM_CODE with fixed order, alignment = 8 {readonly section .intvec, readonly};
+define block ER_TFM_CODE with fixed order, alignment = 8, maximum size = S_CODE_SIZE {
+ readonly section .intvec,
+#ifndef S_RAM_CODE_START
+ rw section .textrw object *.o, /* place __ramfunc in ROM if no TFM_RAM_CODE block */
+#endif
+ readonly
+};
define block TFM_UNPRIV_CODE with alignment = 32 {
ro object platform_retarget_dev.o,
@@ -109,7 +113,7 @@ define block TFM_APP_CODE_END with alignment = 32, size = 0 { };
/**** Base address of secure data area */
define block TFM_SECURE_DATA_START with size = 0 { };
-#if !TFM_MULTI_CORE_TOPOLOGY
+#ifndef TFM_MULTI_CORE_TOPOLOGY
/* Shared area between BL2 and runtime to exchange data */
define block TFM_SHARED_DATA with alignment = 32, size = BOOT_TFM_SHARED_DATA_SIZE { };
define block ARM_LIB_STACK_MSP with alignment = 32, size = S_MSP_STACK_SIZE { };
@@ -123,10 +127,12 @@ define block ARM_LIB_STACK_SEAL with size = 0x8 { };
# else
define block ARM_LIB_STACK with alignment = 32, size = S_PSP_STACK_SIZE { };
# endif
+keep {block TFM_SHARED_DATA, block ARM_LIB_STACK_MSP};
#endif
#if !defined(TFM_PSA_API)
define block TFM_SECURE_STACK with size = 0x2000, alignment = 128 {};
+keep {block TFM_SECURE_STACK};
#endif /* !defined(TFM_PSA_API) */
define block TFM_UNPRIV_DATA with alignment = 32 {
@@ -197,12 +203,14 @@ define overlay STACK_DATA {block ARM_LIB_STACK_MSP};
/* PSP is privileged in multi-core topology */
define block ARM_LIB_STACK with alignment = 32, size = S_PSP_STACK_SIZE { };
+keep {block TFM_SHARED_DATA, block ARM_LIB_STACK_MSP};
#endif
define block HEAP with alignment = 8, size = S_HEAP_SIZE { };
define block ARM_LIB_HEAP with alignment = 8, size = S_HEAP_SIZE { };
define overlay HEAP_OVL {block HEAP};
define overlay HEAP_OVL {block ARM_LIB_HEAP};
+keep {block HEAP, block ARM_LIB_HEAP};
define block ER_TFM_DATA with alignment = 8 {readwrite};
@@ -253,6 +261,13 @@ define block {{manifest.manifest.name}}_LINKER_STACK with alignment = 128, size
*/
define block TFM_PSA_RW_STACK_END with alignment = 32, size = 0x0 { };
+#if defined (S_RAM_CODE_START)
+define block TFM_RAM_CODE with alignment = 8 {
+ rw section .textrw, /* __ramfunc */
+};
+place at address S_RAM_CODE_START { block TFM_RAM_CODE };
+#endif
+
/* This empty, zero long execution region is here to mark the limit address
* of the last execution region that is allocated in SRAM.
*/
@@ -303,7 +318,11 @@ define block LR_CODE with fixed order {
};
do not initialize { section .noinit };
-initialize by copy with packing = none { readwrite };
+initialize by copy with packing = none { readwrite }
+#ifndef S_RAM_CODE_START
+ except { section .textrw }
+#endif
+ ;
if (isdefinedsymbol(__USE_DLIB_PERTHREAD))
{
// Required in a multi-threaded application
@@ -424,15 +443,6 @@ define block PRIV_DATA with fixed order {
*/
block TFM_PSA_RW_STACK_END,
-#if 0
-#if defined (S_RAM_CODE_START)
- /* Executable code allocated in RAM */
- TFM_RAM_CODE S_RAM_CODE_START {
- * (.ramfunc)
- }
-#endif
-#endif
-
/* This empty, zero long execution region is here to mark the limit address
* of the last execution region that is allocated in SRAM.
*/