You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

56 lines
1.2 KiB

  1. PRG = powermeter
  2. OBJ = main.o
  3. MCU_TARGET = attiny26
  4. OPTIMIZE = -Os
  5. AVRDUDE_PROG = -c avr910 -b 115200 -P /dev/ttyUSB0
  6. #AVRDUDE_PROG = -c dragon_isp -P usb
  7. AVRDUDE_MCU = attiny26
  8. DEFS =
  9. LIBS =
  10. # Override is only needed by avr-lib build system.
  11. override CFLAGS = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) $(DEFS)
  12. override LDFLAGS = -Wl,-Map,$(PRG).map
  13. CC = avr-gcc
  14. OBJCOPY = avr-objcopy
  15. OBJDUMP = avr-objdump
  16. SIZE = avr-size
  17. all: $(PRG).elf lst text
  18. $(SIZE) -x -A $(PRG).elf
  19. $(PRG).elf: $(OBJ)
  20. $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
  21. %.o: %.c $(MAKEFILE_LIST)
  22. $(CC) $(CFLAGS) -c $< -o $@
  23. clean:
  24. rm -rf *.o $(PRG).lst $(PRG).map $(PRG).elf $(PRG).hex $(PRG).bin
  25. lst: $(PRG).lst
  26. %.lst: %.elf
  27. $(OBJDUMP) -h -S $< > $@
  28. text: hex bin
  29. hex: $(PRG).hex
  30. bin: $(PRG).bin
  31. %.hex: %.elf
  32. $(OBJCOPY) -j .text -j .data -O ihex $< $@
  33. %.bin: %.elf
  34. $(OBJCOPY) -j .text -j .data -O binary $< $@
  35. install: text
  36. avrdude $(AVRDUDE_PROG) -p $(AVRDUDE_MCU) -V -U flash:w:$(PRG).hex
  37. fuses:
  38. avrdude $(AVRDUDE_PROG) -p $(AVRDUDE_MCU) -U hfuse:w:0x14:m
  39. avrdude $(AVRDUDE_PROG) -p $(AVRDUDE_MCU) -U lfuse:w:0xe4:m