]> cloudbase.mooo.com Git - avrcpm.git/blame - avr/Makefile
* cpm/Makefile
[avrcpm.git] / avr / Makefile
CommitLineData
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
6MCU = atmega328P
ebf7dfab 7F_CPU = 20000000
2f6fa691
L
8#BAUD = 19200
9BAUD = 57600
10#BAUD = 115200
3c3744f1 11
9c15f366
L
12DRAM_8BIT = 1
13
14TARGET = avrcpm
b2017655
FZ
15ASRC = avrcpm.asm
16
17ASRC += config.inc macros.inc init.asm dram-refresh.asm timer.asm utils.asm
18ASRC += mmc.asm mmc-old.asm virt_ports.asm
19ASRC += dsk_cpm.asm dsk_fat16.asm dsk_fsys.asm dsk_mgr.asm dsk_ram.asm
20ASRC += 8080int.asm 8080int-jmp.asm 8080int-t3.asm 8080int-t3-jmp.asm
21
22ifneq ($(DRAM_8BIT),0)
23 ASRC += dram-8bit.inc dram-8bit.asm sw-uart.asm
24else
25 ASRC += dram-4bit.inc dram-4bit.asm hw-uart.asm
26endif
3c3744f1
L
27
28# Place -D or -U options here
9c15f366 29CDEFS = -DF_CPU=$(F_CPU) -DBAUD=$(BAUD) -D$(MCU) -DDRAM_8BIT=$(DRAM_8BIT)
3c3744f1
L
30
31WINEPATH = C:/Programme/Atmel/AVR\ Tools/AvrAssembler2
32DEFS = $(WINEPATH)/Appnotes
33
34AS = wine $(WINEPATH)/avrasm2.exe
35ASFLAGS = -I $(DEFS) $(CDEFS)
36
37# Programming support using avrdude. Settings and variables.
38
39AVRDUDE_PROGRAMMER = dragon_isp
40AVRDUDE_PORT = usb
41
42AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
43AVRDUDE_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
60AVRDUDE_BASIC = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
61AVRDUDE_FLAGS = $(AVRDUDE_BASIC) $(AVRDUDE_NO_VERIFY) $(AVRDUDE_VERBOSE) $(AVRDUDE_ERASE_COUNTER)
62
63AVRDUDE = avrdude
64REMOVE = rm -f
65MV = 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.
73ALL_ASFLAGS = $(ASFLAGS)
74
b2017655
FZ
75.PHONY: all hex eep lst map program flash eeprom tags clean
76
3c3744f1
L
77# Default target.
78all: hex lst
79
b2017655
FZ
80hex: $(TARGET).hex $(ASRC)
81eep: $(TARGET).eep $(ASRC)
82lst: $(TARGET).lst $(ASRC)
83map: $(TARGET).map $(ASRC)
3c3744f1
L
84
85
86# Program the device.
87program: $(TARGET).hex $(TARGET).eep
88 $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
89
90flash: $(TARGET).hex
91 $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH)
92
93eeprom: $(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
114tags: $(SRC) $(ASRC)
115 ctags $(SRC) $(ASRC)
116
117
118
119# Target: clean project.
120clean:
121 $(REMOVE) $(TARGET).hex $(TARGET).eep $(TARGET).obj $(TARGET).map $(TARGET).lst
122