Subversion Repositories HomeAutomation

Rev

Details | Last modification | View Log | SVN | RSS feed

Rev Author Line No. Line
326 eqlazer 1
PRG            = main
2
OBJ            = main.o\
3
				../lib/src/sensor/ds18s20/ds18x20.o\
4
				../lib/src/sensor/ds18s20/delay.o\
5
				../lib/src/sensor/ds18s20/onewire.o\
6
				../lib/src/sensor/ds18s20/crc8.o\
7
#				../lib/src/sensor/tc1047/tc1047.o\
8
 
9
MCU_TARGET     = atmega88
10
OPTIMIZE       = -Os -mcall-prologues
11
# grep bios.map for __bios_ram_end to retreive this value
12
# In the future, this should be automatically inserted into *_app.ld at every bios compilation
13
BIOS_RAM_END   = 0x0080012a
14
#0x0080015d
15
ifeq ($(MCU_TARGET),atmega88)
16
	#uncomment this line if you're using m88, remove line when gcc-bug fixed
17
	EXTRA_LD        = avr-ld -m avr4 -o $(PRG).elf /usr/avr/lib/avr4/crtm88.o -L/usr/lib/gcc/avr/4.1.0/avr4 -L/usr/lib/gcc/avr/4.1.0/avr4 -L/usr/avr/lib/avr4 -Map $(PRG).map -L../AVR-Bios --defsym __bios_ram_end=$(BIOS_RAM_END) -T$(MCU_TARGET)_app.ld $(PRG).o -lgcc -lc -lgcc
18
endif
19
BIOS_RAM_END   = 0x0080012a
20
 
21
DEFS           = -I../AVR-Bios\
22
				-I../lib/funcdefs\
23
				-I../lib/src/sensor/ds18s20\
24
#				-I../lib/src/sensor/tc1047\
25
 
26
LIBS           =
27
 
28
# You should not have to change anything below here.
29
 
30
CC             = avr-gcc
31
 
32
# Override is only needed by avr-lib build system.
33
 
34
override CFLAGS        = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) $(DEFS)
35
override LDFLAGS       = -v -Wl,-Map,$(PRG).map,-L../AVR-Bios,--defsym,__bios_ram_end=$(BIOS_RAM_END),-T$(MCU_TARGET)_app.ld
36
override ASFLAGS       = -x assembler-with-cpp -Wa,-gstabs -mmcu=$(MCU_TARGET) $(DEFS)
37
 
38
OBJCOPY        = avr-objcopy
39
OBJDUMP        = avr-objdump
40
SIZE           = avr-size
41
SZFLAGS        = 
42
UPLOAD         = avrdude
43
ULFLAGS        = -p $(MCU_TARGET) -D -P /dev/ttyUSB0 -c avrispv2 -b 115200 -U flash:w:$(PRG).hex
44
# -D disables erase!
45
 
46
default: $(PRG).elf lst text
47
	@$(SIZE) $(SZFLAGS) $(PRG).elf
48
 
49
all: $(PRG).elf lst text eeprom
50
 
51
$(PRG).elf: $(OBJ)
52
ifeq ($(MCU_TARGET),atmega88)
53
	#remove this workaround when gcc-bug fixed
54
	avr-ld -m avr4 -o $(PRG).elf /usr/avr/lib/avr4/crtm88.o -L/usr/lib/gcc/avr/4.1.0/avr4 -L/usr/lib/gcc/avr/4.1.0/avr4 -L/usr/avr/lib/avr4 -Map $(PRG).map -L../AVR-Bios --defsym __bios_ram_end=$(BIOS_RAM_END) -T$(MCU_TARGET)_app.ld $(OBJ) -lgcc -lc -lgcc
55
else
56
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
57
endif
58
 
59
clean:
60
	rm -rf *.o $(PRG).elf *.eps *.png *.pdf *.bak 
61
	rm -rf *.lst *.map $(EXTRA_CLEAN_FILES)
62
 
63
lst:  $(PRG).lst
64
 
65
%.lst: %.elf
66
	$(OBJDUMP) -h -S $< > $@
67
 
68
# Rules for building the .text rom images
69
 
70
text: hex bin srec
71
 
72
hex:  $(PRG).hex
73
bin:  $(PRG).bin
74
srec: $(PRG).srec
75
 
76
%.hex: %.elf
77
	$(OBJCOPY) -j .text -j .data -O ihex $< $@
78
 
79
%.srec: %.elf
80
	$(OBJCOPY) -j .text -j .data -O srec $< $@
81
 
82
%.bin: %.elf
83
	$(OBJCOPY) -j .text -j .data -O binary $< $@
84
 
85
# Rules for uploading rom images to flash
86
 
87
install: hex
88
	$(UPLOAD) $(ULFLAGS)
89
 
90
# Rules for building the .eeprom rom images
91
 
92
eeprom: ehex ebin esrec
93
 
94
ehex:  $(PRG)_eeprom.hex
95
ebin:  $(PRG)_eeprom.bin
96
esrec: $(PRG)_eeprom.srec
97
 
98
%_eeprom.hex: %.elf
99
	$(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O ihex $< $@
100
 
101
%_eeprom.srec: %.elf
102
	$(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O srec $< $@
103
 
104
%_eeprom.bin: %.elf
105
	$(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O binary $< $@
106
 
107
# Every thing below here is used by avr-libc's build system and can be ignored
108
# by the casual user.
109
 
110
FIG2DEV                 = fig2dev
111
EXTRA_CLEAN_FILES       = *.hex *.bin *.srec
112
 
113
dox: eps png pdf
114
 
115
eps: $(PRG).eps
116
png: $(PRG).png
117
pdf: $(PRG).pdf
118
 
119
%.eps: %.fig
120
	$(FIG2DEV) -L eps $< $@
121
 
122
%.pdf: %.fig
123
	$(FIG2DEV) -L pdf $< $@
124
 
125
%.png: %.fig
126
	$(FIG2DEV) -L png $< $@
127