Skip to content

Commit c63376c

Browse files
authored
Merge pull request adafruit#1331 from adafruit/tannewt-patch-4
Switch SAMD51 back to -Os
2 parents 50f5d27 + a3a690d commit c63376c

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

ports/atmel-samd/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_SAMD21 -DCFG_TUD_CDC_RX_BUFSIZE=128 -DCFG_TUD_C
9393
endif
9494

9595
ifeq ($(CHIP_FAMILY), samd51)
96-
CFLAGS += -O0 -DNDEBUG
96+
CFLAGS += -Os -DNDEBUG
9797
# TinyUSB defines
9898
CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_SAMD51 -DCFG_TUD_CDC_RX_BUFSIZE=256 -DCFG_TUD_CDC_TX_BUFSIZE=256 -DCFG_TUD_MSC_BUFSIZE=1024
9999
endif

ports/atmel-samd/common-hal/neopixel_write/__init__.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@
4848
}
4949
#endif
5050

51+
// Ensure this code is compiled with -Os. Any other optimization level may change the timing of it
52+
// and break neopixels.
53+
#pragma GCC push_options
54+
#pragma GCC optimize ("Os")
55+
5156
uint64_t next_start_tick_ms = 0;
5257
uint32_t next_start_tick_us = 1000;
5358

@@ -183,3 +188,5 @@ void common_hal_neopixel_write(const digitalio_digitalinout_obj_t* digitalinout,
183188
mp_hal_enable_all_interrupts();
184189

185190
}
191+
192+
#pragma GCC pop_options

0 commit comments

Comments
 (0)