summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Halbert <halbert@halwitz.org>2018-11-13 14:35:32 -0500
committerGitHub <noreply@github.com>2018-11-13 14:35:32 -0500
commitc63376c5fa41c35681e8ed28d997383f6e082841 (patch)
tree3f2e375e8d191763e9f6a876b755b85fa2c8aa2f
parent50f5d27c436cf71d14bf893709375e5bcf62717b (diff)
parenta3a690dc018ba70fe415def0216ab0bb9ef49d9c (diff)
Merge pull request #1331 from adafruit/tannewt-patch-4
Switch SAMD51 back to -Os
-rw-r--r--ports/atmel-samd/Makefile2
-rw-r--r--ports/atmel-samd/common-hal/neopixel_write/__init__.c7
2 files changed, 8 insertions, 1 deletions
diff --git a/ports/atmel-samd/Makefile b/ports/atmel-samd/Makefile
index 552be92be..23fb39779 100644
--- a/ports/atmel-samd/Makefile
+++ b/ports/atmel-samd/Makefile
@@ -93,7 +93,7 @@ CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_SAMD21 -DCFG_TUD_CDC_RX_BUFSIZE=128 -DCFG_TUD_C
endif
ifeq ($(CHIP_FAMILY), samd51)
-CFLAGS += -O0 -DNDEBUG
+CFLAGS += -Os -DNDEBUG
# TinyUSB defines
CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_SAMD51 -DCFG_TUD_CDC_RX_BUFSIZE=256 -DCFG_TUD_CDC_TX_BUFSIZE=256 -DCFG_TUD_MSC_BUFSIZE=1024
endif
diff --git a/ports/atmel-samd/common-hal/neopixel_write/__init__.c b/ports/atmel-samd/common-hal/neopixel_write/__init__.c
index b30ad47d4..57e963c91 100644
--- a/ports/atmel-samd/common-hal/neopixel_write/__init__.c
+++ b/ports/atmel-samd/common-hal/neopixel_write/__init__.c
@@ -48,6 +48,11 @@
}
#endif
+// Ensure this code is compiled with -Os. Any other optimization level may change the timing of it
+// and break neopixels.
+#pragma GCC push_options
+#pragma GCC optimize ("Os")
+
uint64_t next_start_tick_ms = 0;
uint32_t next_start_tick_us = 1000;
@@ -183,3 +188,5 @@ void common_hal_neopixel_write(const digitalio_digitalinout_obj_t* digitalinout,
mp_hal_enable_all_interrupts();
}
+
+#pragma GCC pop_options