Skip to content

Commit 8579766

Browse files
committed
Optimize ulab for size on samd51/same51
1 parent 164fcb2 commit 8579766

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

ports/atmel-samd/mpconfigport.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ CIRCUITPY_PS2IO ?= 1
106106
CIRCUITPY_RGBMATRIX ?= $(CIRCUITPY_FRAMEBUFFERIO)
107107
CIRCUITPY_SAMD ?= 1
108108
CIRCUITPY_SYNTHIO_MAX_CHANNELS = 12
109+
CIRCUITPY_ULAB_OPTIMIZE_SIZE ?= 1
109110
CIRCUITPY_WATCHDOG ?= 1
110111

111112
endif # samd51
@@ -131,6 +132,7 @@ CIRCUITPY_SAMD ?= 1
131132
CIRCUITPY_FLOPPYIO ?= $(CIRCUITPY_FULL_BUILD)
132133
CIRCUITPY_FRAMEBUFFERIO ?= $(CIRCUITPY_FULL_BUILD)
133134
CIRCUITPY_RGBMATRIX ?= $(CIRCUITPY_FRAMEBUFFERIO)
135+
CIRCUITPY_ULAB_OPTIMIZE_SIZE ?= 1
134136

135137
endif # same51
136138
######################################################################

py/circuitpy_mpconfig.mk

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,9 @@ CFLAGS += -DCIRCUITPY_ZLIB=$(CIRCUITPY_ZLIB)
559559
CIRCUITPY_ULAB ?= $(CIRCUITPY_FULL_BUILD)
560560
CFLAGS += -DCIRCUITPY_ULAB=$(CIRCUITPY_ULAB)
561561

562+
# whether to use -Os optimization on files in ulab
563+
CIRCUITPY_ULAB_OPTIMIZE_SIZE ?= 0
564+
562565
# CIRCUITPY_VIDEOCORE is handled in the broadcom tree.
563566
# Only for Broadcom chips.
564567
# Assume not a Broadcom build.

py/py.mk

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ ULAB_SRCS := $(shell find $(TOP)/extmod/ulab/code -type f -name "*.c")
5757
SRC_MOD += $(patsubst $(TOP)/%,%,$(ULAB_SRCS))
5858
CFLAGS_MOD += -DCIRCUITPY_ULAB=1 -DMODULE_ULAB_ENABLED=1 -DULAB_HAS_USER_MODULE=0 -iquote $(TOP)/extmod/ulab/code
5959
$(BUILD)/extmod/ulab/code/%.o: CFLAGS += -Wno-missing-declarations -Wno-missing-prototypes -Wno-unused-parameter -Wno-float-equal -Wno-sign-compare -Wno-cast-align -Wno-shadow -DCIRCUITPY
60+
ifeq ($(CIRCUITPY_ULAB_OPTIMIZE_SIZE),1)
61+
$(BUILD)/extmod/ulab/code/%.o: CFLAGS += -Os
62+
endif
6063
endif
6164

6265
# py object files

0 commit comments

Comments
 (0)