]>
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 | ||
f2114c72 L |
5 | #MCU = atmega8 |
6 | MCU = atmega328P | |
ebf7dfab | 7 | F_CPU = 20000000 |
2f6fa691 L |
8 | #BAUD = 19200 |
9 | BAUD = 57600 | |
10 | #BAUD = 115200 | |
3c3744f1 | 11 | |
9c15f366 L |
12 | DRAM_8BIT = 1 |
13 | ||
14 | TARGET = avrcpm | |
b2017655 FZ |
15 | ASRC = avrcpm.asm |
16 | ||
17 | ASRC += config.inc macros.inc init.asm dram-refresh.asm timer.asm utils.asm | |
18 | ASRC += mmc.asm mmc-old.asm virt_ports.asm | |
19 | ASRC += dsk_cpm.asm dsk_fat16.asm dsk_fsys.asm dsk_mgr.asm dsk_ram.asm | |
20 | ASRC += 8080int.asm 8080int-jmp.asm 8080int-t3.asm 8080int-t3-jmp.asm | |
21 | ||
22 | ifneq ($(DRAM_8BIT),0) | |
23 | ASRC += dram-8bit.inc dram-8bit.asm sw-uart.asm | |
24 | else | |
25 | ASRC += dram-4bit.inc dram-4bit.asm hw-uart.asm | |
26 | endif | |
3c3744f1 L |
27 | |
28 | # Place -D or -U options here | |
9c15f366 | 29 | CDEFS = -DF_CPU=$(F_CPU) -DBAUD=$(BAUD) -D$(MCU) -DDRAM_8BIT=$(DRAM_8BIT) |
3c3744f1 L |
30 | |
31 | WINEPATH = C:/Programme/Atmel/AVR\ Tools/AvrAssembler2 | |
32 | DEFS = $(WINEPATH)/Appnotes | |
33 | ||
34 | AS = wine $(WINEPATH)/avrasm2.exe | |
35 | ASFLAGS = -I $(DEFS) $(CDEFS) | |
36 | ||
37 | # Programming support using avrdude. Settings and variables. | |
38 | ||
39 | AVRDUDE_PROGRAMMER = dragon_isp | |
40 | AVRDUDE_PORT = usb | |
41 | ||
42 | AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex | |
43 | AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep | |
44 | ||
45 | ||
46 | # Uncomment the following if you want avrdude's erase cycle counter. | |
47 | # Note that this counter needs to be initialized first using -Yn, | |
48 | # see avrdude manual. | |
49 | #AVRDUDE_ERASE_COUNTER = -y | |
50 | ||
51 | # Uncomment the following if you do /not/ wish a verification to be | |
52 | # performed after programming the device. | |
53 | #AVRDUDE_NO_VERIFY = -V | |
54 | ||
55 | # Increase verbosity level. Please use this when submitting bug | |
56 | # reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude> | |
57 | # to submit bug reports. | |
58 | #AVRDUDE_VERBOSE = -v -v | |
59 | ||
60 | AVRDUDE_BASIC = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) | |
61 | AVRDUDE_FLAGS = $(AVRDUDE_BASIC) $(AVRDUDE_NO_VERIFY) $(AVRDUDE_VERBOSE) $(AVRDUDE_ERASE_COUNTER) | |
62 | ||
63 | AVRDUDE = avrdude | |
64 | REMOVE = rm -f | |
65 | MV = mv -f | |
66 | ||
67 | ||
68 | # Define all listing files. | |
b2017655 | 69 | #LST = $(ASRC:.asm=.lst) |
3c3744f1 L |
70 | |
71 | # Combine all necessary flags and optional flags. | |
72 | # Add target processor to flags. | |
73 | ALL_ASFLAGS = $(ASFLAGS) | |
74 | ||
b2017655 FZ |
75 | .PHONY: all hex eep lst map program flash eeprom tags clean |
76 | ||
3c3744f1 L |
77 | # Default target. |
78 | all: hex lst | |
79 | ||
b2017655 FZ |
80 | hex: $(TARGET).hex $(ASRC) |
81 | eep: $(TARGET).eep $(ASRC) | |
82 | lst: $(TARGET).lst $(ASRC) | |
83 | map: $(TARGET).map $(ASRC) | |
3c3744f1 L |
84 | |
85 | ||
86 | # Program the device. | |
87 | program: $(TARGET).hex $(TARGET).eep | |
88 | $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) | |
89 | ||
90 | flash: $(TARGET).hex | |
91 | $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) | |
92 | ||
93 | eeprom: $(TARGET).hex $(TARGET).eep | |
94 | $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_EEPROM) | |
95 | ||
96 | ||
b2017655 FZ |
97 | $(TARGET).hex: $(ASRC) |
98 | $(TARGET).eep: $(ASRC) | |
99 | $(TARGET).lst: $(ASRC) | |
100 | $(TARGET).map: $(ASRC) | |
3c3744f1 | 101 | |
b2017655 FZ |
102 | #.SUFFIXES: .hex .eep .lst |
103 | .SUFFIXES: | |
3c3744f1 L |
104 | |
105 | %.hex: %.asm | |
106 | $(AS) $(ALL_ASFLAGS) -fI -o $@ $< | |
107 | ||
108 | %.lst: %.asm | |
109 | @$(AS) $(ALL_ASFLAGS) -v0 -f- -l $@ $< | |
110 | ||
111 | %.map: %.asm | |
112 | $(AS) $(ALL_ASFLAGS) -v0 -f- -m $@ $< | |
113 | ||
114 | tags: $(SRC) $(ASRC) | |
115 | ctags $(SRC) $(ASRC) | |
116 | ||
117 | ||
118 | ||
119 | # Target: clean project. | |
120 | clean: | |
121 | $(REMOVE) $(TARGET).hex $(TARGET).eep $(TARGET).obj $(TARGET).map $(TARGET).lst | |
122 |