diff options
| -rw-r--r-- | ports/atmel-samd/Makefile | 3 | ||||
| -rw-r--r-- | py/nlrthumb.c | 8 |
2 files changed, 8 insertions, 3 deletions
diff --git a/ports/atmel-samd/Makefile b/ports/atmel-samd/Makefile index 486df28c2..7a842b9c6 100644 --- a/ports/atmel-samd/Makefile +++ b/ports/atmel-samd/Makefile @@ -92,6 +92,7 @@ endif ifeq ($(DEBUG), 1) # Turn on Python modules useful for debugging (e.g. uheap, ustack). CFLAGS += -ggdb + CFLAGS += -flto ifeq ($(CHIP_FAMILY), samd21) CFLAGS += -DENABLE_MICRO_TRACE_BUFFER endif @@ -122,8 +123,6 @@ ifeq ($(CHIP_FAMILY), samd51) CFLAGS += \ -mthumb \ -mabi=aapcs-linux \ - -mlong-calls \ - -mtune=cortex-m4 \ -mcpu=cortex-m4 \ -mfloat-abi=hard \ -mfpu=fpv4-sp-d16 \ diff --git a/py/nlrthumb.c b/py/nlrthumb.c index 6e7d71766..0616e59b0 100644 --- a/py/nlrthumb.c +++ b/py/nlrthumb.c @@ -74,7 +74,13 @@ __attribute__((naked)) unsigned int nlr_push(nlr_buf_t *nlr) { #else "b nlr_push_tail \n" // do the rest in C #endif - ); + : // output operands + : "r" (nlr) // input operands + // Do not use r1, r2, r3 as temporary saving registers. + // gcc 7.2.1 started doing this, and r3 got clobbered in nlr_push_tail. + // See https://github.com/adafruit/circuitpython/issues/500 for details. + : "r1", "r2", "r3" // clobbers + ); return 0; // needed to silence compiler warning } |
