Makefile 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. PRG = term
  2. OBJ = main.o led.o 1wire.o
  3. MCU_TARGET = attiny13
  4. OPTIMIZE = -Os
  5. # -mcall-prologues
  6. DEFS = -DF_CPU=9600000
  7. LIBS =
  8. ASMFLAGS =
  9. AVRDUDE = avrdude -c usbasp -p $(MCU_TARGET)
  10. # You should not have to change anything below here.
  11. CC = avr-gcc
  12. # Override is only needed by avr-lib build system.
  13. override CFLAGS = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) $(DEFS) -I/usr/avr/include -ffreestanding -fshort-enums -funsigned-bitfields -nostartfiles
  14. #-save-temps
  15. override LDFLAGS = -Wl,-Map,$(PRG).map
  16. OBJCOPY = avr-objcopy
  17. OBJDUMP = avr-objdump
  18. all: $(PRG).elf lst text #asm
  19. avr-size $(PRG).elf
  20. avr-size $(PRG).hex
  21. $(PRG).elf: $(OBJ)
  22. $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
  23. #asm: usbdrvasm.S
  24. # $(CC) $(INCLUDES) $(CFLAGS) $(DEFS) $(ASMFLAGS) -c $<
  25. clean:
  26. rm -rf *.o $(PRG).elf *.eps *.png *.pdf *.bak
  27. rm -rf *.lst *.map $(EXTRA_CLEAN_FILES)
  28. lst: $(PRG).lst
  29. %.lst: %.elf
  30. $(OBJDUMP) -d $< > $@
  31. # Rules for building the .text rom images
  32. text: hex
  33. #bin srec
  34. hex: $(PRG).hex
  35. bin: $(PRG).bin
  36. srec: $(PRG).srec
  37. %.hex: %.elf
  38. $(OBJCOPY) -j .text -j .data -O ihex $< $@
  39. %.srec: %.elf
  40. $(OBJCOPY) -j .text -j .data -O srec $< $@
  41. %.bin: %.elf
  42. $(OBJCOPY) -j .text -j .data -O binary $< $@
  43. # Every thing below here is used by avr-libc's build system and can be ignored
  44. # by the casual user.
  45. FIG2DEV = fig2dev
  46. EXTRA_CLEAN_FILES = *.hex *.bin *.srec *.s *.i *~
  47. dox: eps png pdf
  48. eps: $(PRG).eps
  49. png: $(PRG).png
  50. pdf: $(PRG).pdf
  51. %.eps: %.fig
  52. $(FIG2DEV) -L eps $< $@
  53. %.pdf: %.fig
  54. $(FIG2DEV) -L pdf $< $@
  55. %.png: %.fig
  56. $(FIG2DEV) -L png $< $@
  57. program: install
  58. install: all
  59. $(AVRDUDE) -U flash:w:$(PRG).hex
  60. reset:
  61. $(AVRDUDE)
  62. fuses:
  63. $(AVRDUDE) -U lfuse:w:0x7a:m -B100