[fpu] have the arch layers set WITH_NO_FPU based on the cpu

This will generally turn off more FPU codegen, even if its using
software fallback unless the project/target/platform selects a cpu that
has FPU support. This also turns off a few blocks of test code and the
upcoming floating point printf if it's not present on the arch.

This may break projects that were compiling for say cortex-m0 but
expected FPU code to be present. If so it should be pretty easy to
override it, but not going to add that yet unless it's necessary.
This commit is contained in:
Travis Geiselbrecht
2025-10-08 23:41:13 -07:00
parent 85e35e1426
commit 5016118509
6 changed files with 35 additions and 23 deletions

View File

@@ -18,7 +18,8 @@ GLOBAL_DEFINES += \
ARM_CPU_CORTEX_M0=1 \
ARM_ISA_ARMV6M=1 \
ARM_WITH_THUMB=1 \
USE_BUILTIN_ATOMICS=0
USE_BUILTIN_ATOMICS=0 \
WITH_NO_FP=1
HANDLED_CORE := true
ENABLE_THUMB := true
SUBARCH := arm-m
@@ -28,7 +29,8 @@ GLOBAL_DEFINES += \
ARM_CPU_CORTEX_M0_PLUS=1 \
ARM_ISA_ARMV6M=1 \
ARM_WITH_THUMB=1 \
USE_BUILTIN_ATOMICS=0
USE_BUILTIN_ATOMICS=0 \
WITH_NO_FP=1
HANDLED_CORE := true
ENABLE_THUMB := true
SUBARCH := arm-m
@@ -39,7 +41,8 @@ GLOBAL_DEFINES += \
ARM_ISA_ARMv7=1 \
ARM_ISA_ARMv7M=1 \
ARM_WITH_THUMB=1 \
ARM_WITH_THUMB2=1
ARM_WITH_THUMB2=1 \
WITH_NO_FP=1
HANDLED_CORE := true
ENABLE_THUMB := true
SUBARCH := arm-m
@@ -50,7 +53,8 @@ GLOBAL_DEFINES += \
ARM_ISA_ARMv7=1 \
ARM_ISA_ARMv7M=1 \
ARM_WITH_THUMB=1 \
ARM_WITH_THUMB2=1
ARM_WITH_THUMB2=1 \
WITH_NO_FP=1
HANDLED_CORE := true
ENABLE_THUMB := true
SUBARCH := arm-m
@@ -76,7 +80,8 @@ GLOBAL_DEFINES += \
ARM_ISA_ARMv7M=1 \
ARM_WITH_THUMB=1 \
ARM_WITH_THUMB2=1 \
ARM_WITH_CACHE=1
ARM_WITH_CACHE=1 \
WITH_NO_FP=1
HANDLED_CORE := true
ENABLE_THUMB := true
SUBARCH := arm-m
@@ -102,7 +107,8 @@ GLOBAL_DEFINES += \
ARM_WITH_THUMB2=1 \
ARM_WITH_CACHE=1 \
ARM_WITH_VFP=1 \
ARM_WITH_VFP_SP_ONLY=1
ARM_WITH_VFP_SP_ONLY=1 \
WITH_NO_FP=1
HANDLED_CORE := true
ENABLE_THUMB := true
SUBARCH := arm-m
@@ -135,6 +141,8 @@ ifneq ($(ARM_WITHOUT_VFP_NEON),true)
GLOBAL_DEFINES += \
ARM_WITH_VFP=1 \
ARM_WITH_NEON=1
else
GLOBAL_DEFINES += WITH_NO_FP=1
endif
HANDLED_CORE := true
endif
@@ -160,7 +168,8 @@ GLOBAL_DEFINES += \
ARM_ISA_ARMv7A=1 \
ARM_WITH_THUMB=1 \
ARM_WITH_THUMB2=1 \
ARM_WITH_CACHE=1
ARM_WITH_CACHE=1 \
WITH_NO_FP=1
HANDLED_CORE := true
endif
ifeq ($(ARM_CPU),cortex-a9-neon)
@@ -184,7 +193,8 @@ GLOBAL_DEFINES += \
ARM_ISA_ARMv6=1 \
ARM_WITH_THUMB=1 \
ARM_WITH_CACHE=1 \
ARM_CPU_ARM1136=1
ARM_CPU_ARM1136=1 \
WITH_NO_FP=1
HANDLED_CORE := true
endif
ifeq ($(ARM_CPU),arm1176jzf-s)
@@ -204,8 +214,8 @@ GLOBAL_DEFINES += \
ARM_ISA_ARMv7=1 \
ARM_WITH_VFP=1 \
ARM_WITH_THUMB=1
ENABLE_THUMB := true
HANDLED_CORE := true
ENABLE_THUMB := true
HANDLED_CORE := true
endif
ifeq ($(ARM_CPU),armemu)
# flavor of emulated cpu by the armemu project
@@ -213,7 +223,8 @@ GLOBAL_DEFINES += \
ARM_WITH_CP15=1 \
ARM_ISA_ARMv7=1 \
ARM_ISA_ARMv7A=1 \
ARM_WITH_CACHE=1
ARM_WITH_CACHE=1 \
WITH_NO_FP=1
HANDLED_CORE := true
ENABLE_THUMB := false # armemu doesn't currently support thumb properly
endif

View File

@@ -21,10 +21,13 @@ M68K_CPU ?= 68040 # default to 040
ifeq ($(M68K_CPU),68000)
ARCH_COMPILEFLAGS := -mcpu=68000
GLOBAL_DEFINES += WITH_NO_FP=1
else ifeq ($(M68K_CPU),68010)
ARCH_COMPILEFLAGS := -mcpu=68010
GLOBAL_DEFINES += WITH_NO_FP=1
else ifeq ($(M68K_CPU),68020)
ARCH_COMPILEFLAGS := -mcpu=68020
GLOBAL_DEFINES += WITH_NO_FP=1
else ifeq ($(M68K_CPU),68030)
ARCH_COMPILEFLAGS := -mcpu=68030
else ifeq ($(M68K_CPU),68040)

View File

@@ -135,6 +135,8 @@ endif
ifeq (true,$(call TOBOOL,$(RISCV_FPU)))
GLOBAL_DEFINES += RISCV_FPU=1
else
GLOBAL_DEFINES += WITH_NO_FP=1
endif
# based on a list of optional extensions passed in, collapse the extensions into