]> cloudbase.mooo.com Git - avrcpm.git/blame - avr/Makefile
* I2C: Don't get stuck, if pullups are missing (timeout error)
[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 12DRAM_8BIT = 1
d8fa6a36 13#I2C = 1
9c15f366
L
14
15TARGET = avrcpm
fa9059af 16ASRC0 = avrcpm.asm
b2017655 17
fa9059af
L
18ASRC0 += config.inc macros.inc init.asm dram-refresh.asm timer.asm utils.asm
19ASRC0 += mmc.asm mmc-old.asm virt_ports.asm
20ASRC0 += dsk_cpm.asm dsk_fat16.asm dsk_fsys.asm dsk_mgr.asm dsk_ram.asm
21ASRC0 += 8080int-orig.asm 8080int.asm 8080int-jmp.asm 8080int-t3.asm 8080int-t3-jmp.asm Z80int-jmp.asm
b2017655
FZ
22
23ifneq ($(DRAM_8BIT),0)
d8fa6a36 24 ASRC0 += dram-8bit.inc dram-8bit.asm sw-uart.asm i2c.asm
b2017655 25else
fa9059af 26 ASRC0 += dram-4bit.inc dram-4bit.asm hw-uart.asm
b2017655 27endif
3c3744f1 28
fa9059af
L
29#ASRC := $(ASRC0) svnrev.inc
30ASRC := $(ASRC0) svnrev.inc
31
3c3744f1 32# Place -D or -U options here
d8fa6a36
L
33CDEFS = -DF_CPU=$(F_CPU) -DBAUD=$(BAUD) -D$(MCU) -DDRAM_8BIT=$(DRAM_8BIT)
34ifdef I2C
35 CDEFS += -DI2C=$(I2C)
36endif
3c3744f1 37
fa9059af
L
38ASPATH = C:/Programme/Atmel/AVR\ Tools/AvrAssembler2
39DEFS = $(ASPATH)/Appnotes
40
41ifeq "$(OS)" "Windows_NT"
42 PLATFORM=win32
43else
44 PLATFORM=Linux
45endif
3c3744f1 46
fa9059af
L
47WINE =
48ifeq ($(PLATFORM),Linux)
49 WINE = wine
50endif
51
52AS = $(WINE) $(ASPATH)/avrasm2.exe
3c3744f1
L
53ASFLAGS = -I $(DEFS) $(CDEFS)
54
55# Programming support using avrdude. Settings and variables.
56
57AVRDUDE_PROGRAMMER = dragon_isp
58AVRDUDE_PORT = usb
59
60AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
61AVRDUDE_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
78AVRDUDE_BASIC = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
79AVRDUDE_FLAGS = $(AVRDUDE_BASIC) $(AVRDUDE_NO_VERIFY) $(AVRDUDE_VERBOSE) $(AVRDUDE_ERASE_COUNTER)
80
81AVRDUDE = avrdude
82REMOVE = rm -f
83MV = mv -f
84
85
86# Define all listing files.
b2017655 87#LST = $(ASRC:.asm=.lst)
3c3744f1
L
88
89# Combine all necessary flags and optional flags.
90# Add target processor to flags.
91ALL_ASFLAGS = $(ASFLAGS)
92
b2017655
FZ
93.PHONY: all hex eep lst map program flash eeprom tags clean
94
3c3744f1
L
95# Default target.
96all: hex lst
97
b2017655
FZ
98hex: $(TARGET).hex $(ASRC)
99eep: $(TARGET).eep $(ASRC)
100lst: $(TARGET).lst $(ASRC)
101map: $(TARGET).map $(ASRC)
3c3744f1
L
102
103
104# Program the device.
105program: $(TARGET).hex $(TARGET).eep
106 $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
107
108flash: $(TARGET).hex
109 $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH)
110
111eeprom: $(TARGET).hex $(TARGET).eep
112 $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_EEPROM)
113
114
b2017655
FZ
115$(TARGET).hex: $(ASRC)
116$(TARGET).eep: $(ASRC)
117$(TARGET).lst: $(ASRC)
118$(TARGET).map: $(ASRC)
3c3744f1 119
b2017655
FZ
120#.SUFFIXES: .hex .eep .lst
121.SUFFIXES:
3c3744f1
L
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
132tags: $(SRC) $(ASRC)
133 ctags $(SRC) $(ASRC)
134
fa9059af 135svnrev.inc: $(ASRC0)
2217c855 136 @svnrev -osvnrev.inc $^
3c3744f1
L
137
138# Target: clean project.
139clean:
140 $(REMOVE) $(TARGET).hex $(TARGET).eep $(TARGET).obj $(TARGET).map $(TARGET).lst
141