From ebb77557fb6990d5776d95734dc1b30526c7530e Mon Sep 17 00:00:00 2001 From: Roberto Colistete Jr Date: Wed, 5 Aug 2020 02:53:19 -0300 Subject: [PATCH 1/2] PYCOM : make option MICROPY_FLOAT_IMPL --- esp32/Makefile | 11 +++++++++++ esp32/mpconfigport.h | 2 ++ 2 files changed, 13 insertions(+) diff --git a/esp32/Makefile b/esp32/Makefile index 742dae3c04..db290a12c4 100644 --- a/esp32/Makefile +++ b/esp32/Makefile @@ -91,6 +91,17 @@ CFLAGS_XTENSA_PSRAM = -mfix-esp32-psram-cache-issue CFLAGS = $(CFLAGS_XTENSA) $(CFLAGS_XTENSA_PSRAM) $(CFLAGS_XTENSA_OPT) -nostdlib -std=gnu99 -g3 -ggdb -fstrict-volatile-bitfields -Iboards/$(BOARD) CFLAGS_SIGFOX = $(CFLAGS_XTENSA) -O2 -nostdlib -std=gnu99 -g3 -ggdb -fstrict-volatile-bitfields -Iboards/$(BOARD) +# Configure floating point support +ifeq ($(MICROPY_FLOAT_IMPL),double) +CFLAGS += -DMICROPY_FLOAT_IMPL=MICROPY_FLOAT_IMPL_DOUBLE +else +ifeq ($(MICROPY_FLOAT_IMPL),none) +CFLAGS += -DMICROPY_FLOAT_IMPL=MICROPY_FLOAT_IMPL_NONE +else +CFLAGS += -DMICROPY_FLOAT_IMPL=MICROPY_FLOAT_IMPL_FLOAT +endif +endif + LDFLAGS = -nostdlib -Wl,-Map=$(@:.elf=.map) -Wl,--no-check-sections -u call_user_start_cpu0 LDFLAGS += -Wl,-static -Wl,--undefined=uxTopUsedPriority -Wl,--gc-sections diff --git a/esp32/mpconfigport.h b/esp32/mpconfigport.h index 9870415bd2..e6d2228138 100644 --- a/esp32/mpconfigport.h +++ b/esp32/mpconfigport.h @@ -101,7 +101,9 @@ #define MICROPY_PY_UTIMEQ (1) #define MICROPY_CPYTHON_COMPAT (1) #define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ) +#ifndef MICROPY_FLOAT_IMPL // can be configured by make option #define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT) +#endif #define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_NORMAL) #define MICROPY_OPT_COMPUTED_GOTO (1) #define MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE (0) From f0d60678c9656b39aec2bc2d34a70c7fb22ca322 Mon Sep 17 00:00:00 2001 From: Roberto Colistete Jr Date: Thu, 6 Aug 2020 22:06:51 -0300 Subject: [PATCH 2/2] PYCOM : improved option MICROPY_FLOAT_IMPL --- esp32/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/esp32/Makefile b/esp32/Makefile index db290a12c4..fa9d78bdab 100644 --- a/esp32/Makefile +++ b/esp32/Makefile @@ -98,9 +98,11 @@ else ifeq ($(MICROPY_FLOAT_IMPL),none) CFLAGS += -DMICROPY_FLOAT_IMPL=MICROPY_FLOAT_IMPL_NONE else +ifeq ($(MICROPY_FLOAT_IMPL),single) CFLAGS += -DMICROPY_FLOAT_IMPL=MICROPY_FLOAT_IMPL_FLOAT endif endif +endif LDFLAGS = -nostdlib -Wl,-Map=$(@:.elf=.map) -Wl,--no-check-sections -u call_user_start_cpu0 LDFLAGS += -Wl,-static -Wl,--undefined=uxTopUsedPriority -Wl,--gc-sections