mirror of
https://github.com/micropython/micropython.git
synced 2026-01-04 19:20:22 +01:00
qemu/Makefile: Allow overriding floating point mode by boards.
This commit lets board use a different floating point mode rather than the usual soft-float that was the original default for all QEMU-based boards. The configuration options are the same available in the "stm32" port. Boards can set "MICROPY_FLOAT_IMPL" to either "float", "double", or "none" to indicate which floating point mode they want, and optionally "SUPPORTS_HARDWARE_FP_SINGLE" or "SUPPORTS_HARDWARE_FP_DOUBLE" can be set to 1 to further indicate the hardware capabilities of the hardware floating point unit, if present. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit is contained in:
committed by
Damien George
parent
b0fd0079f4
commit
87099b5731
@@ -36,6 +36,8 @@ MICROPY_HEAP_SIZE ?= 143360
|
||||
FROZEN_MANIFEST ?= "require('unittest'); freeze('test-frzmpy', ('frozen_asm_rv32.py', 'frozen_const.py', 'frozen_viper.py', 'native_frozen_align.py'))"
|
||||
endif
|
||||
|
||||
MICROPY_FLOAT_IMPL ?= float
|
||||
|
||||
# include py core make definitions
|
||||
include $(TOP)/py/py.mk
|
||||
include $(TOP)/extmod/extmod.mk
|
||||
@@ -44,6 +46,20 @@ GIT_SUBMODULES += lib/berkeley-db-1.xx
|
||||
|
||||
CFLAGS += -DMICROPY_HEAP_SIZE=$(MICROPY_HEAP_SIZE)
|
||||
|
||||
ifeq ($(MICROPY_FLOAT_IMPL),double)
|
||||
CFLAGS += -DMICROPY_FLOAT_IMPL=MICROPY_FLOAT_IMPL_DOUBLE
|
||||
else ifeq ($(MICROPY_FLOAT_IMPL),float)
|
||||
CFLAGS += -DMICROPY_FLOAT_IMPL=MICROPY_FLOAT_IMPL_FLOAT -fsingle-precision-constant
|
||||
else
|
||||
CFLAGS += -DMICROPY_FLOAT_IMPL=MICROPY_FLOAT_IMPL_NONE
|
||||
endif
|
||||
|
||||
ifeq ($(SUPPORTS_HARDWARE_FP_SINGLE),1)
|
||||
CFLAGS += -DMICROPY_HW_FPU=1
|
||||
else ifeq ($(SUPPORTS_HARDWARE_FP_DOUBLE),1)
|
||||
CFLAGS += -DMICROPY_HW_FPU=1
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
# ARM specific settings
|
||||
|
||||
@@ -156,16 +172,29 @@ SRC_C += \
|
||||
shared/runtime/stdout_helpers.c \
|
||||
shared/runtime/sys_stdio_mphal.c \
|
||||
|
||||
LIB_SRC_C += $(SRC_LIB_LIBM_C)
|
||||
LIB_SRC_C += $(SRC_LIB_LIBM_SQRT_SW_C)
|
||||
ifeq ($(MICROPY_FLOAT_IMPL),double)
|
||||
LIBM_SRC_C += $(SRC_LIB_LIBM_DBL_C)
|
||||
ifeq ($(SUPPORTS_HARDWARE_FP_DOUBLE),1)
|
||||
LIBM_SRC_C += $(SRC_LIB_LIBM_DBL_SQRT_HW_C)
|
||||
else
|
||||
LIBM_SRC_C += $(SRC_LIB_LIBM_DBL_SQRT_SW_C)
|
||||
endif
|
||||
else
|
||||
LIBM_SRC_C += $(SRC_LIB_LIBM_C)
|
||||
ifeq ($(SUPPORTS_HARDWARE_FP_SINGLE),1)
|
||||
LIBM_SRC_C += $(SRC_LIB_LIBM_SQRT_HW_C)
|
||||
else
|
||||
LIBM_SRC_C += $(SRC_LIB_LIBM_SQRT_SW_C)
|
||||
endif
|
||||
endif
|
||||
|
||||
OBJ += $(PY_O)
|
||||
OBJ += $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(SRC_BOARD_O))
|
||||
OBJ += $(addprefix $(BUILD)/, $(LIB_SRC_C:.c=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(LIBM_SRC_C:.c=.o))
|
||||
|
||||
# List of sources for qstr extraction
|
||||
SRC_QSTR += $(SRC_C) $(LIB_SRC_C)
|
||||
SRC_QSTR += $(SRC_C) $(LIBM_SRC_C)
|
||||
|
||||
################################################################################
|
||||
# Main targets
|
||||
|
||||
@@ -51,7 +51,6 @@
|
||||
#define MICROPY_ENABLE_GC (1)
|
||||
#define MICROPY_ENABLE_EMERGENCY_EXCEPTION_BUF (1)
|
||||
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ)
|
||||
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT)
|
||||
#define MICROPY_WARNINGS (1)
|
||||
#define MICROPY_PY_SYS_PLATFORM "qemu"
|
||||
#define MICROPY_PY_SYS_STDIO_BUFFER (0)
|
||||
|
||||
Reference in New Issue
Block a user