Subversion Repositories HomeAutomation

Rev

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

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