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