Subversion Repositories HomeAutomation

Rev

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

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