ports: Switch build to use common lib/libm list of source files.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George 2023-12-08 15:42:41 +11:00
parent 241dbac928
commit e1a7aa23fd
8 changed files with 33 additions and 352 deletions

View File

@ -127,35 +127,8 @@ SRC_C += \
modespnow.c
endif
LIB_SRC_C = $(addprefix lib/,\
libm/math.c \
libm/fmodf.c \
libm/nearbyintf.c \
libm/ef_sqrt.c \
libm/erf_lgamma.c \
libm/kf_rem_pio2.c \
libm/kf_sin.c \
libm/kf_cos.c \
libm/kf_tan.c \
libm/ef_rem_pio2.c \
libm/sf_erf.c \
libm/sf_sin.c \
libm/sf_cos.c \
libm/sf_tan.c \
libm/sf_frexp.c \
libm/sf_modf.c \
libm/sf_ldexp.c \
libm/acoshf.c \
libm/asinfacosf.c \
libm/asinhf.c \
libm/atanf.c \
libm/atanhf.c \
libm/atan2f.c \
libm/log1pf.c \
libm/roundf.c \
libm/wf_lgamma.c \
libm/wf_tgamma.c \
)
LIB_SRC_C += $(SRC_LIB_LIBM_C)
LIB_SRC_C += $(SRC_LIB_LIBM_SQRT_SW_C)
SHARED_SRC_C = $(addprefix shared/,\
libc/__errno.c \

View File

@ -269,26 +269,19 @@ endif
# Math library source files
ifeq ($(MICROPY_FLOAT_IMPL),double)
LIBM_SRC_C += $(addprefix lib/libm_dbl/,\
__cos.c __expo2.c __fpclassify.c __rem_pio2.c __rem_pio2_large.c __signbit.c __sin.c __tan.c acos.c acosh.c \
asin.c asinh.c atan.c atan2.c atanh.c ceil.c copysign.c cos.c cosh.c erf.c exp.c expm1.c floor.c fmod.c \
frexp.c ldexp.c lgamma.c log.c log10.c log1p.c modf.c nearbyint.c pow.c rint.c round.c scalbn.c sin.c \
sinh.c tan.c tanh.c tgamma.c trunc.c)
LIBM_SRC_C += $(SRC_LIB_LIBM_DBL_C)
#
ifeq ($(SUPPORTS_HARDWARE_FP_DOUBLE),1)
LIBM_SRC_C += lib/libm_dbl/thumb_vfp_sqrt.c
LIBM_SRC_C += $(SRC_LIB_LIBM_DBL_SQRT_HW_C)
else
LIBM_SRC_C += lib/libm_dbl/sqrt.c
LIBM_SRC_C += $(SRC_LIB_LIBM_DBL_SQRT_SW_C)
endif
else
LIBM_SRC_C += $(addprefix lib/libm/,\
acoshf.c asinfacosf.c asinhf.c atan2f.c atanf.c atanhf.c ef_rem_pio2.c erf_lgamma.c fmodf.c kf_cos.c \
kf_rem_pio2.c kf_sin.c kf_tan.c log1pf.c math.c nearbyintf.c roundf.c sf_cos.c sf_erf.c sf_frexp.c sf_ldexp.c \
sf_modf.c sf_sin.c sf_tan.c wf_lgamma.c wf_tgamma.c)
LIBM_SRC_C += $(SRC_LIB_LIBM_C)
ifeq ($(SUPPORTS_HARDWARE_FP_SINGLE),1)
LIBM_SRC_C += lib/libm/thumb_vfp_sqrtf.c
LIBM_SRC_C += $(SRC_LIB_LIBM_SQRT_HW_C)
else
LIBM_SRC_C += lib/libm/ef_sqrt.c
LIBM_SRC_C += $(SRC_LIB_LIBM_SQRT_SW_C)
endif
endif
@ -439,15 +432,9 @@ endif
# =============================================================================
LIBS = $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
LIBM_O = $(addprefix $(BUILD)/, $(LIBM_SRC_C:.c=.o))
# Too many warnings in libm_dbl, disable for now.
ifeq ($(MICROPY_FLOAT_IMPL),double)
$(LIBM_O): CFLAGS := $(filter-out -Wdouble-promotion -Wfloat-conversion, $(CFLAGS))
endif
OBJ += $(PY_O)
OBJ += $(LIBM_O)
OBJ += $(addprefix $(BUILD)/, $(LIBM_SRC_C:.c=.o))
OBJ += $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
OBJ += $(addprefix $(BUILD)/, $(SHARED_SRC_C:.c=.o))
OBJ += $(addprefix $(BUILD)/, $(DRIVERS_SRC_C:.c=.o))

View File

@ -167,69 +167,15 @@ LIBS = \
ifeq ($(MCU_VARIANT), nrf52)
SRC_LIB_C += $(addprefix lib/,\
libm/math.c \
libm/fmodf.c \
libm/nearbyintf.c \
libm/ef_sqrt.c \
libm/kf_rem_pio2.c \
libm/kf_sin.c \
libm/kf_cos.c \
libm/kf_tan.c \
libm/ef_rem_pio2.c \
libm/sf_sin.c \
libm/sf_cos.c \
libm/sf_tan.c \
libm/sf_frexp.c \
libm/sf_modf.c \
libm/sf_ldexp.c \
libm/asinfacosf.c \
libm/acoshf.c \
libm/asinhf.c \
libm/atanf.c \
libm/atan2f.c \
libm/atanhf.c \
libm/log1pf.c \
libm/sf_erf.c \
libm/erf_lgamma.c \
libm/wf_lgamma.c \
libm/wf_tgamma.c \
libm/roundf.c \
)
SRC_LIB_C += $(SRC_LIB_LIBM_C)
SRC_LIB_C += $(SRC_LIB_LIBM_SQRT_SW_C)
endif
ifeq ($(MCU_VARIANT), nrf91)
SRC_LIB_C += $(addprefix lib/,\
libm/math.c \
libm/fmodf.c \
libm/nearbyintf.c \
libm/ef_sqrt.c \
libm/kf_rem_pio2.c \
libm/kf_sin.c \
libm/kf_cos.c \
libm/kf_tan.c \
libm/ef_rem_pio2.c \
libm/sf_sin.c \
libm/sf_cos.c \
libm/sf_tan.c \
libm/sf_frexp.c \
libm/sf_modf.c \
libm/sf_ldexp.c \
libm/asinfacosf.c \
libm/acoshf.c \
libm/asinhf.c \
libm/atanf.c \
libm/atan2f.c \
libm/atanhf.c \
libm/log1pf.c \
libm/sf_erf.c \
libm/erf_lgamma.c \
libm/wf_lgamma.c \
libm/wf_tgamma.c \
libm/roundf.c \
)
SRC_LIB_C += $(SRC_LIB_LIBM_C)
SRC_LIB_C += $(SRC_LIB_LIBM_SQRT_SW_C)
include drivers/secureboot/secureboot.mk

View File

@ -88,27 +88,8 @@ SRC_TEST_C = \
test_main.c \
lib/tinytest/tinytest.c \
LIB_SRC_C += $(addprefix lib/,\
libm/math.c \
libm/fmodf.c \
libm/nearbyintf.c \
libm/ef_sqrt.c \
libm/kf_rem_pio2.c \
libm/kf_sin.c \
libm/kf_cos.c \
libm/kf_tan.c \
libm/ef_rem_pio2.c \
libm/sf_sin.c \
libm/sf_cos.c \
libm/sf_tan.c \
libm/sf_frexp.c \
libm/sf_modf.c \
libm/sf_ldexp.c \
libm/asinfacosf.c \
libm/atanf.c \
libm/atan2f.c \
libm/roundf.c \
)
LIB_SRC_C += $(SRC_LIB_LIBM_C)
LIB_SRC_C += $(SRC_LIB_LIBM_SQRT_SW_C)
OBJ_COMMON =
OBJ_COMMON += $(PY_O)

View File

@ -198,98 +198,21 @@ TINYUSB_SRC_C += $(addprefix lib/tinyusb/,\
)
ifeq ($(MICROPY_FLOAT_IMPL),double)
LIBM_SRC_C += $(addprefix lib/libm_dbl/,\
__cos.c \
__expo2.c \
__fpclassify.c \
__rem_pio2.c \
__rem_pio2_large.c \
__signbit.c \
__sin.c \
__tan.c \
acos.c \
acosh.c \
asin.c \
asinh.c \
atan.c \
atan2.c \
atanh.c \
ceil.c \
cos.c \
cosh.c \
copysign.c \
erf.c \
exp.c \
expm1.c \
floor.c \
fmod.c \
frexp.c \
ldexp.c \
lgamma.c \
log.c \
log10.c \
log1p.c \
modf.c \
nearbyint.c \
pow.c \
rint.c \
round.c \
scalbn.c \
sin.c \
sinh.c \
tan.c \
tanh.c \
tgamma.c \
trunc.c \
)
LIBM_SRC_C += $(SRC_LIB_LIBM_DBL_C)
ifeq ($(SUPPORTS_HARDWARE_FP_DOUBLE),1)
LIBM_SRC_C += lib/libm_dbl/thumb_vfp_sqrt.c
LIBM_SRC_C += $(SRC_LIB_LIBM_DBL_SQRT_HW_C)
else
LIBM_SRC_C += lib/libm_dbl/sqrt.c
LIBM_SRC_C += $(SRC_LIB_LIBM_DBL_SQRT_SW_C)
endif
else
LIBM_SRC_C += $(addprefix lib/libm/,\
math.c \
acoshf.c \
asinfacosf.c \
asinhf.c \
atan2f.c \
atanf.c \
atanhf.c \
ef_rem_pio2.c \
erf_lgamma.c \
fmodf.c \
kf_cos.c \
kf_rem_pio2.c \
kf_sin.c \
kf_tan.c \
log1pf.c \
nearbyintf.c \
roundf.c \
sf_cos.c \
sf_erf.c \
sf_frexp.c \
sf_ldexp.c \
sf_modf.c \
sf_sin.c \
sf_tan.c \
wf_lgamma.c \
wf_tgamma.c \
)
LIBM_SRC_C += $(SRC_LIB_LIBM_C)
ifeq ($(SUPPORTS_HARDWARE_FP_SINGLE),1)
LIBM_SRC_C += lib/libm/thumb_vfp_sqrtf.c
LIBM_SRC_C += $(SRC_LIB_LIBM_SQRT_HW_C)
else
LIBM_SRC_C += lib/libm/ef_sqrt.c
LIBM_SRC_C += $(SRC_LIB_LIBM_SQRT_SW_C)
endif
endif
LIBM_O = $(addprefix $(BUILD)/, $(LIBM_SRC_C:.c=.o))
# Too many warnings in libm_dbl, disable for now.
ifeq ($(MICROPY_FLOAT_IMPL),double)
$(LIBM_O): CFLAGS := $(filter-out -Wdouble-promotion -Wfloat-conversion, $(CFLAGS))
endif
DRIVERS_SRC_C += $(addprefix drivers/,\
bus/softspi.c \
bus/softqspi.c \
@ -470,7 +393,7 @@ endif
OBJ += $(PY_O)
OBJ += $(addprefix $(BUILD)/, $(LIB_SRC_C:.c=.o))
OBJ += $(LIBM_O)
OBJ += $(addprefix $(BUILD)/, $(LIBM_SRC_C:.c=.o))
OBJ += $(addprefix $(BUILD)/, $(SHARED_SRC_C:.c=.o))
OBJ += $(addprefix $(BUILD)/, $(DRIVERS_SRC_C:.c=.o))
OBJ += $(addprefix $(BUILD)/, $(HAL_SRC_C:.c=.o))

View File

@ -209,33 +209,8 @@ target_sources(pico_float_micropython INTERFACE
${PICO_SDK_PATH}/src/rp2_common/pico_float/float_aeabi.S
${PICO_SDK_PATH}/src/rp2_common/pico_float/float_init_rom.c
${PICO_SDK_PATH}/src/rp2_common/pico_float/float_v1_rom_shim.S
${MICROPY_DIR}/lib/libm/math.c
${MICROPY_DIR}/lib/libm/acoshf.c
${MICROPY_DIR}/lib/libm/asinfacosf.c
${MICROPY_DIR}/lib/libm/asinhf.c
${MICROPY_DIR}/lib/libm/atan2f.c
${MICROPY_DIR}/lib/libm/atanf.c
${MICROPY_DIR}/lib/libm/atanhf.c
${MICROPY_DIR}/lib/libm/ef_rem_pio2.c
${MICROPY_DIR}/lib/libm/ef_sqrt.c
${MICROPY_DIR}/lib/libm/erf_lgamma.c
${MICROPY_DIR}/lib/libm/fmodf.c
${MICROPY_DIR}/lib/libm/kf_cos.c
${MICROPY_DIR}/lib/libm/kf_rem_pio2.c
${MICROPY_DIR}/lib/libm/kf_sin.c
${MICROPY_DIR}/lib/libm/kf_tan.c
${MICROPY_DIR}/lib/libm/log1pf.c
${MICROPY_DIR}/lib/libm/nearbyintf.c
${MICROPY_DIR}/lib/libm/roundf.c
${MICROPY_DIR}/lib/libm/sf_cos.c
${MICROPY_DIR}/lib/libm/sf_erf.c
${MICROPY_DIR}/lib/libm/sf_frexp.c
${MICROPY_DIR}/lib/libm/sf_ldexp.c
${MICROPY_DIR}/lib/libm/sf_modf.c
${MICROPY_DIR}/lib/libm/sf_sin.c
${MICROPY_DIR}/lib/libm/sf_tan.c
${MICROPY_DIR}/lib/libm/wf_lgamma.c
${MICROPY_DIR}/lib/libm/wf_tgamma.c
${MICROPY_SOURCE_LIB_LIBM}
${MICROPY_SOURCE_LIB_LIBM_SQRT_SW}
${MICROPY_PORT_DIR}/libm_extra.c
)

View File

@ -142,35 +142,8 @@ ASF4_SRC_C += $(addprefix lib/asf4/$(MCU_SERIES_LOWER)/,\
hpl/nvmctrl/hpl_nvmctrl.c \
)
LIBM_SRC_C += $(addprefix lib/libm/,\
acoshf.c \
asinfacosf.c \
asinhf.c \
atan2f.c \
atanf.c \
atanhf.c \
ef_rem_pio2.c \
ef_sqrt.c \
erf_lgamma.c \
fmodf.c \
kf_cos.c \
kf_rem_pio2.c \
kf_sin.c \
kf_tan.c \
log1pf.c \
math.c \
nearbyintf.c \
roundf.c \
sf_cos.c \
sf_erf.c \
sf_frexp.c \
sf_ldexp.c \
sf_modf.c \
sf_sin.c \
sf_tan.c \
wf_lgamma.c \
wf_tgamma.c \
)
LIBM_SRC_C += $(SRC_LIB_LIBM_C)
LIBM_SRC_C += $(SRC_LIB_LIBM_SQRT_SW_C)
TINYUSB_SRC_C += $(addprefix lib/tinyusb/src/,\
class/cdc/cdc_device.c \

View File

@ -189,98 +189,21 @@ SHARED_SRC_C += $(addprefix shared/,\
)
ifeq ($(MICROPY_FLOAT_IMPL),double)
LIBM_SRC_C += $(addprefix lib/libm_dbl/,\
__cos.c \
__expo2.c \
__fpclassify.c \
__rem_pio2.c \
__rem_pio2_large.c \
__signbit.c \
__sin.c \
__tan.c \
acos.c \
acosh.c \
asin.c \
asinh.c \
atan.c \
atan2.c \
atanh.c \
ceil.c \
cos.c \
cosh.c \
copysign.c \
erf.c \
exp.c \
expm1.c \
floor.c \
fmod.c \
frexp.c \
ldexp.c \
lgamma.c \
log.c \
log10.c \
log1p.c \
modf.c \
nearbyint.c \
pow.c \
rint.c \
round.c \
scalbn.c \
sin.c \
sinh.c \
tan.c \
tanh.c \
tgamma.c \
trunc.c \
)
LIBM_SRC_C += $(SRC_LIB_LIBM_DBL_C)
ifeq ($(SUPPORTS_HARDWARE_FP_DOUBLE),1)
LIBM_SRC_C += lib/libm_dbl/thumb_vfp_sqrt.c
LIBM_SRC_C += $(SRC_LIB_LIBM_DBL_SQRT_HW_C)
else
LIBM_SRC_C += lib/libm_dbl/sqrt.c
LIBM_SRC_C += $(SRC_LIB_LIBM_DBL_SQRT_SW_C)
endif
else
LIBM_SRC_C += $(addprefix lib/libm/,\
math.c \
acoshf.c \
asinfacosf.c \
asinhf.c \
atan2f.c \
atanf.c \
atanhf.c \
ef_rem_pio2.c \
erf_lgamma.c \
fmodf.c \
kf_cos.c \
kf_rem_pio2.c \
kf_sin.c \
kf_tan.c \
log1pf.c \
nearbyintf.c \
roundf.c \
sf_cos.c \
sf_erf.c \
sf_frexp.c \
sf_ldexp.c \
sf_modf.c \
sf_sin.c \
sf_tan.c \
wf_lgamma.c \
wf_tgamma.c \
)
LIBM_SRC_C += $(SRC_LIB_LIBM_C)
ifeq ($(SUPPORTS_HARDWARE_FP_SINGLE),1)
LIBM_SRC_C += lib/libm/thumb_vfp_sqrtf.c
LIBM_SRC_C += $(SRC_LIB_LIBM_SQRT_HW_C)
else
LIBM_SRC_C += lib/libm/ef_sqrt.c
LIBM_SRC_C += $(SRC_LIB_LIBM_SQRT_SW_C)
endif
endif
LIBM_O = $(addprefix $(BUILD)/, $(LIBM_SRC_C:.c=.o))
# Too many warnings in libm_dbl, disable for now.
ifeq ($(MICROPY_FLOAT_IMPL),double)
$(LIBM_O): CFLAGS := $(filter-out -Wdouble-promotion -Wfloat-conversion, $(CFLAGS))
endif
DRIVERS_SRC_C += $(addprefix drivers/,\
bus/softspi.c \
bus/softqspi.c \
@ -499,7 +422,7 @@ endif # MICROPY_PY_BLUETOOTH
OBJ += $(addprefix $(BUILD)/, $(SRC_O))
OBJ += $(PY_O)
OBJ += $(addprefix $(BUILD)/, $(LIB_SRC_C:.c=.o))
OBJ += $(LIBM_O)
OBJ += $(addprefix $(BUILD)/, $(LIBM_SRC_C:.c=.o))
OBJ += $(addprefix $(BUILD)/, $(SHARED_SRC_C:.c=.o))
OBJ += $(addprefix $(BUILD)/, $(DRIVERS_SRC_C:.c=.o))
OBJ += $(addprefix $(BUILD)/, $(HAL_SRC_C:.c=.o))