Build: Disable __get_LR() for IAR
__get_LR() is a builtin in IAR, with a slightly different definition
from the ones in TF_M, which causes compilation errors in an
upcoming IAR release.
Signed-off-by: TTornblom <thomas.tornblom@iar.com>
Change-Id: I5b9ca61f53206821d354240e700c5f71b14551c9
diff --git a/platform/ext/target/stm/common/stm32l5xx/CMSIS_Driver/low_level_flash.c b/platform/ext/target/stm/common/stm32l5xx/CMSIS_Driver/low_level_flash.c
index dd55ce4..173b681 100644
--- a/platform/ext/target/stm/common/stm32l5xx/CMSIS_Driver/low_level_flash.c
+++ b/platform/ext/target/stm/common/stm32l5xx/CMSIS_Driver/low_level_flash.c
@@ -522,19 +522,20 @@
* @param None.
* @retval LR Register value
*/
+#if !defined ( __ICCARM__ )
__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_LR(void)
{
register uint32_t result;
-#if defined ( __ICCARM__ ) || ( __GNUC__ )
+#if defined ( __GNUC__ )
__ASM volatile("MOV %0, LR" : "=r"(result));
#elif defined ( __CC_ARM )
__ASM volatile("MOV result, __return_address()");
-#endif /* ( __ICCARM__ ) || ( __GNUC__ ) */
+#endif /* ( __GNUC__ ) */
return result;
}
-
+#endif
/*
As this handler code relies on stack pointer position to manipulate the PC return value, it is important
diff --git a/secure_fw/spm/include/tfm_arch.h b/secure_fw/spm/include/tfm_arch.h
index 988c575..df16b3b 100644
--- a/secure_fw/spm/include/tfm_arch.h
+++ b/secure_fw/spm/include/tfm_arch.h
@@ -51,6 +51,7 @@
* \details Returns the value of the Link Register (LR)
* \return LR value
*/
+#if !defined ( __ICCARM__ )
__attribute__ ((always_inline)) __STATIC_INLINE uint32_t __get_LR(void)
{
register uint32_t result;
@@ -58,6 +59,7 @@
__ASM volatile ("MOV %0, LR\n" : "=r" (result));
return result;
}
+#endif
__attribute__ ((always_inline))
__STATIC_INLINE uint32_t __get_active_exc_num(void)