greenhills: fix double-precision float operation running error

since not all Armv7-m platform support double-precision floating
operations, so we add an extra option that help those specific platform
could define the single-precision floating operations.
for example, qemu-mps platform(armv7-m) support double-precision
floating operations, so we do not need to open
CONFIG_ARM_FPU_SINGLE_HARDWARE build options;
but for fc7300 platform(armv7-m) only support single-precision floating
operations, so if we pass "-fhard" build option to "ghs" compiler, then
the following instruction will be generated:
vcvt.f64.s32    d9, s18
which will fail to execute on fc7300 platform.
with "-fsingle" build option, the "ghs" compiler will generate hardware
instruction for single-precision floating operation, and generate
software instruction for double-precision floating operation.

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
This commit is contained in:
guoshichao 2024-07-22 17:19:33 +08:00 committed by Xiang Xiao
parent 90a6ced9c1
commit c2d26988fd
2 changed files with 21 additions and 3 deletions

View File

@ -64,8 +64,10 @@ ifeq ($(CONFIG_ARCH_FPU),y)
ifeq ($(CONFIG_ARM_TOOLCHAIN_GHS),y)
ifeq ($(CONFIG_ARM_FPU_ABI_SOFT),y)
TOOLCHAIN_MFLOAT += -fsoft
else
else ifeq ($(CONFIG_ARCH_DPFPU),y)
TOOLCHAIN_MFLOAT += -fhard
else
TOOLCHAIN_MFLOAT += -fsingle
endif
else
ifeq ($(CONFIG_ARM_FPU_ABI_SOFT),y)

View File

@ -416,8 +416,10 @@ else ifeq ($(CONFIG_ARCH_TOOLCHAIN_GHS),y)
ifeq ($(CONFIG_ARCH_FPU),y)
ifeq ($(CONFIG_ARM_FPU_ABI_SOFT),y)
COMPILER_RT_LIB += -l$(GHS_ROOT_PATH)/lib/thumb2/libind_sf
else
else ifeq ($(CONFIG_ARCH_DPFPU),y)
COMPILER_RT_LIB += -l$(GHS_ROOT_PATH)/lib/thumb2/libind_fp
else
COMPILER_RT_LIB += -l$(GHS_ROOT_PATH)/lib/thumb2/libind_sd
endif
else
COMPILER_RT_LIB += -l$(GHS_ROOT_PATH)/lib/thumb2/libind_sf
@ -427,7 +429,21 @@ endif
EXTRA_LIBS += $(COMPILER_RT_LIB)
ifeq ($(CONFIG_LIBM_TOOLCHAIN),y)
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a))
ifeq ($(CONFIG_ARM_TOOLCHAIN_GHS),y)
ifeq ($(CONFIG_ARCH_FPU),y)
ifeq ($(CONFIG_ARM_FPU_ABI_SOFT),y)
EXTRA_LIBS += -l$(GHS_ROOT_PATH)/lib/thumb2/libmath_sf
else ifeq ($(CONFIG_ARCH_DPFPU),y)
EXTRA_LIBS += -l$(GHS_ROOT_PATH)/lib/thumb2/libmath_fp
else
EXTRA_LIBS += -l$(GHS_ROOT_PATH)/lib/thumb2/libmath_sd
endif
else
EXTRA_LIBS += -l$(GHS_ROOT_PATH)/lib/thumb2/libmath_sf
endif
else
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a))
endif
endif
ifeq ($(CONFIG_LIBSUPCXX),y)