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