Subversion Repositories HomeAutomation

Rev

Rev 223 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 223 Rev 229
1
PRG            = main
1
PRG            = main
2
OBJ            = main.o
2
OBJ            = main.o
3
MCU_TARGET     = atmega8
3
MCU_TARGET     = atmega88
4
OPTIMIZE       = -Os -mcall-prologues
4
OPTIMIZE       = -Os -mcall-prologues
-
 
5
# grep bios.map for __bios_ram_end to retreive this value
-
 
6
BIOS_RAM_END   = 0x008000bd
-
 
7
# In the future, this should be automatically inserted into *_app.ld at every bios compilation
5
 
8
 
6
DEFS           = -I../AVR-Bios
9
DEFS           = -I../AVR-Bios
7
LIBS           =
10
LIBS           =
8
 
11
 
9
# You should not have to change anything below here.
12
# You should not have to change anything below here.
10
 
13
 
11
CC             = avr-gcc
14
CC             = avr-gcc
12
 
15
 
13
# Override is only needed by avr-lib build system.
16
# Override is only needed by avr-lib build system.
14
 
17
 
15
override CFLAGS        = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) $(DEFS)
18
override CFLAGS        = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) $(DEFS)
16
override LDFLAGS       = -Wl,-Map,$(PRG).map,-L../AVR-Bios,-T$(MCU_TARGET)_app.ld
19
override LDFLAGS       = -v -Wl,-Map,$(PRG).map,-L../AVR-Bios,--defsym,__bios_ram_end=$(BIOS_RAM_END),-T$(MCU_TARGET)_app.ld
-
 
20
override ASFLAGS       = -x assembler-with-cpp -Wa,-gstabs -mmcu=$(MCU_TARGET) $(DEFS)
17
 
21
 
18
OBJCOPY        = avr-objcopy
22
OBJCOPY        = avr-objcopy
19
OBJDUMP        = avr-objdump
23
OBJDUMP        = avr-objdump
20
SIZE           = avr-size
24
SIZE           = avr-size
21
SZFLAGS        = 
25
SZFLAGS        = 
22
UPLOAD         = uisp
26
UPLOAD         = uisp
23
ULFLAGS        = -dpart=$(MCU_TARGET) -dprog=avr910 -dserial=/dev/ttyS0 -dspeed=115200 --upload --verify if=$(PRG).hex
27
ULFLAGS        = -dpart=$(MCU_TARGET) -dprog=avr910 -dserial=/dev/ttyS0 -dspeed=115200 --upload --verify if=$(PRG).hex
24
 
28
 
25
default: $(PRG).elf lst
29
default: $(PRG).elf lst
26
	@$(SIZE) $(SZFLAGS) $(PRG).elf
30
	@$(SIZE) $(SZFLAGS) $(PRG).elf
27
 
31
 
28
all: $(PRG).elf lst text eeprom
32
all: $(PRG).elf lst text eeprom
29
 
33
 
30
$(PRG).elf: $(OBJ)
34
$(PRG).elf: $(OBJ)
31
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
35
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
32
 
36
 
33
clean:
37
clean:
34
	rm -rf *.o $(PRG).elf *.eps *.png *.pdf *.bak 
38
	rm -rf *.o $(PRG).elf *.eps *.png *.pdf *.bak 
35
	rm -rf *.lst *.map $(EXTRA_CLEAN_FILES)
39
	rm -rf *.lst *.map $(EXTRA_CLEAN_FILES)
36
 
40
 
37
lst:  $(PRG).lst
41
lst:  $(PRG).lst
38
 
42
 
39
%.lst: %.elf
43
%.lst: %.elf
40
	$(OBJDUMP) -h -S $< > $@
44
	$(OBJDUMP) -h -S $< > $@
41
 
45
 
42
# Rules for building the .text rom images
46
# Rules for building the .text rom images
43
 
47
 
44
text: hex bin srec
48
text: hex bin srec
45
 
49
 
46
hex:  $(PRG).hex
50
hex:  $(PRG).hex
47
bin:  $(PRG).bin
51
bin:  $(PRG).bin
48
srec: $(PRG).srec
52
srec: $(PRG).srec
49
 
53
 
50
%.hex: %.elf
54
%.hex: %.elf
51
	$(OBJCOPY) -j .text -j .data -O ihex $< $@
55
	$(OBJCOPY) -j .text -j .data -O ihex $< $@
52
 
56
 
53
%.srec: %.elf
57
%.srec: %.elf
54
	$(OBJCOPY) -j .text -j .data -O srec $< $@
58
	$(OBJCOPY) -j .text -j .data -O srec $< $@
55
 
59
 
56
%.bin: %.elf
60
%.bin: %.elf
57
	$(OBJCOPY) -j .text -j .data -O binary $< $@
61
	$(OBJCOPY) -j .text -j .data -O binary $< $@
58
 
62
 
59
# Rules for uploading rom images to flash
63
# Rules for uploading rom images to flash
60
 
64
 
61
install: hex
65
install: hex
62
	$(UPLOAD) $(ULFLAGS)
66
	$(UPLOAD) $(ULFLAGS)
63
 
67
 
64
# Rules for building the .eeprom rom images
68
# Rules for building the .eeprom rom images
65
 
69
 
66
eeprom: ehex ebin esrec
70
eeprom: ehex ebin esrec
67
 
71
 
68
ehex:  $(PRG)_eeprom.hex
72
ehex:  $(PRG)_eeprom.hex
69
ebin:  $(PRG)_eeprom.bin
73
ebin:  $(PRG)_eeprom.bin
70
esrec: $(PRG)_eeprom.srec
74
esrec: $(PRG)_eeprom.srec
71
 
75
 
72
%_eeprom.hex: %.elf
76
%_eeprom.hex: %.elf
73
	$(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O ihex $< $@
77
	$(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O ihex $< $@
74
 
78
 
75
%_eeprom.srec: %.elf
79
%_eeprom.srec: %.elf
76
	$(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O srec $< $@
80
	$(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O srec $< $@
77
 
81
 
78
%_eeprom.bin: %.elf
82
%_eeprom.bin: %.elf
79
	$(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O binary $< $@
83
	$(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O binary $< $@
80
 
84
 
81
# Every thing below here is used by avr-libc's build system and can be ignored
85
# Every thing below here is used by avr-libc's build system and can be ignored
82
# by the casual user.
86
# by the casual user.
83
 
87
 
84
FIG2DEV                 = fig2dev
88
FIG2DEV                 = fig2dev
85
EXTRA_CLEAN_FILES       = *.hex *.bin *.srec
89
EXTRA_CLEAN_FILES       = *.hex *.bin *.srec
86
 
90
 
87
dox: eps png pdf
91
dox: eps png pdf
88
 
92
 
89
eps: $(PRG).eps
93
eps: $(PRG).eps
90
png: $(PRG).png
94
png: $(PRG).png
91
pdf: $(PRG).pdf
95
pdf: $(PRG).pdf
92
 
96
 
93
%.eps: %.fig
97
%.eps: %.fig
94
	$(FIG2DEV) -L eps $< $@
98
	$(FIG2DEV) -L eps $< $@
95
 
99
 
96
%.pdf: %.fig
100
%.pdf: %.fig
97
	$(FIG2DEV) -L pdf $< $@
101
	$(FIG2DEV) -L pdf $< $@
98
 
102
 
99
%.png: %.fig
103
%.png: %.fig
100
	$(FIG2DEV) -L png $< $@
104
	$(FIG2DEV) -L png $< $@
101
 
105