3 SRC=version.c main.c logging.c serial.c
9 AVRDUDE_PROGRAMMER=usbasp
11 CFLAGS=-Wall -Os -mmcu=$(MCU) -DUSE_LOGGING=1 -DF_CPU=8000000UL -std=gnu99
13 AVRDUDE_FLAGS= -p$(AVRDUDE_MCU) -c $(AVRDUDE_PROGRAMMER)
22 all: $(PROGRAM).hex $(PROGRAM).eep
24 program: $(PROGRAM).hex $(PROGRAM).eep
25 $(AVRDUDE) $(AVRDUDE_FLAGS) -U flash:w:$(PROGRAM).hex:i -U eeprom:w:$(PROGRAM).eep:i
27 program_flash: $(PROGRAM).hex
28 $(AVRDUDE) $(AVRDUDE_FLAGS) -U flash:w:$(PROGRAM).hex:i
30 program_eeprom: $(PROGRAM).eep
31 $(AVRDUDE) $(AVRDUDE_FLAGS) eeprom:w:$(PROGRAM).eep:i
34 $(AVRDUDE) $(AVRDUDE_FLAGS) -U eeprom:r:eeprom.raw:r
37 objdump: $(PROGRAM).elf
38 $(OBJDUMP) --disassemble $<
40 .PRECIOUS : $(OBJ) $(PROGRAM).elf
43 $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
46 $(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
47 --change-section-lma .eeprom=0 -O $(FORMAT) $< $@
50 $(CC) $(CFLAGS) $(OBJ) -o $@ $(LDFLAGS)
52 %.o: %.c rgbstring.h Makefile
53 $(CC) -c $(CFLAGS) $< -o $@
55 %.s: %.c rgbstring.h Makefile
56 $(CC) -S -c $(CFLAGS) $< -o $@
59 $(CC) -c $(CFLAGS) $< -o $@
62 rm -f $(PROGRAM).hex $(PROGRAM).eep $(PROGRAM).elf *.o *.s eeprom.raw
65 ./version.pl > version.c
67 .PHONY: all clean dump_eeprom program program_flash program_eeprom objdump version.c