10 AVRDUDE_PROGRAMMER=usbasp
12 CFLAGS=-Os -mmcu=$(MCU)
14 AVRDUDE_FLAGS= -p$(AVRDUDE_MCU) -c $(AVRDUDE_PROGRAMMER)
23 all: $(PROGRAM).hex $(PROGRAM).eep
25 program: $(PROGRAM).hex $(PROGRAM).eep
26 $(AVRDUDE) $(AVRDUDE_FLAGS) -U flash:w:$(PROGRAM).hex:i -U eeprom:w:$(PROGRAM).eep:i
28 program_flash: $(PROGRAM).hex
29 $(AVRDUDE) $(AVRDUDE_FLAGS) -U flash:w:$(PROGRAM).hex:i
31 program_eeprom: $(PROGRAM).eep
32 $(AVRDUDE) $(AVRDUDE_FLAGS) eeprom:w:$(PROGRAM).eep:i
35 $(AVRDUDE) $(AVRDUDE_FLAGS) -U eeprom:r:eeprom.raw:r
38 objdump: $(PROGRAM).elf
39 $(OBJDUMP) --disassemble $<
42 .PRECIOUS : $(OBJ) $(PROGRAM).elf
45 $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
48 $(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
49 --change-section-lma .eeprom=0 -O $(FORMAT) $< $@
52 $(CC) $(CFLAGS) $(OBJ) -o $@ $(LDFLAGS)
55 $(CC) -c $(CFLAGS) $< -o $@
58 $(CC) -S -c $(CFLAGS) $< -o $@
61 $(CC) -c $(CFLAGS) $< -o $@
64 rm -f $(PROGRAM).hex $(PROGRAM).eep $(PROGRAM).elf *.o *.s eeprom.raw
66 .PHONY: all clean dump_eeprom program program_flash program_eeprom objdump