Skip to content

Commit ece4e21

Browse files
committed
stm32/Makefile: Only enable hardware sqrt on parts that support it.
Not enough to detect f7/h7, need to use the specific parts. Follow-up to 580a265.
1 parent f69ef97 commit ece4e21

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

ports/stm32/Makefile

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,18 @@ INC += -Ilwip_inc
6464
CFLAGS_CORTEX_M = -mthumb
6565

6666
# Select hardware floating-point support
67+
SUPPORTS_HARDWARE_FP_SINGLE = 0
68+
SUPPORTS_HARDWARE_FP_DOUBLE = 0
6769
ifeq ($(CMSIS_MCU),$(filter $(CMSIS_MCU),STM32F765xx STM32F767xx STM32F769xx STM32H743xx))
6870
CFLAGS_CORTEX_M += -mfpu=fpv5-d16 -mfloat-abi=hard
71+
SUPPORTS_HARDWARE_FP_SINGLE = 1
72+
SUPPORTS_HARDWARE_FP_DOUBLE = 1
6973
else
7074
ifeq ($(MCU_SERIES),$(filter $(MCU_SERIES),f0 l0))
7175
CFLAGS_CORTEX_M += -msoft-float
7276
else
7377
CFLAGS_CORTEX_M += -mfpu=fpv4-sp-d16 -mfloat-abi=hard
78+
SUPPORTS_HARDWARE_FP_SINGLE = 1
7479
endif
7580
endif
7681

@@ -180,7 +185,7 @@ SRC_LIBM = $(addprefix lib/libm_dbl/,\
180185
tgamma.c \
181186
trunc.c \
182187
)
183-
ifeq ($(MCU_SERIES),$(filter $(MCU_SERIES),f7 h7))
188+
ifeq ($(SUPPORTS_HARDWARE_FP_DOUBLE),1)
184189
SRC_LIBM += lib/libm_dbl/thumb_vfp_sqrt.c
185190
else
186191
SRC_LIBM += lib/libm_dbl/sqrt.c
@@ -213,10 +218,10 @@ SRC_LIBM = $(addprefix lib/libm/,\
213218
wf_lgamma.c \
214219
wf_tgamma.c \
215220
)
216-
ifeq ($(MCU_SERIES),$(filter $(MCU_SERIES),f0 l0))
217-
SRC_LIBM += lib/libm/ef_sqrt.c
218-
else
221+
ifeq ($(SUPPORTS_HARDWARE_FP_SINGLE),1)
219222
SRC_LIBM += lib/libm/thumb_vfp_sqrtf.c
223+
else
224+
SRC_LIBM += lib/libm/ef_sqrt.c
220225
endif
221226
endif
222227

0 commit comments

Comments
 (0)