build: Add IAR FPU support

Signed-off-by: Dávid Házi <david.hazi@arm.com>
Change-Id: I395609b9f02d928fcf547f3b9072264b2527b57a
diff --git a/platform/ext/common/test_interrupt.c b/platform/ext/common/test_interrupt.c
index 5a49f9c..c0b7fa6 100644
--- a/platform/ext/common/test_interrupt.c
+++ b/platform/ext/common/test_interrupt.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022, Arm Limited. All rights reserved.
+ * Copyright (c) 2022-2024, Arm Limited. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  *
@@ -97,7 +97,7 @@
         * If LR.BIT[6] equals 1, the interrupt is triggerred by secure thread.
         */
         "ands      r0, lr, #0x40           \n"
-        "cmp       r0, 0x40                \n"
+        "cmp       r0, #0x40               \n"
         "bne       change_regs             \n"
         "push      {r7, lr}                \n"
         "vpush     {s0-s15}                \n"
@@ -109,7 +109,7 @@
         "vpop      {s0-s15}                \n"
         "pop       {r7, lr}                \n"
         "cmp       r0, #0                  \n"
-        "bne       panic                   \n"
+        "bne.w     panic                   \n"
     "change_regs:                          \n"
         "mov       r0, #0x000000E0         \n"
         "vmov      s0, r0                  \n"
diff --git a/platform/ns/toolchain_ns_IARARM.cmake b/platform/ns/toolchain_ns_IARARM.cmake
index 9c99f67..f8d0385 100644
--- a/platform/ns/toolchain_ns_IARARM.cmake
+++ b/platform/ns/toolchain_ns_IARARM.cmake
@@ -1,5 +1,5 @@
 #-------------------------------------------------------------------------------
-# Copyright (c) 2023, Arm Limited. All rights reserved.
+# Copyright (c) 2023-2024, Arm Limited. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
@@ -42,7 +42,6 @@
         $<$<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>:SHELL:--fpu none>"
         $<$<AND:$<COMPILE_LANGUAGE:C,CXX,ASM>,$<BOOL:${TFM_DEBUG_SYMBOLS}>,$<CONFIG:Release,MinSizeRel>>:-r>
     )
 endmacro()
@@ -55,7 +54,6 @@
       --semihosting
       --redirect __write=__write_buffered
       --diag_suppress=lp005
-      "SHELL:--fpu none"
     )
 endmacro()
 
@@ -102,6 +100,26 @@
                 " cores with IAR version between 9.20 and 9.32.1")
     endif()
 
+    if (CONFIG_TFM_FLOAT_ABI STREQUAL "hard")
+        if (CONFIG_TFM_ENABLE_FP)
+            set(COMPILER_CP_C_FLAG "--fpu=${CONFIG_TFM_FP_ARCH_ASM}")
+            set(COMPILER_CP_ASM_FLAG "--fpu=${CONFIG_TFM_FP_ARCH_ASM}")
+            # armasm and armlink have the same option "--fpu" and are both used to
+            # specify the target FPU architecture. So the supported FPU architecture
+            # names can be shared by armasm and armlink.
+            set(LINKER_CP_OPTION "--fpu=${CONFIG_TFM_FP_ARCH_ASM}")
+        endif()
+    else()
+        set(COMPILER_CP_C_FLAG   "--fpu=none")
+        set(COMPILER_CP_ASM_FLAG "--fpu=none")
+        set(LINKER_CP_OPTION     "--fpu=none")
+    endif()
+
+    string(APPEND CMAKE_C_FLAGS " " ${COMPILER_CP_C_FLAG})
+    string(APPEND CMAKE_ASM_FLAGS " " ${COMPILER_CP_ASM_FLAG})
+    string(APPEND CMAKE_C_LINK_FLAGS " " ${LINKER_CP_OPTION})
+    string(APPEND CMAKE_ASM_LINK_FLAGS " " ${LINKER_CP_OPTION})
+
 endmacro()
 
 # Configure environment for the compiler setup run by cmake at the first