]> cloudbase.mooo.com Git - avrcpm.git/blame - avr/Makefile
Tag for Version 3.2
[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
5c8bb361
L
5#For a description of of the following built options see 'config.inc'
6#Defining options here will override the defaults from the config file.
7
8#MCU = atmega88
ce520bff 9MCU = atmega328p
5c8bb361
L
10#F_CPU = 20000000
11#DRAM_8BIT = 0
623dd899 12#BAUD = 57600
5c8bb361 13#BAUD = 115200
ce520bff 14#I2C_SUPPORT = 0
e8384f88 15ADC_SUPPORT = 0
5c8bb361
L
16#EM_Z80 = 0
17#FAT16_SUPPORT = 0
ce520bff 18#CPMDSK_SUPPORT = 0
5c8bb361 19#MMCBOOTLOADER = 0
9c15f366 20
623dd899
L
21
22# Version defined in 'config.inc'.
23VMAJOR = $(call conf-val, VMAJOR, config.inc)
24VMINOR = $(call conf-val, VMINOR, config.inc)
25
623dd899 26
9c15f366 27TARGET = avrcpm
fa9059af 28ASRC0 = avrcpm.asm
b2017655 29
fa9059af
L
30ASRC0 += config.inc macros.inc init.asm dram-refresh.asm timer.asm utils.asm
31ASRC0 += mmc.asm mmc-old.asm virt_ports.asm
32ASRC0 += dsk_cpm.asm dsk_fat16.asm dsk_fsys.asm dsk_mgr.asm dsk_ram.asm
33ASRC0 += 8080int-orig.asm 8080int.asm 8080int-jmp.asm 8080int-t3.asm 8080int-t3-jmp.asm Z80int-jmp.asm
b2017655
FZ
34
35ifneq ($(DRAM_8BIT),0)
d8fa6a36 36 ASRC0 += dram-8bit.inc dram-8bit.asm sw-uart.asm i2c.asm
b2017655 37else
fa9059af 38 ASRC0 += dram-4bit.inc dram-4bit.asm hw-uart.asm
b2017655 39endif
3c3744f1 40
623dd899 41ASRC = $(ASRC0) svnrev.inc
fa9059af 42#ASRC := $(ASRC0) svnrev.inc
fa9059af 43
3c3744f1 44# Place -D or -U options here
5c8bb361 45CDEFS = -D$(MCU)
623dd899 46
5c8bb361
L
47ifdef F_CPU
48 CDEFS += -DF_CPU=$(F_CPU)
49endif
50ifdef DRAM_8BIT
51 CDEFS += -DDRAM_8BIT=$(DRAM_8BIT)
52endif
53ifdef BAUD
54 CDEFS += -DBAUD=$(BAUD)
55endif
825ecc9d
L
56ifdef I2C_SUPPORT
57 CDEFS += -DI2C_SUPPORT=$(I2C_SUPPORT)
58endif
59ifdef ADC_SUPPORT
60 CDEFS += -DADC_SUPPORT=$(ADC_SUPPORT)
d8fa6a36 61endif
5c8bb361
L
62ifdef EM_Z80
63 CDEFS += -DEM_Z80=$(EM_Z80)
64endif
623dd899
L
65ifdef FAT16_SUPPORT
66 CDEFS += -DFAT16_SUPPORT=$(FAT16_SUPPORT)
67endif
ce520bff
L
68ifdef CPMDSK_SUPPORT
69 CDEFS += -DCPMDSK_SUPPORT=$(CPMDSK_SUPPORT)
70endif
5c8bb361
L
71ifdef MMCBOOTLOADER
72 CDEFS += -DMMCBOOTLOADER=$(MMCBOOTLOADER)
623dd899 73endif
5c8bb361
L
74ifdef TESTVERSION
75 CDEFS += -DTESTVERSION=$(TESTVERSION)
623dd899
L
76endif
77
fa9059af
L
78ASPATH = C:/Programme/Atmel/AVR\ Tools/AvrAssembler2
79DEFS = $(ASPATH)/Appnotes
80
81ifeq "$(OS)" "Windows_NT"
82 PLATFORM=win32
83else
84 PLATFORM=Linux
85endif
3c3744f1 86
fa9059af
L
87WINE =
88ifeq ($(PLATFORM),Linux)
89 WINE = wine
90endif
91
92AS = $(WINE) $(ASPATH)/avrasm2.exe
3c3744f1
L
93ASFLAGS = -I $(DEFS) $(CDEFS)
94
623dd899
L
95AWK = gawk
96OBJCOPY = avr-objcopy
97CRCGEN = crcgen
98
99HEXTOBIN = $(OBJCOPY) -I ihex -O binary --gap-fill 0xff
100
101#(call conf-val,config-id,config-file)
102#conf-val = $(shell awk -vID=$(strip $1) '$$0 ~ "^[ \t]*\#define[ \t]+" ID "[ \t]+" {print $$3}' $2 )
103conf-val = $(shell awk -vID=$(strip $1) '$$1$$2 ~ "\#define"ID {print $$3}' $2)
104
105
3c3744f1
L
106# Programming support using avrdude. Settings and variables.
107
108AVRDUDE_PROGRAMMER = dragon_isp
109AVRDUDE_PORT = usb
110
111AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
112AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
113
114
115# Uncomment the following if you want avrdude's erase cycle counter.
116# Note that this counter needs to be initialized first using -Yn,
117# see avrdude manual.
118#AVRDUDE_ERASE_COUNTER = -y
119
120# Uncomment the following if you do /not/ wish a verification to be
121# performed after programming the device.
122#AVRDUDE_NO_VERIFY = -V
123
124# Increase verbosity level. Please use this when submitting bug
125# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
126# to submit bug reports.
127#AVRDUDE_VERBOSE = -v -v
128
129AVRDUDE_BASIC = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
130AVRDUDE_FLAGS = $(AVRDUDE_BASIC) $(AVRDUDE_NO_VERIFY) $(AVRDUDE_VERBOSE) $(AVRDUDE_ERASE_COUNTER)
131
132AVRDUDE = avrdude
133REMOVE = rm -f
134MV = mv -f
135
623dd899 136.PHONY: all bin hex eep lst map program flash eeprom tags clean
b2017655 137
3c3744f1
L
138# Default target.
139all: hex lst
140
623dd899
L
141hex: $(TARGET).hex
142eep: $(TARGET).eep
143lst: $(TARGET).lst
144map: $(TARGET).map
145bin: $(TARGET)-$(VMAJOR).$(VMINOR).bin
3c3744f1
L
146
147
148# Program the device.
149program: $(TARGET).hex $(TARGET).eep
150 $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
151
152flash: $(TARGET).hex
153 $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH)
154
155eeprom: $(TARGET).hex $(TARGET).eep
156 $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_EEPROM)
157
158
b2017655
FZ
159$(TARGET).hex: $(ASRC)
160$(TARGET).eep: $(ASRC)
161$(TARGET).lst: $(ASRC)
162$(TARGET).map: $(ASRC)
3c3744f1 163
623dd899 164
b2017655 165.SUFFIXES:
3c3744f1 166
623dd899
L
167%-$(VMAJOR).$(VMINOR).bin: %.hex
168 $(HEXTOBIN) $< $@
169 $(CRCGEN) $@
170
3c3744f1 171%.hex: %.asm
623dd899 172 $(AS) $(ASFLAGS) -fI -o $@ $<
3c3744f1
L
173
174%.lst: %.asm
623dd899 175 @$(AS) $(ASFLAGS) -v0 -f- -l $@ $<
3c3744f1
L
176
177%.map: %.asm
623dd899 178 $(AS) $(ASFLAGS) -v0 -f- -m $@ $<
3c3744f1
L
179
180tags: $(SRC) $(ASRC)
181 ctags $(SRC) $(ASRC)
182
fa9059af 183svnrev.inc: $(ASRC0)
623dd899
L
184 svnrev -osvnrev.inc $^
185 touch svnrev.inc
3c3744f1
L
186
187# Target: clean project.
188clean:
623dd899
L
189 $(REMOVE) $(TARGET).hex $(TARGET).eep $(TARGET).obj $(TARGET).map $(TARGET).lst \
190 $(TARGET)-$(VMAJOR).$(VMINOR).bin
3c3744f1 191