aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HISTORY.md1
-rw-r--r--arduino-mk/Arduino.mk13
2 files changed, 12 insertions, 2 deletions
diff --git a/HISTORY.md b/HISTORY.md
index 16846b6..d52d981 100644
--- a/HISTORY.md
+++ b/HISTORY.md
@@ -18,6 +18,7 @@ I tried to give credit whenever possible. If I have missed anyone, kindly add it
- Tweak: Don't append port details to avrdude for usbtiny. Fix #140 and #138 (https://github.com/PPvG)
- Fix: Handle relative paths of bootloader file while burning bootloaders. Fix #126 and #142 (https://github.com/sej7278)
- New: Add `CONTRIBUTING.md` explaining how to contribute to the project.
+- Force -Os optimization for SoftwareSerial. Add `OPTIMIZATION_FLAGS` and `DEBUG_FLAGS`.
### 1.0.1 (2013-09-25)
- Unconditionally add -D in avrdude options. See #114
diff --git a/arduino-mk/Arduino.mk b/arduino-mk/Arduino.mk
index 256e4bf..5ee2fdb 100644
--- a/arduino-mk/Arduino.mk
+++ b/arduino-mk/Arduino.mk
@@ -780,6 +780,13 @@ else
$(call show_config_variable,OPTIMIZATION_LEVEL,[USER])
endif
+ifndef DEBUG_FLAGS
+ DEBUG_FLAGS = -O0 -g
+endif
+
+# SoftwareSerial requires -Os (some delays are tuned for this optimization level)
+%SoftwareSerial.o : OPTIMIZATION_FLAGS = -Os
+
ifndef MCU_FLAG_NAME
MCU_FLAG_NAME = mmcu
$(call show_config_variable,MCU_FLAG_NAME,[DEFAULT])
@@ -794,11 +801,13 @@ CPPFLAGS += -$(MCU_FLAG_NAME)=$(MCU) -DF_CPU=$(F_CPU) -DARDUINO=$(ARDUINO_V
-fdata-sections
ifdef DEBUG
-CPPFLAGS += -O0 -g
+OPTIMIZATION_FLAGS= $(DEBUG_FLAGS)
else
-CPPFLAGS += -O$(OPTIMIZATION_LEVEL)
+OPTIMIZATION_FLAGS = -O$(OPTIMIZATION_LEVEL)
endif
+CPPFLAGS += $(OPTIMIZATION_FLAGS)
+
# USB IDs for the Caterina devices like leonardo or micro
ifneq ($(CATERINA),)
CPPFLAGS += -DUSB_VID=$(USB_VID) -DUSB_PID=$(USB_PID)