# HG changeset patch # User Matt Johnston # Date 1337418950 -28800 # Node ID 4ef5ce596ec60dc2477de5183fc1a0310b9bb8d5 # Parent 8f32eb67a27945fab0d23d7afbab585d64be877c all these optimisations make it 30% smaller diff -r 8f32eb67a279 -r 4ef5ce596ec6 Makefile --- a/Makefile Sat May 19 17:10:13 2012 +0800 +++ b/Makefile Sat May 19 17:15:50 2012 +0800 @@ -22,11 +22,11 @@ CLOCK = 2000000 PROGRAMMER = #-c stk500v2 -P avrdoper PROGRAMMER = -c stk500 -P ~/dev/stk500 -p $(PROGDEVICE) -B 2 -OBJS_1WIRE = onewire.o ds18x20.o uart_addon.o crc8.o uart.o -OBJS_SD = ff.o mmc.o -OBJECTS = main.o -OBJECTS += $(OBJS_1WIRE) -#OBJECTS += OBJS_SD +SOURCE_1WIRE = onewire.c ds18x20.c uart_addon.c crc8.c uart.c +SOURCE_SD = ff.c mmc.c +SOURCE = main.c +SOURCE += $(SOURCE_1WIRE) +#SOURCE += $(SOURCE_SD) LIBS = -lm # default but 2mhz @@ -58,7 +58,7 @@ # Tune the lines below only if you know what you are doing: AVRDUDE = avrdude $(PROGRAMMER) -COMPILE = avr-gcc -Wall -Os -DF_CPU=$(CLOCK) -mmcu=$(DEVICE) -g -std=c99 -mcall-prologues -fdata-sections -ffunction-sections -Wl,--print-gc-sections -Wl,--gc-sections -Wl,--relax +COMPILE = avr-gcc -Wall -Os -DF_CPU=$(CLOCK) -mmcu=$(DEVICE) -g -std=c99 -mcall-prologues -fdata-sections -ffunction-sections -Wl,--gc-sections -Wl,--relax --combine -fwhole-program # symbolic targets: all: main.hex @@ -93,8 +93,8 @@ rm -f main.hex main.elf $(OBJECTS) # file targets: -main.elf: $(OBJECTS) - $(COMPILE) -o main.elf $(OBJECTS) $(LIBS) +main.elf: $(SOURCE) + $(COMPILE) -o main.elf $(SOURCE) $(LIBS) main.hex: main.elf rm -f main.hex