zephyr/cmake/compiler/gcc/target_riscv.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

35 lines
1015 B
CMake

# SPDX-License-Identifier: Apache-2.0
set(riscv_mabi "lp")
set(riscv_march "rv")
if(CONFIG_64BIT)
string(CONCAT riscv_mabi ${riscv_mabi} "64")
string(CONCAT riscv_march ${riscv_march} "64ima")
list(APPEND TOOLCHAIN_C_FLAGS -mcmodel=medany)
else()
string(CONCAT riscv_mabi "i" ${riscv_mabi} "32")
string(CONCAT riscv_march ${riscv_march} "32ima")
endif()
if(CONFIG_FPU)
if(CONFIG_CPU_HAS_FPU_DOUBLE_PRECISION)
if(CONFIG_FLOAT_HARD)
string(CONCAT riscv_mabi ${riscv_mabi} "d")
endif()
string(CONCAT riscv_march ${riscv_march} "fd")
else()
if(CONFIG_FLOAT_HARD)
string(CONCAT riscv_mabi ${riscv_mabi} "f")
endif()
string(CONCAT riscv_march ${riscv_march} "f")
endif()
endif()
if(CONFIG_COMPRESSED_ISA)
string(CONCAT riscv_march ${riscv_march} "c")
endif()
list(APPEND TOOLCHAIN_C_FLAGS -mabi=${riscv_mabi} -march=${riscv_march})
list(APPEND TOOLCHAIN_LD_FLAGS -mabi=${riscv_mabi} -march=${riscv_march})