From aa0ef9a3e00fe81e99bc6e8e9bce642d73681808 Mon Sep 17 00:00:00 2001 From: Markus Hitter Date: Wed, 7 Dec 2016 15:24:29 +0100 Subject: [PATCH] AVR: turn on link time optimisation (LTO). Following the resounding success on ARMs, let's try LTO on AVRs, too. Advantage isn't all that well, binary size increases by 462 bytes and even an additional byte of RAM is needed. According to @Wurstnase's research, this size increase is pretty unique to the config.h.Profiling configuration. All other configurations he tried actually showed a size drop. Anyways, we have 15 to 17 clock cycles less on any step, so an about 7% general stepping performance increase. ATmega sizes '168 '328(P) '644(P) '1280 Program: 18078 bytes 127% 59% 29% 15% Data: 2176 bytes 213% 107% 54% 27% EEPROM: 32 bytes 4% 2% 2% 1% short-moves.gcode statistics: LED on occurences: 888. LED on time minimum: 202 clock cycles. LED on time maximum: 380 clock cycles. LED on time average: 232.092 clock cycles. smooth-curves.gcode statistics: LED on occurences: 23648. LED on time minimum: 220 clock cycles. LED on time maximum: 423 clock cycles. LED on time average: 255.22 clock cycles. triangle-odd.gcode statistics: LED on occurences: 1636. LED on time minimum: 220 clock cycles. LED on time maximum: 380 clock cycles. LED on time average: 245.575 clock cycles. --- Makefile-AVR | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile-AVR b/Makefile-AVR index 5f7bb2c..fe0d7fb 100644 --- a/Makefile-AVR +++ b/Makefile-AVR @@ -132,6 +132,7 @@ CFLAGS += -Os CFLAGS += -ffunction-sections CFLAGS += -finline-functions-called-once CFLAGS += -mcall-prologues +CFLAGS += -flto CFLAGS += -Wa,-adhlns=$(@:.o=.al) #CFLAGS += -dM -E # To list all predefined macros into the .o file.