zephyr/cmake/compiler/gcc/target_arm.cmake
Stephanos Ioannidis 0e6ede8929 kconfig: Rename CONFIG_FLOAT to CONFIG_FPU
This commit renames the Kconfig `FLOAT` symbol to `FPU`, since this
symbol only indicates that the hardware Floating Point Unit (FPU) is
used and does not imply and/or indicate the general availability of
toolchain-level floating point support (i.e. this symbol is not
selected when building for an FPU-less platform that supports floating
point operations through the toolchain-provided software floating point
library).

Moreover, given that the symbol that indicates the availability of FPU
is named `CPU_HAS_FPU`, it only makes sense to use "FPU" in the name of
the symbol that enables the FPU.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-04-27 19:03:44 +02:00

44 lines
1.4 KiB
CMake

# SPDX-License-Identifier: Apache-2.0
if(CONFIG_ARM64)
list(APPEND TOOLCHAIN_C_FLAGS -mcpu=${GCC_M_CPU})
list(APPEND TOOLCHAIN_LD_FLAGS -mcpu=${GCC_M_CPU})
list(APPEND TOOLCHAIN_C_FLAGS -mabi=lp64)
list(APPEND TOOLCHAIN_LD_FLAGS -mabi=lp64)
else()
list(APPEND TOOLCHAIN_C_FLAGS -mcpu=${GCC_M_CPU})
list(APPEND TOOLCHAIN_LD_FLAGS -mcpu=${GCC_M_CPU})
if(CONFIG_COMPILER_ISA_THUMB2)
list(APPEND TOOLCHAIN_C_FLAGS -mthumb)
list(APPEND TOOLCHAIN_LD_FLAGS -mthumb)
endif()
list(APPEND TOOLCHAIN_C_FLAGS -mabi=aapcs)
list(APPEND TOOLCHAIN_LD_FLAGS -mabi=aapcs)
# Defines a mapping from GCC_M_CPU to FPU
if(CONFIG_CPU_HAS_FPU_DOUBLE_PRECISION)
set(PRECISION_TOKEN)
else()
set(PRECISION_TOKEN sp-)
endif()
set(FPU_FOR_cortex-m4 fpv4-${PRECISION_TOKEN}d16)
set(FPU_FOR_cortex-m7 fpv5-${PRECISION_TOKEN}d16)
set(FPU_FOR_cortex-m33 fpv5-${PRECISION_TOKEN}d16)
if(CONFIG_FPU)
list(APPEND TOOLCHAIN_C_FLAGS -mfpu=${FPU_FOR_${GCC_M_CPU}})
list(APPEND TOOLCHAIN_LD_FLAGS -mfpu=${FPU_FOR_${GCC_M_CPU}})
if (CONFIG_FP_SOFTABI)
list(APPEND TOOLCHAIN_C_FLAGS -mfloat-abi=softfp)
list(APPEND TOOLCHAIN_LD_FLAGS -mfloat-abi=softfp)
elseif(CONFIG_FP_HARDABI)
list(APPEND TOOLCHAIN_C_FLAGS -mfloat-abi=hard)
list(APPEND TOOLCHAIN_LD_FLAGS -mfloat-abi=hard)
endif()
endif()
endif()