Build: Create dedicated FP flags for Arm assembler(armasm).

As armasm does not support -mfloat-abi option for armclang to
specify whether to use hardware instructions or software library
functions for floating-point operations, compilation fails and
reports errors. Create a dedicated FP flags for assembler instead
of sharing the same FP flags with armclang.
Note armlink uses the same FP flags as armasm.

Signed-off-by: Chendi Sun <chendi.sun@arm.com>
Change-Id: If98f4accf237051e4bd9e0dee20ff0dce165400d
diff --git a/config/cp_check.cmake b/config/cp_check.cmake
index 408314b..ad6adb8 100644
--- a/config/cp_check.cmake
+++ b/config/cp_check.cmake
@@ -10,7 +10,7 @@
 tfm_invalid_config(NOT CMAKE_C_COMPILER_ID STREQUAL "GNU" AND (CONFIG_TFM_ENABLE_MVE OR CONFIG_TFM_ENABLE_MVE_FP))
 tfm_invalid_config((NOT CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_ID STREQUAL "ARMClang") AND CONFIG_TFM_ENABLE_FP)
 tfm_invalid_config((NOT CONFIG_TFM_FP_ARCH) AND (CONFIG_TFM_ENABLE_FP OR CONFIG_TFM_ENABLE_MVE_FP))
-tfm_invalid_config((CMAKE_C_COMPILER_ID STREQUAL "ARMClang") AND (NOT CONFIG_TFM_FP_ARCH_LINK) AND (CONFIG_TFM_ENABLE_FP OR CONFIG_TFM_ENABLE_MVE_FP))
+tfm_invalid_config((CMAKE_C_COMPILER_ID STREQUAL "ARMClang") AND (NOT CONFIG_TFM_FP_ARCH_ASM) AND CONFIG_TFM_ENABLE_FP)
 tfm_invalid_config((NOT CONFIG_TFM_ENABLE_FP AND NOT CONFIG_TFM_ENABLE_MVE AND NOT CONFIG_TFM_ENABLE_MVE_FP) AND CONFIG_TFM_LAZY_STACKING)
 tfm_invalid_config((CONFIG_TFM_ENABLE_FP OR CONFIG_TFM_ENABLE_MVE OR CONFIG_TFM_ENABLE_MVE_FP) AND NOT CONFIG_TFM_ENABLE_CP10CP11)
 
diff --git a/platform/ext/target/arm/mps2/an521/preload.cmake b/platform/ext/target/arm/mps2/an521/preload.cmake
index 2694a89..63b2cf5 100644
--- a/platform/ext/target/arm/mps2/an521/preload.cmake
+++ b/platform/ext/target/arm/mps2/an521/preload.cmake
@@ -15,4 +15,4 @@
 set(TFM_SYSTEM_ARCHITECTURE armv8-m.main)
 set(TFM_SYSTEM_DSP OFF)
 set(CONFIG_TFM_FP_ARCH "fpv5-d16")
-set(CONFIG_TFM_FP_ARCH_LINK "FPv5_D16")
+set(CONFIG_TFM_FP_ARCH_ASM "FPv5_D16")
diff --git a/platform/ext/target/arm/mps3/an552/preload.cmake b/platform/ext/target/arm/mps3/an552/preload.cmake
index 394d971..51f48b4 100644
--- a/platform/ext/target/arm/mps3/an552/preload.cmake
+++ b/platform/ext/target/arm/mps3/an552/preload.cmake
@@ -14,4 +14,4 @@
 set(TFM_SYSTEM_PROCESSOR cortex-m55)
 set(TFM_SYSTEM_ARCHITECTURE armv8.1-m.main)
 set(CONFIG_TFM_FP_ARCH "fpv5-d16")
-set(CONFIG_TFM_FP_ARCH_LINK "FPv5_D16")
+set(CONFIG_TFM_FP_ARCH_ASM "FPv5_D16")
diff --git a/toolchain_ARMCLANG.cmake b/toolchain_ARMCLANG.cmake
index 6645bfb..b7862ae 100644
--- a/toolchain_ARMCLANG.cmake
+++ b/toolchain_ARMCLANG.cmake
@@ -216,7 +216,10 @@
         set(CMAKE_CXX_FLAGS "-march=${CMAKE_SYSTEM_ARCH}")
     endif()
 
-    set(BL2_COMPILER_CP_FLAG -mfloat-abi=soft)
+    set(BL2_COMPILER_CP_FLAG
+        $<$<COMPILE_LANGUAGE:C>:-mfpu=softvfp>
+        $<$<COMPILE_LANGUAGE:ASM>:--fpu=softvfp>
+    )
     # As BL2 does not use hardware FPU, specify '--fpu=SoftVFP' explicitly to use software
     # library functions for BL2 to override any implicit FPU option, such as '--cpu' option.
     # Because the implicit hardware FPU option enforces BL2 to initialize FPU but hardware FPU
@@ -224,13 +227,24 @@
     set(BL2_LINKER_CP_OPTION --fpu=SoftVFP)
 
     if (CONFIG_TFM_FLOAT_ABI STREQUAL "hard")
-        set(COMPILER_CP_FLAG -mfloat-abi=hard)
+        set(COMPILER_CP_FLAG
+            $<$<COMPILE_LANGUAGE:C>:-mfloat-abi=hard>
+        )
         if (CONFIG_TFM_ENABLE_FP)
-            set(COMPILER_CP_FLAG -mfloat-abi=hard -mfpu=${CONFIG_TFM_FP_ARCH})
-            set(LINKER_CP_OPTION --fpu=${CONFIG_TFM_FP_ARCH_LINK})
+            set(COMPILER_CP_FLAG
+                $<$<COMPILE_LANGUAGE:C>:-mfpu=${CONFIG_TFM_FP_ARCH};-mfloat-abi=hard>
+                $<$<COMPILE_LANGUAGE:ASM>:--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_FLAG -mfloat-abi=soft)
+        set(COMPILER_CP_FLAG
+            $<$<COMPILE_LANGUAGE:C>:-mfpu=softvfp>
+            $<$<COMPILE_LANGUAGE:ASM>:--fpu=softvfp>
+        )
         set(LINKER_CP_OPTION --fpu=SoftVFP)
     endif()