qemu-arm: Enable software floating point support, and float tests.

This helps to test floating point code on Cortex-M hardware.

As part of this patch the link-time-optimisation was disabled because it
wasn't compatible with software FP support.  In particular, the linker
could not find the __aeabi_f2d, __aeabi_d2f etc functions even though they
were provided by lib/libm/math.c.
pull/2586/head
Damien George 2016-11-03 12:28:31 +11:00
rodzic cd527bb324
commit ca973bd308
3 zmienionych plików z 28 dodań i 6 usunięć

Wyświetl plik

@ -14,9 +14,9 @@ INC += -I..
INC += -I$(BUILD)
INC += -I../tools/tinytest/
CFLAGS_CORTEX_M3 = -mthumb -mcpu=cortex-m3
CFLAGS_CORTEX_M3 = -mthumb -mcpu=cortex-m3 -mfloat-abi=soft
CFLAGS = $(INC) -Wall -Wpointer-arith -Werror -ansi -std=gnu99 $(CFLAGS_CORTEX_M3) $(COPT) \
-flto -ffunction-sections -fdata-sections
-ffunction-sections -fdata-sections
#Debugging/Optimization
ifeq ($(DEBUG), 1)
@ -40,6 +40,27 @@ SRC_C = \
SRC_TEST_C = \
test_main.c \
LIB_SRC_C = $(addprefix lib/,\
libm/math.c \
libm/fmodf.c \
libm/roundf.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 \
)
STM_SRC_C = $(addprefix stmhal/,\
pybstdio.c \
)
@ -50,12 +71,14 @@ OBJ =
OBJ += $(PY_O)
OBJ += $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
OBJ += $(addprefix $(BUILD)/, $(SRC_S:.s=.o))
OBJ += $(addprefix $(BUILD)/, $(LIB_SRC_C:.c=.o))
OBJ += $(addprefix $(BUILD)/, $(STM_SRC_C:.c=.o))
OBJ_TEST =
OBJ_TEST += $(PY_O)
OBJ_TEST += $(addprefix $(BUILD)/, $(SRC_TEST_C:.c=.o))
OBJ_TEST += $(addprefix $(BUILD)/, $(SRC_S:.s=.o))
OBJ_TEST += $(addprefix $(BUILD)/, $(LIB_SRC_C:.c=.o))
OBJ_TEST += $(addprefix $(BUILD)/, $(STM_SRC_C:.c=.o))
OBJ_TEST += $(BUILD)/tinytest.o

Wyświetl plik

@ -14,7 +14,7 @@
#define MICROPY_HELPER_LEXER_UNIX (0)
#define MICROPY_ENABLE_SOURCE_LINE (1)
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ)
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_NONE)
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT)
#define MICROPY_CAN_OVERRIDE_BUILTINS (1)
#define MICROPY_PY_ALL_SPECIAL_METHODS (1)
#define MICROPY_PY_ARRAY_SLICE_ASSIGN (1)

Wyświetl plik

@ -46,12 +46,11 @@ testgroup_member = (
## XXX: may be we could have `--without <groups>` argument...
# currently these tests are selected because they pass on qemu-arm
test_dirs = ('basics', 'micropython', 'extmod', 'inlineasm') # 'float', 'import', 'io', 'misc')
test_dirs = ('basics', 'micropython', 'float', 'extmod', 'inlineasm') # 'import', 'io', 'misc')
exclude_tests = (
'float/float2int_doubleprec.py', # requires double precision floating point to work
'inlineasm/asmfpaddsub.py', 'inlineasm/asmfpcmp.py', 'inlineasm/asmfpldrstr.py', 'inlineasm/asmfpmuldiv.py', 'inlineasm/asmfpsqrt.py',
'extmod/ticks_diff.py', 'extmod/time_ms_us.py',
'extmod/ujson_dumps_float.py', 'extmod/ujson_loads_float.py',
'extmod/uctypes_native_float.py', 'extmod/uctypes_le_float.py',
'extmod/machine_pinbase.py', 'extmod/machine_pulse.py',
'extmod/vfs_fat_ramdisk.py', 'extmod/vfs_fat_fileio.py', 'extmod/vfs_fat_fsusermount.py', 'extmod/vfs_fat_oldproto.py',
)