1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-28 16:01:18 +01:00

cpu/cortexm: Add 'cortexm_fpu' as a DEFAULT_MODULE if possible

This adds cortexm_fpu to the DEFAULT_MODULE list when the feature
cortexm_fpu is provided by the architecture. It also moves the
dependency resolution of this module to the architecture-specific
Makefile.dep file.
This commit is contained in:
Leandro Lanzieri 2020-03-27 13:17:52 +01:00
parent 64552a3b9a
commit ea2f963302
No known key found for this signature in database
GPG Key ID: 39607DE6080007A3
3 changed files with 20 additions and 15 deletions

View File

@ -12,3 +12,9 @@ USEMODULE += newlib_nano
# Export the peripheral drivers to be linked into the final binary:
USEMODULE += periph
# Use Hardware FPU by default if present
FEATURES_OPTIONAL += cortexm_fpu
ifneq (,$(filter cortexm_fpu,$(FEATURES_USED)))
DEFAULT_MODULE += cortexm_fpu
endif

View File

@ -5,3 +5,8 @@ FEATURES_PROVIDED += periph_pm
FEATURES_PROVIDED += cpp
FEATURES_PROVIDED += cpu_check_address
FEATURES_PROVIDED += ssp
# cortex-m4f and cortex-m7 provide FPU support
ifneq (,$(filter $(CPU_ARCH),cortex-m4f cortex-m7))
FEATURES_PROVIDED += cortexm_fpu
endif

View File

@ -60,24 +60,18 @@ endif # BUILD_IN_DOCKER
CFLAGS += -DCPU_MODEL_$(call uppercase_and_underscore,$(CPU_MODEL))
CFLAGS += -DCPU_ARCH_$(call uppercase_and_underscore,$(CPU_ARCH))
# set the compiler specific CPU and FPU options
ifneq (,$(filter $(CPU_ARCH),cortex-m4f cortex-m7))
ifneq (,$(filter cortexm_fpu,$(DISABLE_MODULE)))
CFLAGS_FPU ?= -mfloat-abi=soft
# Add corresponding FPU CFLAGS
# clang assumes there is an FPU, no CFLAGS necessary
ifneq (llvm, $(TOOLCHAIN))
ifeq ($(CPU_ARCH),cortex-m7)
_CORTEX_HW_FPU_CFLAGS = -mfloat-abi=hard -mfpu=fpv5-sp-d16
else
USEMODULE += cortexm_fpu
# clang assumes there is an FPU
ifneq (llvm,$(TOOLCHAIN))
ifeq ($(CPU_ARCH),cortex-m7)
CFLAGS_FPU ?= -mfloat-abi=hard -mfpu=fpv5-sp-d16
else
CFLAGS_FPU ?= -mfloat-abi=hard -mfpu=fpv4-sp-d16
endif
endif
_CORTEX_HW_FPU_CFLAGS = -mfloat-abi=hard -mfpu=fpv4-sp-d16
endif
else
CFLAGS_FPU ?= -mfloat-abi=soft
endif
# Add soft or hard FPU CFLAGS depending on the module
# NOTE: This can be turned into normal conditional syntax once #9913 is fixed
CFLAGS_FPU ?= $(if $(filter cortexm_fpu,$(USEMODULE)),$(_CORTEX_HW_FPU_CFLAGS),-mfloat-abi=soft)
ifeq ($(CPU_ARCH),cortex-m4f)
MCPU = cortex-m4