Subversion Repositories HomeAutomation

Rev

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

Rev 230 Rev 234
1
PRG            = bios
1
PRG            = bios
2
OBJ            = vectors.o bios.o flash.o
2
OBJ            = vectors.o bios.o flash.o
3
MCU_TARGET     = atmega8
3
MCU_TARGET     = atmega88
4
OPTIMIZE       = -Os -mcall-prologues
4
OPTIMIZE       = -Os -mcall-prologues
5
BIOS_START     = 0x100
5
BIOS_START     = 0x1000
6
BOOT_START     = 0x1f00
6
BOOT_START     = 0x1f00
7
 
7
 
8
DEFS           =
8
DEFS           =
9
LIBS           =
9
LIBS           =
-
 
10
 
-
 
11
# fuses, these fuses shuld be used, later this makefile shuld program them for you
-
 
12
# lfuse 0xE2 (no prescaler, should be set in bios later)		#mega88
-
 
13
# hfuse default													#mega88
-
 
14
# efuse 0x06 (BOOTRST=0, BOOTSZ0=1, BOOTSZ1=1)					#mega88
10
 
15
 
11
# You should not have to change anything below here.
16
# You should not have to change anything below here.
12
 
17
 
13
CC             = avr-gcc
18
CC             = avr-gcc
14
 
19
 
15
# Override is only needed by avr-lib build system.
20
# Override is only needed by avr-lib build system.
16
 
21
 
17
override CFLAGS        = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) $(DEFS)
22
override CFLAGS        = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) $(DEFS)
18
override LDFLAGS       = -Wl,-Map,$(PRG).map,--defsym,__bios_start=$(BIOS_START),--defsym,__boot_start=$(BOOT_START),-T$(MCU_TARGET)_bios.ld,--cref
23
override LDFLAGS       = -Wl,-Map,$(PRG).map,--defsym,__bios_start=$(BIOS_START),--defsym,__boot_start=$(BOOT_START),-T$(MCU_TARGET)_bios.ld,--cref
19
override ASFLAGS       = -x assembler-with-cpp -Wa,-gstabs -mmcu=$(MCU_TARGET) $(DEFS)
24
override ASFLAGS       = -x assembler-with-cpp -Wa,-gstabs -mmcu=$(MCU_TARGET) $(DEFS)
20
 
25
 
21
OBJCOPY        = avr-objcopy
26
OBJCOPY        = avr-objcopy
22
OBJDUMP        = avr-objdump
27
OBJDUMP        = avr-objdump
23
SIZE           = avr-size
28
SIZE           = avr-size
24
SZFLAGS        = 
29
SZFLAGS        = 
25
UPLOAD         = avrdude
30
UPLOAD         = avrdude
26
ULFLAGS        = -p $(MCU_TARGET) -P /dev/ttyUSB0 -c avrispv2 -b 115200 -U flash:w:$(PRG).hex
31
ULFLAGS        = -p $(MCU_TARGET) -P /dev/ttyUSB0 -c avrispv2 -b 115200 -U flash:w:$(PRG).hex
27
 
32
 
28
 
33
 
29
default: $(PRG).elf lst
34
default: $(PRG).elf lst
30
	@$(SIZE) $(SZFLAGS) $(PRG).elf
35
	@$(SIZE) $(SZFLAGS) $(PRG).elf
31
 
36
 
32
all: $(PRG).elf lst text eeprom
37
all: $(PRG).elf lst text eeprom
33
 
38
 
34
$(PRG).elf: $(OBJ)
39
$(PRG).elf: $(OBJ)
35
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
40
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
36
 
41
 
37
clean:
42
clean:
38
	rm -rf *.o $(PRG).elf *.eps *.png *.pdf *.bak 
43
	rm -rf *.o $(PRG).elf *.eps *.png *.pdf *.bak 
39
	rm -rf *.lst *.map $(EXTRA_CLEAN_FILES)
44
	rm -rf *.lst *.map $(EXTRA_CLEAN_FILES)
40
 
45
 
41
lst:  $(PRG).lst
46
lst:  $(PRG).lst
42
 
47
 
43
%.lst: %.elf
48
%.lst: %.elf
44
	$(OBJDUMP) -h -S $< > $@
49
	$(OBJDUMP) -h -S $< > $@
45
 
50
 
46
# Rules for building the .text rom images
51
# Rules for building the .text rom images
47
 
52
 
48
text: hex bin srec
53
text: hex bin srec
49
 
54
 
50
hex:  $(PRG).hex
55
hex:  $(PRG).hex
51
bin:  $(PRG).bin
56
bin:  $(PRG).bin
52
srec: $(PRG).srec
57
srec: $(PRG).srec
53
 
58
 
54
%.hex: %.elf
59
%.hex: %.elf
55
	$(OBJCOPY) -j .text -j .data -j .bootloader -O ihex $< $@
60
	$(OBJCOPY) -j .text -j .data -j .bootloader -O ihex $< $@
56
 
61
 
57
%.srec: %.elf
62
%.srec: %.elf
58
	$(OBJCOPY) -j .text -j .data -j .bootloader -O srec $< $@
63
	$(OBJCOPY) -j .text -j .data -j .bootloader -O srec $< $@
59
 
64
 
60
%.bin: %.elf
65
%.bin: %.elf
61
	$(OBJCOPY) -j .text -j .data -j .bootloader -O binary $< $@
66
	$(OBJCOPY) -j .text -j .data -j .bootloader -O binary $< $@
62
 
67
 
63
# Rules for uploading rom images to flash
68
# Rules for uploading rom images to flash
64
 
69
 
65
install: hex
70
install: hex
66
	$(UPLOAD) $(ULFLAGS)
71
	$(UPLOAD) $(ULFLAGS)
67
 
72
 
68
# Rules for building the .eeprom rom images
73
# Rules for building the .eeprom rom images
69
 
74
 
70
eeprom: ehex ebin esrec
75
eeprom: ehex ebin esrec
71
 
76
 
72
ehex:  $(PRG)_eeprom.hex
77
ehex:  $(PRG)_eeprom.hex
73
ebin:  $(PRG)_eeprom.bin
78
ebin:  $(PRG)_eeprom.bin
74
esrec: $(PRG)_eeprom.srec
79
esrec: $(PRG)_eeprom.srec
75
 
80
 
76
%_eeprom.hex: %.elf
81
%_eeprom.hex: %.elf
77
	$(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O ihex $< $@
82
	$(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O ihex $< $@
78
 
83
 
79
%_eeprom.srec: %.elf
84
%_eeprom.srec: %.elf
80
	$(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O srec $< $@
85
	$(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O srec $< $@
81
 
86
 
82
%_eeprom.bin: %.elf
87
%_eeprom.bin: %.elf
83
	$(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O binary $< $@
88
	$(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O binary $< $@
84
 
89
 
85
# Every thing below here is used by avr-libc's build system and can be ignored
90
# Every thing below here is used by avr-libc's build system and can be ignored
86
# by the casual user.
91
# by the casual user.
87
 
92
 
88
FIG2DEV                 = fig2dev
93
FIG2DEV                 = fig2dev
89
EXTRA_CLEAN_FILES       = *.hex *.bin *.srec
94
EXTRA_CLEAN_FILES       = *.hex *.bin *.srec
90
 
95
 
91
dox: eps png pdf
96
dox: eps png pdf
92
 
97
 
93
eps: $(PRG).eps
98
eps: $(PRG).eps
94
png: $(PRG).png
99
png: $(PRG).png
95
pdf: $(PRG).pdf
100
pdf: $(PRG).pdf
96
 
101
 
97
%.eps: %.fig
102
%.eps: %.fig
98
	$(FIG2DEV) -L eps $< $@
103
	$(FIG2DEV) -L eps $< $@
99
 
104
 
100
%.pdf: %.fig
105
%.pdf: %.fig
101
	$(FIG2DEV) -L pdf $< $@
106
	$(FIG2DEV) -L pdf $< $@
102
 
107
 
103
%.png: %.fig
108
%.png: %.fig
104
	$(FIG2DEV) -L png $< $@
109
	$(FIG2DEV) -L png $< $@
105
 
110