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