Subversion Repositories HomeAutomation

Rev

Details | Last modification | View Log | SVN | RSS feed

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