Makefile-AVR: solve the .siminfo section problem properly.
After researching this issue for the third time, I finally found
a proper solution: one can't keep an entire section without re-
writing the entire link script, but one can keep individual
symbols. That's what we do now, so we can use --gc-sections when
linking with SimulAVR support.
The problem came up again because -flto drops unused symbols, too.
This commit changes binary size drastically (1654 bytes less), so
let's take a new performance measurement snapshot:
ATmega sizes '168 '328(P) '644(P) '1280
Program: 17616 bytes 123% 58% 28% 14%
Data: 2175 bytes 213% 107% 54% 27%
EEPROM: 32 bytes 4% 2% 2% 1%
short-moves.gcode statistics:
LED on occurences: 888.
LED on time minimum: 218 clock cycles.
LED on time maximum: 395 clock cycles.
LED on time average: 249.051 clock cycles.
smooth-curves.gcode statistics:
LED on occurences: 23648.
LED on time minimum: 237 clock cycles.
LED on time maximum: 438 clock cycles.
LED on time average: 272.216 clock cycles.
triangle-odd.gcode statistics:
LED on occurences: 1636.
LED on time minimum: 237 clock cycles.
LED on time maximum: 395 clock cycles.
LED on time average: 262.572 clock cycles.
This commit is contained in:
parent
877b9fae6f
commit
b7bd1ad3d7
|
|
@ -136,14 +136,16 @@ CFLAGS += -Wa,-adhlns=$(@:.o=.al)
|
|||
#CFLAGS += -dM -E # To list all predefined macros into the .o file.
|
||||
|
||||
LDFLAGS = -Wl,--as-needed
|
||||
LDFLAGS += -Wl,--gc-sections
|
||||
|
||||
ifneq ($(realpath ../simulavr/src/simulavr_info.h),)
|
||||
# Neccessary for simulavr support, doesn't hurt others.
|
||||
CFLAGS += -DSIMINFO
|
||||
LDFLAGS += -Wl,--section-start=.siminfo=0x900000
|
||||
else
|
||||
# Doesn't work for simulavr, can't allow dead code removal.
|
||||
LDFLAGS += -Wl,--gc-sections
|
||||
LDFLAGS += -u siminfo_device
|
||||
LDFLAGS += -u siminfo_cpufrequency
|
||||
LDFLAGS += -u siminfo_serial_in
|
||||
LDFLAGS += -u siminfo_serial_out
|
||||
endif
|
||||
|
||||
LIBS = -lm
|
||||
|
|
|
|||
Loading…
Reference in New Issue