# AVR-ASM Makefile, derived from the WinAVR template (which # is public domain), believed to be neutral to any flavor of "make" # (GNU make, BSD make, SysV make) #MCU = atmega8 MCU = atmega328P #F_CPU = 24576000 F_CPU = 20000000 BAUD = 115200 DRAM_DQ_ORDER = 1 TARGET = z80 ASRC = z80.asm # Place -D or -U options here CDEFS = -DF_CPU=$(F_CPU) -DBAUD=$(BAUD) -D$(MCU) -DDRAM_DQ_ORDER=$(DRAM_DQ_ORDER) WINEPATH = C:/Programme/Atmel/AVR\ Tools/AvrAssembler2 DEFS = $(WINEPATH)/Appnotes AS = wine $(WINEPATH)/avrasm2.exe ASFLAGS = -I $(DEFS) $(CDEFS) # Programming support using avrdude. Settings and variables. AVRDUDE_PROGRAMMER = dragon_isp AVRDUDE_PORT = usb AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep # Uncomment the following if you want avrdude's erase cycle counter. # Note that this counter needs to be initialized first using -Yn, # see avrdude manual. #AVRDUDE_ERASE_COUNTER = -y # Uncomment the following if you do /not/ wish a verification to be # performed after programming the device. #AVRDUDE_NO_VERIFY = -V # Increase verbosity level. Please use this when submitting bug # reports about avrdude. See # to submit bug reports. #AVRDUDE_VERBOSE = -v -v AVRDUDE_BASIC = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) AVRDUDE_FLAGS = $(AVRDUDE_BASIC) $(AVRDUDE_NO_VERIFY) $(AVRDUDE_VERBOSE) $(AVRDUDE_ERASE_COUNTER) AVRDUDE = avrdude REMOVE = rm -f MV = mv -f # Define all listing files. LST = $(ASRC:.asm=.lst) # Combine all necessary flags and optional flags. # Add target processor to flags. ALL_ASFLAGS = $(ASFLAGS) # Default target. all: hex lst hex: $(TARGET).hex eep: $(TARGET).eep lst: $(TARGET).lst map: $(TARGET).map # Program the device. program: $(TARGET).hex $(TARGET).eep $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) flash: $(TARGET).hex $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) eeprom: $(TARGET).hex $(TARGET).eep $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_EEPROM) .SUFFIXES: .hex .eep .lst %.hex: %.asm $(AS) $(ALL_ASFLAGS) -fI -o $@ $< %.lst: %.asm @$(AS) $(ALL_ASFLAGS) -v0 -f- -l $@ $< %.map: %.asm $(AS) $(ALL_ASFLAGS) -v0 -f- -m $@ $< tags: $(SRC) $(ASRC) ctags $(SRC) $(ASRC) # Target: clean project. clean: $(REMOVE) $(TARGET).hex $(TARGET).eep $(TARGET).obj $(TARGET).map $(TARGET).lst .PHONY: all hex eep lst map program flash eeprom tags clean