nuclear@0: src = $(wildcard *.c)
nuclear@0: obj = $(src:.c=.o)
nuclear@5: bin = test_simm30_dram
nuclear@0: hex = $(bin).hex
nuclear@0: eep = $(bin).eep
nuclear@0: 
nuclear@0: mcu_gcc = atmega644p
nuclear@0: mcu_dude = m644p
nuclear@0: 
nuclear@0: CC = avr-gcc
nuclear@0: OBJCOPY = avr-objcopy
nuclear@0: 
nuclear@0: CFLAGS = -Os -pedantic -Wall -mmcu=$(mcu_gcc) -DXTAL=14745600
nuclear@0: LDFLAGS = -Wl,-Map,$(bin).map -mmcu=$(mcu_gcc) -lprintf_min
nuclear@0: 
nuclear@0: .PHONY: all
nuclear@0: all: $(hex) $(eep)
nuclear@0: 
nuclear@0: $(bin): $(obj)
nuclear@0: 	$(CC) -o $@ $(obj) $(LDFLAGS)
nuclear@0: 
nuclear@0: $(hex): $(bin)
nuclear@0: 	$(OBJCOPY) -j .text -j .data -O ihex -R .eeprom $< $@
nuclear@0: 
nuclear@0: $(eep): $(bin)
nuclear@0: 	$(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O ihex $< $@
nuclear@0: 
nuclear@0: .PHONY: fuses
nuclear@0: fuses:
nuclear@0: 	avrdude -c usbtiny -p $(mcu_dude) -U lfuse:w:0xf7:m -U hfuse:w:0x99:m -U efuse:w:0xff:m
nuclear@0: 
nuclear@0: .PHONY: program
nuclear@0: program: $(hex)
nuclear@0: 	avrdude -c usbtiny -p $(mcu_dude) -e -U flash:w:$(hex)
nuclear@0: 
nuclear@0: .PHONY: clean
nuclear@0: clean:
nuclear@0: 	rm -f $(bin) $(obj) $(hex) $(eep) $(bin).map