]> cloudbase.mooo.com Git - avrcpm.git/blob - Makefile
Merged branch modules back into trunk.
[avrcpm.git] / Makefile
1 # AVR-ASM Makefile, derived from the WinAVR template (which
2 # is public domain), believed to be neutral to any flavor of "make"
3 # (GNU make, BSD make, SysV make)
4
5 #MCU = atmega8
6 MCU = atmega328P
7 F_CPU = 20000000
8 #BAUD = 19200
9 BAUD = 57600
10 #BAUD = 115200
11
12 DRAM_8BIT = 1
13
14 TARGET = avrcpm
15 ASRC = avrcpm.asm
16
17 # Place -D or -U options here
18 CDEFS = -DF_CPU=$(F_CPU) -DBAUD=$(BAUD) -D$(MCU) -DDRAM_8BIT=$(DRAM_8BIT)
19
20 WINEPATH = C:/Programme/Atmel/AVR\ Tools/AvrAssembler2
21 DEFS = $(WINEPATH)/Appnotes
22
23 AS = wine $(WINEPATH)/avrasm2.exe
24 ASFLAGS = -I $(DEFS) $(CDEFS)
25
26 # Programming support using avrdude. Settings and variables.
27
28 AVRDUDE_PROGRAMMER = dragon_isp
29 AVRDUDE_PORT = usb
30
31 AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
32 AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
33
34
35 # Uncomment the following if you want avrdude's erase cycle counter.
36 # Note that this counter needs to be initialized first using -Yn,
37 # see avrdude manual.
38 #AVRDUDE_ERASE_COUNTER = -y
39
40 # Uncomment the following if you do /not/ wish a verification to be
41 # performed after programming the device.
42 #AVRDUDE_NO_VERIFY = -V
43
44 # Increase verbosity level. Please use this when submitting bug
45 # reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
46 # to submit bug reports.
47 #AVRDUDE_VERBOSE = -v -v
48
49 AVRDUDE_BASIC = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
50 AVRDUDE_FLAGS = $(AVRDUDE_BASIC) $(AVRDUDE_NO_VERIFY) $(AVRDUDE_VERBOSE) $(AVRDUDE_ERASE_COUNTER)
51
52 AVRDUDE = avrdude
53 REMOVE = rm -f
54 MV = mv -f
55
56
57 # Define all listing files.
58 LST = $(ASRC:.asm=.lst)
59
60 # Combine all necessary flags and optional flags.
61 # Add target processor to flags.
62 ALL_ASFLAGS = $(ASFLAGS)
63
64 # Default target.
65 all: hex lst
66
67 hex: $(TARGET).hex
68 eep: $(TARGET).eep
69 lst: $(TARGET).lst
70 map: $(TARGET).map
71
72
73 # Program the device.
74 program: $(TARGET).hex $(TARGET).eep
75 $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
76
77 flash: $(TARGET).hex
78 $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH)
79
80 eeprom: $(TARGET).hex $(TARGET).eep
81 $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_EEPROM)
82
83
84
85 .SUFFIXES: .hex .eep .lst
86
87 %.hex: %.asm
88 $(AS) $(ALL_ASFLAGS) -fI -o $@ $<
89
90 %.lst: %.asm
91 @$(AS) $(ALL_ASFLAGS) -v0 -f- -l $@ $<
92
93 %.map: %.asm
94 $(AS) $(ALL_ASFLAGS) -v0 -f- -m $@ $<
95
96 tags: $(SRC) $(ASRC)
97 ctags $(SRC) $(ASRC)
98
99
100
101 # Target: clean project.
102 clean:
103 $(REMOVE) $(TARGET).hex $(TARGET).eep $(TARGET).obj $(TARGET).map $(TARGET).lst
104
105
106 .PHONY: all hex eep lst map program flash eeprom tags clean
107