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