1# SPDX-License-Identifier: Apache-2.0
2
3set(ARM_C_FLAGS)
4
5list(APPEND ARM_C_FLAGS   -mcpu=${GCC_M_CPU})
6
7if(CONFIG_COMPILER_ISA_THUMB2)
8  list(APPEND ARM_C_FLAGS   -mthumb)
9endif()
10
11list(APPEND ARM_C_FLAGS -mabi=aapcs)
12
13if(CONFIG_FPU)
14  list(APPEND ARM_C_FLAGS   -mfpu=${GCC_M_FPU})
15
16  if(CONFIG_DCLS AND NOT CONFIG_FP_HARDABI)
17    # If the processor is equipped with VFP and configured in DCLS topology,
18    # the FP "hard" ABI must be used in order to facilitate the FP register
19    # initialisation and synchronisation.
20    set(FORCE_FP_HARDABI TRUE)
21  endif()
22
23  if    (CONFIG_FP_HARDABI OR FORCE_FP_HARDABI)
24    list(APPEND ARM_C_FLAGS   -mfloat-abi=hard)
25  elseif(CONFIG_FP_SOFTABI)
26    list(APPEND ARM_C_FLAGS   -mfloat-abi=softfp)
27  endif()
28endif()
29
30if(CONFIG_FP16)
31  # Clang only supports IEEE 754-2008 format for __fp16. It's enabled by
32  # default, so no need to do anything when CONFIG_FP16_IEEE is selected.
33  if(CONFIG_FP16_ALT)
34    message(FATAL_ERROR "Clang doesn't support ARM alternative format for FP16")
35  endif()
36endif()
37list(APPEND TOOLCHAIN_C_FLAGS ${ARM_C_FLAGS})
38list(APPEND TOOLCHAIN_LD_FLAGS NO_SPLIT ${ARM_C_FLAGS})
39