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)
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.
24 ASRC0
+= config.inc macros.inc init.asm dram-refresh.asm timer.asm utils.asm
25 ASRC0
+= mmc.asm mmc-old.asm virt_ports.asm
26 ASRC0
+= dsk_cpm.asm dsk_fat16.asm dsk_fsys.asm dsk_mgr.asm dsk_ram.asm
27 ASRC0
+= 8080int-orig.asm
8080int.asm
8080int-jmp.asm
8080int-t3.asm
8080int-t3-jmp.asm Z80int-jmp.asm
29 EXTRA_DIST
:= autorevision.cache
31 PREFIX
= $(PROG
)_
$(VERSION
)
32 DIST_NAME
= $(PREFIX
).zip
34 $(foreach X
,$(subst =,:=,$(subst ",,$(filter VCS_%,\
35 $(shell autorevision -q -t sh -o ./autorevision.cache)))),$(eval $X))
37 VERSION := $(shell echo "$(VCS_TAG
)" | sed -e 's/^v//g')
38 VMAJOR := $(shell echo "$(VCS_TAG
)" | sed -E 's/([^0-9]*)([0-9]+)([.])([0-9]+)([^0-9]*)/\2/')
39 VMINOR := $(shell echo "$(VCS_TAG
)" | sed -E 's/([^0-9]*)([0-9]+)([.])([0-9]+)([^0-9]*)/\4/')
43 VERSION := $(VERSION)-$(VCS_TICK)
45 ifneq ($(VCS_BRANCH),master)
46 VERSION := $(VERSION)-$(VCS_BRANCH)
48 ifeq ($(VCS_WC_MODIFIED),1)
49 VERSION := $(VERSION)-dirty
52 ifneq ($(DRAM_8BIT),0)
53 ASRC0 += dram-8bit.inc dram-8bit.asm sw-uart.asm i2c.asm
55 ASRC0 += dram-4bit.inc dram-4bit.asm hw-uart.asm
60 # Place -D or -U options here
61 CDEFS = -D$(MCU) -DVERSION=\"$(VERSION)\" -DVMAJOR=$(VMAJOR) -DVMINOR=$(VMINOR)
63 CDEFS += -DF_CPU=$(F_CPU)
66 CDEFS += -DDRAM_8BIT=$(DRAM_8BIT)
69 CDEFS += -DBAUD=$(BAUD)
72 CDEFS += -DI2C_SUPPORT=$(I2C_SUPPORT)
75 CDEFS += -DEM_Z80=$(EM_Z80)
78 CDEFS += -DFAT16_SUPPORT=$(FAT16_SUPPORT)
81 CDEFS += -DCPMDSK_SUPPORT=$(CPMDSK_SUPPORT)
84 CDEFS += -DMMCBOOTLOADER=$(MMCBOOTLOADER)
87 CDEFS += -DTESTVERSION=$(TESTVERSION)
90 ASPATH := C:/Programme/Atmel/AVR\ Tools/AvrAssembler2
91 DEFS := $(ASPATH)/Appnotes
93 ifeq "$(OS
)" "Windows_NT
"
100 ifeq ($(PLATFORM),Linux)
104 AS = $(WINE) $(ASPATH)/avrasm2.exe
105 ASFLAGS = -I $(DEFS) $(CDEFS)
107 OBJCOPY = avr-objcopy
110 HEXTOBIN = $(OBJCOPY) -I ihex -O binary --gap-fill 0xff
112 # Programming support using avrdude. Settings and variables.
114 AVRDUDE_PROGRAMMER = dragon_isp
117 AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
118 AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
120 # Uncomment the following if you want avrdude's erase cycle counter.
121 # Note that this counter needs to be initialized first using -Yn,
122 # see avrdude manual.
123 #AVRDUDE_ERASE_COUNTER = -y
125 # Uncomment the following if you do /not/ wish a verification to be
126 # performed after programming the device.
127 #AVRDUDE_NO_VERIFY = -V
129 # Increase verbosity level. Please use this when submitting bug
130 # reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
131 # to submit bug reports.
132 #AVRDUDE_VERBOSE = -v -v
134 AVRDUDE_BASIC = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
135 AVRDUDE_FLAGS = $(AVRDUDE_BASIC) $(AVRDUDE_NO_VERIFY) $(AVRDUDE_VERBOSE) $(AVRDUDE_ERASE_COUNTER)
141 .PHONY: all bin hex eep lst map program flash eeprom tags clean
150 bin: $(TARGET)-$(VMAJOR).$(VMINOR).bin
153 # Program the device.
154 program: $(TARGET).hex $(TARGET).eep
155 $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
158 $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH)
160 eeprom: $(TARGET).hex $(TARGET).eep
161 $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_EEPROM)
164 $(TARGET).hex: $(ASRC)
165 $(TARGET).eep: $(ASRC)
166 $(TARGET).lst: $(ASRC)
167 $(TARGET).map: $(ASRC)
172 %-$(VMAJOR).$(VMINOR).bin: %.hex
177 $(AS) $(ASFLAGS) -fI -o $@ $<
180 @$(AS) $(ASFLAGS) -v0 -f- -l $@ $<
183 $(AS) $(ASFLAGS) -v0 -f- -m $@ $<
188 # Target: clean project.
190 $(REMOVE) $(TARGET).hex $(TARGET).eep $(TARGET).obj $(TARGET).map $(TARGET).lst \
191 $(TARGET)-$(VMAJOR).$(VMINOR).bin