aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2013-09-09 13:45:30 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2013-09-09 13:45:30 +0000
commit45c3970db8dcd40b9b8ceddcd48d06db4e2447ea (patch)
tree5da07ecb535a9043043599ed99b706dc3efc4f96
parentc6bfd5e1499f839a677423231295957ef008e50d (diff)
downloadChibiOS-45c3970db8dcd40b9b8ceddcd48d06db4e2447ea.tar.gz
ChibiOS-45c3970db8dcd40b9b8ceddcd48d06db4e2447ea.tar.bz2
ChibiOS-45c3970db8dcd40b9b8ceddcd48d06db4e2447ea.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6286 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r--demos/nil/NIL-STM32F051-DISCOVERY/Makefile5
-rw-r--r--demos/nil/NIL-STM32F303-DISCOVERY/Makefile5
-rw-r--r--demos/nil/NIL-STM32F373-STM32373C_EVAL/Makefile5
-rw-r--r--demos/nil/NIL-STM32L152-DISCOVERY/Makefile5
-rw-r--r--demos/rt/RT-STM32F051-DISCOVERY/Makefile5
-rw-r--r--demos/rt/RT-STM32F303-DISCOVERY/Makefile5
-rw-r--r--demos/rt/RT-STM32F407-DISCOVERY-MEMS/Makefile5
-rw-r--r--demos/rt/RT-STM32F407-DISCOVERY/Makefile5
-rw-r--r--os/common/ports/ARMCMx/compilers/GCC/rules.mk25
-rw-r--r--testhal/STM32F0xx/ADC/Makefile5
-rw-r--r--testhal/STM32F0xx/EXT/Makefile5
-rw-r--r--testhal/STM32F0xx/IRQ_STORM/Makefile5
-rw-r--r--testhal/STM32F0xx/PWM-ICU/Makefile5
-rw-r--r--testhal/STM32F0xx/SPI/Makefile5
-rw-r--r--testhal/STM32F0xx/UART/Makefile5
-rw-r--r--testhal/STM32F30x/ADC/Makefile5
-rw-r--r--testhal/STM32F30x/ADC_DUAL/Makefile5
-rw-r--r--testhal/STM32F30x/CAN/Makefile5
-rw-r--r--testhal/STM32F30x/EXT/Makefile5
-rw-r--r--testhal/STM32F30x/IRQ_STORM/Makefile5
-rw-r--r--testhal/STM32F30x/PWM-ICU/Makefile5
-rw-r--r--testhal/STM32F30x/SPI/Makefile5
-rw-r--r--testhal/STM32F30x/UART/Makefile5
-rw-r--r--testhal/STM32F30x/USB_CDC/Makefile5
-rw-r--r--testhal/STM32F4xx/ADC/Makefile5
-rw-r--r--testhal/STM32F4xx/CAN/Makefile5
-rw-r--r--testhal/STM32F4xx/DMA_STORM/Makefile5
-rw-r--r--testhal/STM32F4xx/EXT/Makefile5
-rw-r--r--testhal/STM32F4xx/GPT/Makefile5
-rw-r--r--testhal/STM32F4xx/I2C/Makefile5
-rw-r--r--testhal/STM32F4xx/IRQ_STORM/Makefile5
-rw-r--r--testhal/STM32F4xx/IRQ_STORM_FPU/Makefile5
-rw-r--r--testhal/STM32F4xx/PWM-ICU/Makefile5
-rw-r--r--testhal/STM32F4xx/RTC/Makefile5
-rw-r--r--testhal/STM32F4xx/SDC/Makefile5
-rw-r--r--testhal/STM32F4xx/SPI/Makefile5
-rw-r--r--testhal/STM32F4xx/UART/Makefile5
-rw-r--r--testhal/STM32F4xx/USB_CDC/Makefile5
-rw-r--r--testhal/common/testbuild/Makefile5
39 files changed, 206 insertions, 9 deletions
diff --git a/demos/nil/NIL-STM32F051-DISCOVERY/Makefile b/demos/nil/NIL-STM32F051-DISCOVERY/Makefile
index 990cfb19b..c74bb8958 100644
--- a/demos/nil/NIL-STM32F051-DISCOVERY/Makefile
+++ b/demos/nil/NIL-STM32F051-DISCOVERY/Makefile
@@ -23,6 +23,11 @@ ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes
endif
+# Enable this if you want link time optimizations (LTO)
+ifeq ($(USE_LTO),)
+ USE_LTO = yes
+endif
+
# If enabled, this option allows to compile the application in THUMB mode.
ifeq ($(USE_THUMB),)
USE_THUMB = yes
diff --git a/demos/nil/NIL-STM32F303-DISCOVERY/Makefile b/demos/nil/NIL-STM32F303-DISCOVERY/Makefile
index 421a2adfd..bae31ab92 100644
--- a/demos/nil/NIL-STM32F303-DISCOVERY/Makefile
+++ b/demos/nil/NIL-STM32F303-DISCOVERY/Makefile
@@ -23,6 +23,11 @@ ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes
endif
+# Enable this if you want link time optimizations (LTO)
+ifeq ($(USE_LTO),)
+ USE_LTO = yes
+endif
+
# If enabled, this option allows to compile the application in THUMB mode.
ifeq ($(USE_THUMB),)
USE_THUMB = yes
diff --git a/demos/nil/NIL-STM32F373-STM32373C_EVAL/Makefile b/demos/nil/NIL-STM32F373-STM32373C_EVAL/Makefile
index 7162b099f..4f40dfd8c 100644
--- a/demos/nil/NIL-STM32F373-STM32373C_EVAL/Makefile
+++ b/demos/nil/NIL-STM32F373-STM32373C_EVAL/Makefile
@@ -23,6 +23,11 @@ ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes
endif
+# Enable this if you want link time optimizations (LTO)
+ifeq ($(USE_LTO),)
+ USE_LTO = yes
+endif
+
# If enabled, this option allows to compile the application in THUMB mode.
ifeq ($(USE_THUMB),)
USE_THUMB = yes
diff --git a/demos/nil/NIL-STM32L152-DISCOVERY/Makefile b/demos/nil/NIL-STM32L152-DISCOVERY/Makefile
index c5eb8e5db..f511bc69c 100644
--- a/demos/nil/NIL-STM32L152-DISCOVERY/Makefile
+++ b/demos/nil/NIL-STM32L152-DISCOVERY/Makefile
@@ -23,6 +23,11 @@ ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes
endif
+# Enable this if you want link time optimizations (LTO)
+ifeq ($(USE_LTO),)
+ USE_LTO = yes
+endif
+
# If enabled, this option allows to compile the application in THUMB mode.
ifeq ($(USE_THUMB),)
USE_THUMB = yes
diff --git a/demos/rt/RT-STM32F051-DISCOVERY/Makefile b/demos/rt/RT-STM32F051-DISCOVERY/Makefile
index ea1ece763..0ba95fb05 100644
--- a/demos/rt/RT-STM32F051-DISCOVERY/Makefile
+++ b/demos/rt/RT-STM32F051-DISCOVERY/Makefile
@@ -23,6 +23,11 @@ ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes
endif
+# Enable this if you want link time optimizations (LTO)
+ifeq ($(USE_LTO),)
+ USE_LTO = yes
+endif
+
# If enabled, this option allows to compile the application in THUMB mode.
ifeq ($(USE_THUMB),)
USE_THUMB = yes
diff --git a/demos/rt/RT-STM32F303-DISCOVERY/Makefile b/demos/rt/RT-STM32F303-DISCOVERY/Makefile
index 002cad778..fe09d4589 100644
--- a/demos/rt/RT-STM32F303-DISCOVERY/Makefile
+++ b/demos/rt/RT-STM32F303-DISCOVERY/Makefile
@@ -23,6 +23,11 @@ ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes
endif
+# Enable this if you want link time optimizations (LTO)
+ifeq ($(USE_LTO),)
+ USE_LTO = yes
+endif
+
# If enabled, this option allows to compile the application in THUMB mode.
ifeq ($(USE_THUMB),)
USE_THUMB = yes
diff --git a/demos/rt/RT-STM32F407-DISCOVERY-MEMS/Makefile b/demos/rt/RT-STM32F407-DISCOVERY-MEMS/Makefile
index 8258d6699..a02a6ec16 100644
--- a/demos/rt/RT-STM32F407-DISCOVERY-MEMS/Makefile
+++ b/demos/rt/RT-STM32F407-DISCOVERY-MEMS/Makefile
@@ -23,6 +23,11 @@ ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes
endif
+# Enable this if you want link time optimizations (LTO)
+ifeq ($(USE_LTO),)
+ USE_LTO = yes
+endif
+
# If enabled, this option allows to compile the application in THUMB mode.
ifeq ($(USE_THUMB),)
USE_THUMB = yes
diff --git a/demos/rt/RT-STM32F407-DISCOVERY/Makefile b/demos/rt/RT-STM32F407-DISCOVERY/Makefile
index 8258d6699..a02a6ec16 100644
--- a/demos/rt/RT-STM32F407-DISCOVERY/Makefile
+++ b/demos/rt/RT-STM32F407-DISCOVERY/Makefile
@@ -23,6 +23,11 @@ ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes
endif
+# Enable this if you want link time optimizations (LTO)
+ifeq ($(USE_LTO),)
+ USE_LTO = yes
+endif
+
# If enabled, this option allows to compile the application in THUMB mode.
ifeq ($(USE_THUMB),)
USE_THUMB = yes
diff --git a/os/common/ports/ARMCMx/compilers/GCC/rules.mk b/os/common/ports/ARMCMx/compilers/GCC/rules.mk
index 249793fcd..f60fc985d 100644
--- a/os/common/ports/ARMCMx/compilers/GCC/rules.mk
+++ b/os/common/ports/ARMCMx/compilers/GCC/rules.mk
@@ -4,6 +4,21 @@
# Processing options coming from the upper Makefile.
#
+# Compiler options
+OPT = $(USE_OPT)
+COPT = $(USE_COPT)
+CPPOPT = $(USE_CPPOPT)
+
+# Garbage collection
+ifeq ($(USE_LINK_GC),yes)
+ OPT += -ffunction-sections -fdata-sections -fno-common
+endif
+
+# Link time optimizations
+ifeq ($(USE_LTO),yes)
+ OPT += -flto
+endif
+
# FPU-related options
ifeq ($(USE_FPU),yes)
USE_OPT += -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -fsingle-precision-constant
@@ -45,14 +60,6 @@ endif
OUTFILES = $(BUILDDIR)/$(PROJECT).elf $(BUILDDIR)/$(PROJECT).hex \
$(BUILDDIR)/$(PROJECT).bin $(BUILDDIR)/$(PROJECT).dmp
-# Automatic compiler options
-OPT = $(USE_OPT)
-COPT = $(USE_COPT)
-CPPOPT = $(USE_CPPOPT)
-ifeq ($(USE_LINK_GC),yes)
- OPT += -ffunction-sections -fdata-sections -fno-common
-endif
-
# Source files groups and paths
ifeq ($(USE_THUMB),yes)
TCSRC += $(CSRC)
@@ -96,7 +103,7 @@ ASFLAGS = $(MCFLAGS) -Wa,-amhls=$(LSTDIR)/$(notdir $(<:.s=.lst)) $(ADEFS)
ASXFLAGS = $(MCFLAGS) -Wa,-amhls=$(LSTDIR)/$(notdir $(<:.S=.lst)) $(ADEFS)
CFLAGS = $(MCFLAGS) $(OPT) $(COPT) $(CWARN) -Wa,-alms=$(LSTDIR)/$(notdir $(<:.c=.lst)) $(DEFS)
CPPFLAGS = $(MCFLAGS) $(OPT) $(CPPOPT) $(CPPWARN) -Wa,-alms=$(LSTDIR)/$(notdir $(<:.cpp=.lst)) $(DEFS)
-LDFLAGS = $(MCFLAGS) -nostartfiles $(LLIBDIR) -Wl,-Map=$(BUILDDIR)/$(PROJECT).map,--cref,--no-warn-mismatch,--library-path=$(RULESPATH),--script=$(LDSCRIPT),$(LDOPT)
+LDFLAGS = $(MCFLAGS) $(OPT) -nostartfiles $(LLIBDIR) -Wl,-Map=$(BUILDDIR)/$(PROJECT).map,--cref,--no-warn-mismatch,--library-path=$(RULESPATH),--script=$(LDSCRIPT),$(LDOPT)
# Thumb interwork enabled only if needed because it kills performance.
ifneq ($(TSRC),)
diff --git a/testhal/STM32F0xx/ADC/Makefile b/testhal/STM32F0xx/ADC/Makefile
index 6a8da19a7..703990640 100644
--- a/testhal/STM32F0xx/ADC/Makefile
+++ b/testhal/STM32F0xx/ADC/Makefile
@@ -23,6 +23,11 @@ ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes
endif
+# Enable this if you want link time optimizations (LTO)
+ifeq ($(USE_LTO),)
+ USE_LTO = yes
+endif
+
# If enabled, this option allows to compile the application in THUMB mode.
ifeq ($(USE_THUMB),)
USE_THUMB = yes
diff --git a/testhal/STM32F0xx/EXT/Makefile b/testhal/STM32F0xx/EXT/Makefile
index 6a8da19a7..703990640 100644
--- a/testhal/STM32F0xx/EXT/Makefile
+++ b/testhal/STM32F0xx/EXT/Makefile
@@ -23,6 +23,11 @@ ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes
endif
+# Enable this if you want link time optimizations (LTO)
+ifeq ($(USE_LTO),)
+ USE_LTO = yes
+endif
+
# If enabled, this option allows to compile the application in THUMB mode.
ifeq ($(USE_THUMB),)
USE_THUMB = yes
diff --git a/testhal/STM32F0xx/IRQ_STORM/Makefile b/testhal/STM32F0xx/IRQ_STORM/Makefile
index 6a8da19a7..703990640 100644
--- a/testhal/STM32F0xx/IRQ_STORM/Makefile
+++ b/testhal/STM32F0xx/IRQ_STORM/Makefile
@@ -23,6 +23,11 @@ ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes
endif
+# Enable this if you want link time optimizations (LTO)
+ifeq ($(USE_LTO),)
+ USE_LTO = yes
+endif
+
# If enabled, this option allows to compile the application in THUMB mode.
ifeq ($(USE_THUMB),)
USE_THUMB = yes
diff --git a/testhal/STM32F0xx/PWM-ICU/Makefile b/testhal/STM32F0xx/PWM-ICU/Makefile
index 6a8da19a7..703990640 100644
--- a/testhal/STM32F0xx/PWM-ICU/Makefile
+++ b/testhal/STM32F0xx/PWM-ICU/Makefile
@@ -23,6 +23,11 @@ ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes
endif
+# Enable this if you want link time optimizations (LTO)
+ifeq ($(USE_LTO),)
+ USE_LTO = yes
+endif
+
# If enabled, this option allows to compile the application in THUMB mode.
ifeq ($(USE_THUMB),)
USE_THUMB = yes
diff --git a/testhal/STM32F0xx/SPI/Makefile b/testhal/STM32F0xx/SPI/Makefile
index 6a8da19a7..703990640 100644
--- a/testhal/STM32F0xx/SPI/Makefile
+++ b/testhal/STM32F0xx/SPI/Makefile
@@ -23,6 +23,11 @@ ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes
endif
+# Enable this if you want link time optimizations (LTO)
+ifeq ($(USE_LTO),)
+ USE_LTO = yes
+endif
+
# If enabled, this option allows to compile the application in THUMB mode.
ifeq ($(USE_THUMB),)
USE_THUMB = yes
diff --git a/testhal/STM32F0xx/UART/Makefile b/testhal/STM32F0xx/UART/Makefile
index 6a8da19a7..703990640 100644
--- a/testhal/STM32F0xx/UART/Makefile
+++ b/testhal/STM32F0xx/UART/Makefile
@@ -23,6 +23,11 @@ ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes
endif
+# Enable this if you want link time optimizations (LTO)
+ifeq ($(USE_LTO),)
+ USE_LTO = yes
+endif
+
# If enabled, this option allows to compile the application in THUMB mode.
ifeq ($(USE_THUMB),)
USE_THUMB = yes
diff --git a/testhal/STM32F30x/ADC/Makefile b/testhal/STM32F30x/ADC/Makefile
index 1dc6fe838..3900293cc 100644
--- a/testhal/STM32F30x/ADC/Makefile
+++ b/testhal/STM32F30x/ADC/Makefile
@@ -23,6 +23,11 @@ ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes
endif
+# Enable this if you want link time optimizations (LTO)
+ifeq ($(USE_LTO),)
+ USE_LTO = yes
+endif
+
# If enabled, this option allows to compile the application in THUMB mode.
ifeq ($(USE_THUMB),)
USE_THUMB = yes
diff --git a/testhal/STM32F30x/ADC_DUAL/Makefile b/testhal/STM32F30x/ADC_DUAL/Makefile
index 1dc6fe838..3900293cc 100644
--- a/testhal/STM32F30x/ADC_DUAL/Makefile
+++ b/testhal/STM32F30x/ADC_DUAL/Makefile
@@ -23,6 +23,11 @@ ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes
endif
+# Enable this if you want link time optimizations (LTO)
+ifeq ($(USE_LTO),)
+ USE_LTO = yes
+endif
+
# If enabled, this option allows to compile the application in THUMB mode.
ifeq ($(USE_THUMB),)
USE_THUMB = yes
diff --git a/testhal/STM32F30x/CAN/Makefile b/testhal/STM32F30x/CAN/Makefile
index 1dc6fe838..3900293cc 100644
--- a/testhal/STM32F30x/CAN/Makefile
+++ b/testhal/STM32F30x/CAN/Makefile
@@ -23,6 +23,11 @@ ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes
endif
+# Enable this if you want link time optimizations (LTO)
+ifeq ($(USE_LTO),)
+ USE_LTO = yes
+endif
+
# If enabled, this option allows to compile the application in THUMB mode.
ifeq ($(USE_THUMB),)
USE_THUMB = yes
diff --git a/testhal/STM32F30x/EXT/Makefile b/testhal/STM32F30x/EXT/Makefile
index 1dc6fe838..3900293cc 100644
--- a/testhal/STM32F30x/EXT/Makefile
+++ b/testhal/STM32F30x/EXT/Makefile
@@ -23,6 +23,11 @@ ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes
endif
+# Enable this if you want link time optimizations (LTO)
+ifeq ($(USE_LTO),)
+ USE_LTO = yes
+endif
+
# If enabled, this option allows to compile the application in THUMB mode.
ifeq ($(USE_THUMB),)
USE_THUMB = yes
diff --git a/testhal/STM32F30x/IRQ_STORM/Makefile b/testhal/STM32F30x/IRQ_STORM/Makefile
index 1dc6fe838..3900293cc 100644
--- a/testhal/STM32F30x/IRQ_STORM/Makefile
+++ b/testhal/STM32F30x/IRQ_STORM/Makefile
@@ -23,6 +23,11 @@ ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes
endif
+# Enable this if you want link time optimizations (LTO)
+ifeq ($(USE_LTO),)
+ USE_LTO = yes
+endif
+
# If enabled, this option allows to compile the application in THUMB mode.
ifeq ($(USE_THUMB),)
USE_THUMB = yes
diff --git a/testhal/STM32F30x/PWM-ICU/Makefile b/testhal/STM32F30x/PWM-ICU/Makefile
index 1dc6fe838..3900293cc 100644
--- a/testhal/STM32F30x/PWM-ICU/Makefile
+++ b/testhal/STM32F30x/PWM-ICU/Makefile
@@ -23,6 +23,11 @@ ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes
endif
+# Enable this if you want link time optimizations (LTO)
+ifeq ($(USE_LTO),)
+ USE_LTO = yes
+endif
+
# If enabled, this option allows to compile the application in THUMB mode.
ifeq ($(USE_THUMB),)
USE_THUMB = yes
diff --git a/testhal/STM32F30x/SPI/Makefile b/testhal/STM32F30x/SPI/Makefile
index 1dc6fe838..3900293cc 100644
--- a/testhal/STM32F30x/SPI/Makefile
+++ b/testhal/STM32F30x/SPI/Makefile
@@ -23,6 +23,11 @@ ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes
endif
+# Enable this if you want link time optimizations (LTO)
+ifeq ($(USE_LTO),)
+ USE_LTO = yes
+endif
+
# If enabled, this option allows to compile the application in THUMB mode.
ifeq ($(USE_THUMB),)
USE_THUMB = yes
diff --git a/testhal/STM32F30x/UART/Makefile b/testhal/STM32F30x/UART/Makefile
index 1dc6fe838..3900293cc 100644
--- a/testhal/STM32F30x/UART/Makefile
+++ b/testhal/STM32F30x/UART/Makefile
@@ -23,6 +23,11 @@ ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes
endif
+# Enable this if you want link time optimizations (LTO)
+ifeq ($(USE_LTO),)
+ USE_LTO = yes
+endif
+
# If enabled, this option allows to compile the application in THUMB mode.
ifeq ($(USE_THUMB),)
USE_THUMB = yes
diff --git a/testhal/STM32F30x/USB_CDC/Makefile b/testhal/STM32F30x/USB_CDC/Makefile
index d7ff2881b..e943ce8f4 100644
--- a/testhal/STM32F30x/USB_CDC/Makefile
+++ b/testhal/STM32F30x/USB_CDC/Makefile
@@ -23,6 +23,11 @@ ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes
endif
+# Enable this if you want link time optimizations (LTO)
+ifeq ($(USE_LTO),)
+ USE_LTO = yes
+endif
+
# If enabled, this option allows to compile the application in THUMB mode.
ifeq ($(USE_THUMB),)
USE_THUMB = yes
diff --git a/testhal/STM32F4xx/ADC/Makefile b/testhal/STM32F4xx/ADC/Makefile
index 4ac8a006b..a490a9cb2 100644
--- a/testhal/STM32F4xx/ADC/Makefile
+++ b/testhal/STM32F4xx/ADC/Makefile
@@ -23,6 +23,11 @@ ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes
endif
+# Enable this if you want link time optimizations (LTO)
+ifeq ($(USE_LTO),)
+ USE_LTO = yes
+endif
+
# If enabled, this option allows to compile the application in THUMB mode.
ifeq ($(USE_THUMB),)
USE_THUMB = yes
diff --git a/testhal/STM32F4xx/CAN/Makefile b/testhal/STM32F4xx/CAN/Makefile
index 4ac8a006b..a490a9cb2 100644
--- a/testhal/STM32F4xx/CAN/Makefile
+++ b/testhal/STM32F4xx/CAN/Makefile
@@ -23,6 +23,11 @@ ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes
endif
+# Enable this if you want link time optimizations (LTO)
+ifeq ($(USE_LTO),)
+ USE_LTO = yes
+endif
+
# If enabled, this option allows to compile the application in THUMB mode.
ifeq ($(USE_THUMB),)
USE_THUMB = yes
diff --git a/testhal/STM32F4xx/DMA_STORM/Makefile b/testhal/STM32F4xx/DMA_STORM/Makefile
index 4ac8a006b..a490a9cb2 100644
--- a/testhal/STM32F4xx/DMA_STORM/Makefile
+++ b/testhal/STM32F4xx/DMA_STORM/Makefile
@@ -23,6 +23,11 @@ ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes
endif
+# Enable this if you want link time optimizations (LTO)
+ifeq ($(USE_LTO),)
+ USE_LTO = yes
+endif
+
# If enabled, this option allows to compile the application in THUMB mode.
ifeq ($(USE_THUMB),)
USE_THUMB = yes
diff --git a/testhal/STM32F4xx/EXT/Makefile b/testhal/STM32F4xx/EXT/Makefile
index 4ac8a006b..a490a9cb2 100644
--- a/testhal/STM32F4xx/EXT/Makefile
+++ b/testhal/STM32F4xx/EXT/Makefile
@@ -23,6 +23,11 @@ ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes
endif
+# Enable this if you want link time optimizations (LTO)
+ifeq ($(USE_LTO),)
+ USE_LTO = yes
+endif
+
# If enabled, this option allows to compile the application in THUMB mode.
ifeq ($(USE_THUMB),)
USE_THUMB = yes
diff --git a/testhal/STM32F4xx/GPT/Makefile b/testhal/STM32F4xx/GPT/Makefile
index 4ac8a006b..a490a9cb2 100644
--- a/testhal/STM32F4xx/GPT/Makefile
+++ b/testhal/STM32F4xx/GPT/Makefile
@@ -23,6 +23,11 @@ ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes
endif
+# Enable this if you want link time optimizations (LTO)
+ifeq ($(USE_LTO),)
+ USE_LTO = yes
+endif
+
# If enabled, this option allows to compile the application in THUMB mode.
ifeq ($(USE_THUMB),)
USE_THUMB = yes
diff --git a/testhal/STM32F4xx/I2C/Makefile b/testhal/STM32F4xx/I2C/Makefile
index bbe3f59e7..c750ca9a8 100644
--- a/testhal/STM32F4xx/I2C/Makefile
+++ b/testhal/STM32F4xx/I2C/Makefile
@@ -23,6 +23,11 @@ ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes
endif
+# Enable this if you want link time optimizations (LTO)
+ifeq ($(USE_LTO),)
+ USE_LTO = yes
+endif
+
# If enabled, this option allows to compile the application in THUMB mode.
ifeq ($(USE_THUMB),)
USE_THUMB = yes
diff --git a/testhal/STM32F4xx/IRQ_STORM/Makefile b/testhal/STM32F4xx/IRQ_STORM/Makefile
index 4ac8a006b..a490a9cb2 100644
--- a/testhal/STM32F4xx/IRQ_STORM/Makefile
+++ b/testhal/STM32F4xx/IRQ_STORM/Makefile
@@ -23,6 +23,11 @@ ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes
endif
+# Enable this if you want link time optimizations (LTO)
+ifeq ($(USE_LTO),)
+ USE_LTO = yes
+endif
+
# If enabled, this option allows to compile the application in THUMB mode.
ifeq ($(USE_THUMB),)
USE_THUMB = yes
diff --git a/testhal/STM32F4xx/IRQ_STORM_FPU/Makefile b/testhal/STM32F4xx/IRQ_STORM_FPU/Makefile
index 85193a290..ce0ac69fc 100644
--- a/testhal/STM32F4xx/IRQ_STORM_FPU/Makefile
+++ b/testhal/STM32F4xx/IRQ_STORM_FPU/Makefile
@@ -23,6 +23,11 @@ ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes
endif
+# Enable this if you want link time optimizations (LTO)
+ifeq ($(USE_LTO),)
+ USE_LTO = yes
+endif
+
# If enabled, this option allows to compile the application in THUMB mode.
ifeq ($(USE_THUMB),)
USE_THUMB = yes
diff --git a/testhal/STM32F4xx/PWM-ICU/Makefile b/testhal/STM32F4xx/PWM-ICU/Makefile
index 4ac8a006b..a490a9cb2 100644
--- a/testhal/STM32F4xx/PWM-ICU/Makefile
+++ b/testhal/STM32F4xx/PWM-ICU/Makefile
@@ -23,6 +23,11 @@ ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes
endif
+# Enable this if you want link time optimizations (LTO)
+ifeq ($(USE_LTO),)
+ USE_LTO = yes
+endif
+
# If enabled, this option allows to compile the application in THUMB mode.
ifeq ($(USE_THUMB),)
USE_THUMB = yes
diff --git a/testhal/STM32F4xx/RTC/Makefile b/testhal/STM32F4xx/RTC/Makefile
index 9d44e68a3..169be5d4e 100644
--- a/testhal/STM32F4xx/RTC/Makefile
+++ b/testhal/STM32F4xx/RTC/Makefile
@@ -23,6 +23,11 @@ ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes
endif
+# Enable this if you want link time optimizations (LTO)
+ifeq ($(USE_LTO),)
+ USE_LTO = yes
+endif
+
# If enabled, this option allows to compile the application in THUMB mode.
ifeq ($(USE_THUMB),)
USE_THUMB = yes
diff --git a/testhal/STM32F4xx/SDC/Makefile b/testhal/STM32F4xx/SDC/Makefile
index 1df93419a..f18ec1a39 100644
--- a/testhal/STM32F4xx/SDC/Makefile
+++ b/testhal/STM32F4xx/SDC/Makefile
@@ -23,6 +23,11 @@ ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes
endif
+# Enable this if you want link time optimizations (LTO)
+ifeq ($(USE_LTO),)
+ USE_LTO = yes
+endif
+
# If enabled, this option allows to compile the application in THUMB mode.
ifeq ($(USE_THUMB),)
USE_THUMB = yes
diff --git a/testhal/STM32F4xx/SPI/Makefile b/testhal/STM32F4xx/SPI/Makefile
index 4ac8a006b..a490a9cb2 100644
--- a/testhal/STM32F4xx/SPI/Makefile
+++ b/testhal/STM32F4xx/SPI/Makefile
@@ -23,6 +23,11 @@ ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes
endif
+# Enable this if you want link time optimizations (LTO)
+ifeq ($(USE_LTO),)
+ USE_LTO = yes
+endif
+
# If enabled, this option allows to compile the application in THUMB mode.
ifeq ($(USE_THUMB),)
USE_THUMB = yes
diff --git a/testhal/STM32F4xx/UART/Makefile b/testhal/STM32F4xx/UART/Makefile
index 4ac8a006b..a490a9cb2 100644
--- a/testhal/STM32F4xx/UART/Makefile
+++ b/testhal/STM32F4xx/UART/Makefile
@@ -23,6 +23,11 @@ ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes
endif
+# Enable this if you want link time optimizations (LTO)
+ifeq ($(USE_LTO),)
+ USE_LTO = yes
+endif
+
# If enabled, this option allows to compile the application in THUMB mode.
ifeq ($(USE_THUMB),)
USE_THUMB = yes
diff --git a/testhal/STM32F4xx/USB_CDC/Makefile b/testhal/STM32F4xx/USB_CDC/Makefile
index 81ad794b8..cd3b67d42 100644
--- a/testhal/STM32F4xx/USB_CDC/Makefile
+++ b/testhal/STM32F4xx/USB_CDC/Makefile
@@ -23,6 +23,11 @@ ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes
endif
+# Enable this if you want link time optimizations (LTO)
+ifeq ($(USE_LTO),)
+ USE_LTO = yes
+endif
+
# If enabled, this option allows to compile the application in THUMB mode.
ifeq ($(USE_THUMB),)
USE_THUMB = yes
diff --git a/testhal/common/testbuild/Makefile b/testhal/common/testbuild/Makefile
index 280c5f3e3..6fdc00e31 100644
--- a/testhal/common/testbuild/Makefile
+++ b/testhal/common/testbuild/Makefile
@@ -23,6 +23,11 @@ ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes
endif
+# Enable this if you want link time optimizations (LTO)
+ifeq ($(USE_LTO),)
+ USE_LTO = yes
+endif
+
# If enabled, this option allows to compile the application in THUMB mode.
ifeq ($(USE_THUMB),)
USE_THUMB = yes