summaryrefslogtreecommitdiff
path: root/qemu-arm
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2016-11-03 12:28:31 +1100
committerDamien George <damien.p.george@gmail.com>2016-11-03 12:28:31 +1100
commitca973bd3083492777095a07c20965a4644899ec9 (patch)
tree776c367c945b3f846bcd73b05a84abe078e22fad /qemu-arm
parentcd527bb324ade952d11a134859d38bf5272c165e (diff)
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.
Diffstat (limited to 'qemu-arm')
-rw-r--r--qemu-arm/Makefile27
-rw-r--r--qemu-arm/mpconfigport.h2
2 files changed, 26 insertions, 3 deletions
diff --git a/qemu-arm/Makefile b/qemu-arm/Makefile
index 9159f97e5..0af2fc901 100644
--- a/qemu-arm/Makefile
+++ b/qemu-arm/Makefile
@@ -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
diff --git a/qemu-arm/mpconfigport.h b/qemu-arm/mpconfigport.h
index 2b8ae855a..8ee9cdc4b 100644
--- a/qemu-arm/mpconfigport.h
+++ b/qemu-arm/mpconfigport.h
@@ -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)