Build: Fix IAR build
* Use --fpu none instead of --fpu=none
IAR ASM compiler does not recognize --fpu=none
* Add missing CONFIG_TFM_FP ifdef
* IAR using different ARCH defines, than ARMCLANG or GCC,
modified ARCH defines in secure IAR linker
* Fix location pragma typo in ns_agent_tz
Signed-off-by: Dávid Házi <david.hazi@arm.com>
Change-Id: I2904deb3ae896895c8bc6a4fc119707c1df979e6
diff --git a/platform/ext/common/iar/tfm_common_s.icf b/platform/ext/common/iar/tfm_common_s.icf
index a644933..4dd50d1 100644
--- a/platform/ext/common/iar/tfm_common_s.icf
+++ b/platform/ext/common/iar/tfm_common_s.icf
@@ -115,8 +115,9 @@
/**** Base address of secure data area */
define block TFM_SECURE_DATA_START with size = 0 { };
-#if defined(__ARM_ARCH_8M_MAIN__) || defined(__ARM_ARCH_8M_BASE__) || \
- defined(__ARM_ARCH_8_1M_MAIN__)
+#if ((defined(__ARM8M_MAINLINE__) && (__CORE__ == __ARM8M_MAINLINE__)) || \
+ (defined(__ARM8M_BASELINE__) && (__CORE__ == __ARM8M_BASELINE__)) || \
+ (defined(__ARM8EM_MAINLINE__) && (__CORE__ == __ARM8EM_MAINLINE__)))
/* 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 with alignment = 32, size = S_MSP_STACK_SIZE { };
@@ -129,8 +130,9 @@
define block ER_INITIAL_PSP_SEAL with size = 0x8 { };
# endif
keep {block TFM_SHARED_DATA, block ARM_LIB_STACK};
-#endif /* defined(__ARM_ARCH_8M_MAIN__) || defined(__ARM_ARCH_8M_BASE__) || \
- * defined(__ARM_ARCH_8_1M_MAIN__) */
+#endif /* (defined(__ARM8M_MAINLINE__) && (__CORE__ == __ARM8M_MAINLINE__)) || \
+ * (defined(__ARM8M_BASELINE__) && (__CORE__ == __ARM8M_BASELINE__)) || \
+ * (defined(__ARM8EM_MAINLINE__) && (__CORE__ == __ARM8EM_MAINLINE__)) */
#if !defined(TFM_PSA_API)
define block TFM_SECURE_STACK with size = 0x2000, alignment = 128 {};
@@ -158,8 +160,9 @@
*/
define block TFM_APP_RW_STACK_END with alignment = 32, size = 0 { };
-#if defined(__ARM_ARCH_6M__) || defined(__ARM_ARCH_7M__) || \
- defined(__ARM_ARCH_7EM__)
+#if ((defined(__ARM6M__) && (__CORE__ == __ARM6M__)) || \
+ (defined(__ARM7M__) && (__CORE__ == __ARM7M__)) || \
+ (defined(__ARM7EM__) && (__CORE__ == __ARM7EM__)))
#ifdef S_DATA_PRIV_START
/**** Privileged data area base address specified by Armv6-M/v7-M platform */
define block TFM_SECURE_PRIV_DATA_BOUNDARY with size = 0 { };
@@ -179,8 +182,9 @@
define overlay STACK_DATA {block ARM_LIB_STACK};
keep {block TFM_SHARED_DATA, block ARM_LIB_STACK};
-#endif /* defined(__ARM_ARCH_6M__) || defined(__ARM_ARCH_7M__) || \
- * defined(__ARM_ARCH_7EM__) */
+#endif /* (defined(__ARM6M__) && (__CORE__ == __ARM6M__)) || \
+ * (defined(__ARM7M__) && (__CORE__ == __ARM7M__)) || \
+ * (defined(__ARM7EM__) && (__CORE__ == __ARM7EM__)) */
#if defined(ENABLE_HEAP)
define block HEAP with alignment = 8, size = S_HEAP_SIZE { };
@@ -309,8 +313,9 @@
* area on Armv8-M cores, while move the two areas to the beginning of
* privileged data region on Armv6-M/v7-M cores.
*/
-#if defined(__ARM_ARCH_8M_MAIN__) || defined(__ARM_ARCH_8M_BASE__) || \
- defined(__ARM_ARCH_8_1M_MAIN__)
+#if ((defined(__ARM8M_MAINLINE__) && (__CORE__ == __ARM8M_MAINLINE__)) || \
+ (defined(__ARM8M_BASELINE__) && (__CORE__ == __ARM8M_BASELINE__)) || \
+ (defined(__ARM8EM_MAINLINE__) && (__CORE__ == __ARM8EM_MAINLINE__)))
/* Shared area between BL2 and runtime to exchange data */
overlay STACK_DATA,
# if !defined(TFM_PSA_API)
@@ -319,8 +324,9 @@
/* Define stack seal block for Library mode */
block ER_INITIAL_PSP_SEAL,
# endif
-#endif /* defined(__ARM_ARCH_8M_MAIN__) || defined(__ARM_ARCH_8M_BASE__) || \
- * defined(__ARM_ARCH_8_1M_MAIN__) */
+#endif /* (defined(__ARM8M_MAINLINE__) && (__CORE__ == __ARM8M_MAINLINE__)) || \
+ * (defined(__ARM8M_BASELINE__) && (__CORE__ == __ARM8M_BASELINE__)) || \
+ * (defined(__ARM8EM_MAINLINE__) && (__CORE__ == __ARM8EM_MAINLINE__)) */
#if !defined(TFM_PSA_API)
block TFM_SECURE_STACK,
@@ -345,8 +351,9 @@
*/
block TFM_APP_RW_STACK_END,
-#if defined(__ARM_ARCH_6M__) || defined(__ARM_ARCH_7M__) || \
- defined(__ARM_ARCH_7EM__)
+#if ((defined(__ARM6M__) && (__CORE__ == __ARM6M__)) || \
+ (defined(__ARM7M__) && (__CORE__ == __ARM7M__)) || \
+ (defined(__ARM7EM__) && (__CORE__ == __ARM7EM__)))
#ifdef S_DATA_PRIV_START
/**** Privileged data area base address specified by Armv6-M/v7-M platform */
};
@@ -360,8 +367,9 @@
*/
/* Shared area between BL2 and runtime to exchange data */
overlay STACK_DATA,
-#endif /* defined(__ARM_ARCH_6M__) || defined(__ARM_ARCH_7M__) || \
- * defined(__ARM_ARCH_7EM__) */
+#endif /* (defined(__ARM6M__) && (__CORE__ == __ARM6M__)) || \
+ * (defined(__ARM7M__) && (__CORE__ == __ARM7M__)) || \
+ * (defined(__ARM7EM__) && (__CORE__ == __ARM7EM__)) */
#if defined(ENABLE_HEAP)
block ARM_LIB_HEAP,
@@ -402,8 +410,9 @@
};
place at address S_DATA_START { block DATA };
-#if (defined(__ARM_ARCH_6M__) || defined(__ARM_ARCH_7M__) || \
- defined(__ARM_ARCH_7EM__)) && defined(S_DATA_PRIV_START)
+#if ((defined(__ARM6M__) && (__CORE__ == __ARM6M__)) || \
+ (defined(__ARM7M__) && (__CORE__ == __ARM7M__)) || \
+ (defined(__ARM7EM__) && (__CORE__ == __ARM7EM__))) && defined(S_DATA_PRIV_START)
place at address S_DATA_PRIV_START { block PRIV_DATA };
#endif
diff --git a/secure_fw/spm/cmsis_psa/arch/tfm_arch.c b/secure_fw/spm/cmsis_psa/arch/tfm_arch.c
index e30da0b..86523fd 100644
--- a/secure_fw/spm/cmsis_psa/arch/tfm_arch.c
+++ b/secure_fw/spm/cmsis_psa/arch/tfm_arch.c
@@ -11,6 +11,9 @@
#include "utilities.h"
#include "config_impl.h"
+#if defined(__ICCARM__) && (CONFIG_TFM_FP >= 1)
+#pragma required = tfm_arch_clear_fp_data
+#endif
__naked void tfm_arch_free_msp_and_exc_ret(uint32_t msp_base,
uint32_t exc_return)
diff --git a/toolchain_IARARM.cmake b/toolchain_IARARM.cmake
index 67d97e3..fc9f1e7 100644
--- a/toolchain_IARARM.cmake
+++ b/toolchain_IARARM.cmake
@@ -1,6 +1,6 @@
#-------------------------------------------------------------------------------
# Copyright (c) 2020, IAR Systems AB. All rights reserved.
-# Copyright (c) 2020, Arm Limited. All rights reserved.
+# Copyright (c) 2020-2022, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -50,7 +50,7 @@
$<$<COMPILE_LANGUAGE:C,CXX>:-D_NO_DEFINITIONS_IN_HEADER_FILES>
$<$<COMPILE_LANGUAGE:C,CXX>:--diag_suppress=Pe546,Pe940,Pa082,Pa084>
$<$<COMPILE_LANGUAGE:C,CXX>:--no_path_in_file_macros>
- $<$<COMPILE_LANGUAGE:C,CXX,ASM>:--fpu=none>
+ "$<$<COMPILE_LANGUAGE:C,CXX,ASM>:SHELL:--fpu none>"
$<$<AND:$<COMPILE_LANGUAGE:C,CXX,ASM>,$<BOOL:${TFM_DEBUG_SYMBOLS}>,$<CONFIG:Release,MinSizeRel>>:-r>
)
endmacro()
@@ -62,7 +62,7 @@
--silent
--semihosting
--redirect __write=__write_buffered
- --fpu=none
+ "SHELL:--fpu none"
)
endmacro()