Skip to content

Commit 7488332

Browse files
aykevlglennrub
authored andcommitted
ports/nrf: Enable Link-time optimizations
1 parent f57be61 commit 7488332

File tree

4 files changed

+4
-5
lines changed

4 files changed

+4
-5
lines changed

ports/nrf/Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,13 @@ CFLAGS += $(CFLAGS_MCU_$(MCU_SERIES))
7474
CFLAGS += $(INC) -Wall -Werror -ansi -std=gnu99 -nostdlib $(COPT) $(NRF_DEFINES) $(CFLAGS_MOD)
7575
CFLAGS += -fno-strict-aliasing
7676
CFLAGS += -fstack-usage
77-
CFLAGS += -fdata-sections -ffunction-sections
7877
CFLAGS += -Iboards/$(BOARD)
7978
CFLAGS += -DNRF5_HAL_H='<$(MCU_VARIANT)_hal.h>'
79+
CFLAGS += -flto
8080

8181
LDFLAGS = $(CFLAGS)
8282
LDFLAGS += -Xlinker -Map=$(@:.elf=.map)
8383
LDFLAGS += -mthumb -mabi=aapcs -T $(LD_FILE) -L boards/
84-
LDFLAGS += -Wl,--gc-sections
8584

8685
#Debugging/Optimization
8786
ifeq ($(DEBUG), 1)

ports/nrf/device/nrf51/startup_nrf51822.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ void SWI3_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler"
103103
void SWI4_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
104104
void SWI5_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
105105

106-
const func __Vectors[] __attribute__ ((section(".isr_vector"))) = {
106+
const func __Vectors[] __attribute__ ((section(".isr_vector"),used)) = {
107107
(func)&_estack,
108108
Reset_Handler,
109109
NMI_Handler,

ports/nrf/device/nrf52/startup_nrf52832.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ void SPIM2_SPIS2_SPI2_IRQHandler (void) __attribute__ ((weak, alias("Default_Han
107107
void RTC2_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
108108
void I2S_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
109109

110-
const func __Vectors[] __attribute__ ((section(".isr_vector"))) = {
110+
const func __Vectors[] __attribute__ ((section(".isr_vector"),used)) = {
111111
(func)&_estack,
112112
Reset_Handler,
113113
NMI_Handler,

ports/nrf/device/nrf52/startup_nrf52840.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ void CRYPTOCELL_IRQHandler (void) __attribute__ ((weak, alias("Default_Han
114114
void SPIM3_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
115115
void PWM3_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));
116116

117-
const func __Vectors[] __attribute__ ((section(".isr_vector"))) = {
117+
const func __Vectors[] __attribute__ ((section(".isr_vector"),used)) = {
118118
(func)&_estack,
119119
Reset_Handler,
120120
NMI_Handler,

0 commit comments

Comments
 (0)