Makefile 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. PRG = SZM2
  2. OBJ = main.o 1wire.o gtext.o sed1335.o ds18b20.o display.o i2c.o dac8571.o ads1224.o
  3. MCU_TARGET = atmega644p
  4. OPTIMIZE = -Os
  5. # -mcall-prologues
  6. DEFS = -DF_CPU=8000000
  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 -funsigned-char
  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. %.eep: %.elf
  40. $(OBJCOPY) --change-section-lma .eeprom=0 -j .eeprom -O ihex $< $@
  41. %.srec: %.elf
  42. $(OBJCOPY) -j .text -j .data -O srec $< $@
  43. %.bin: %.elf
  44. $(OBJCOPY) -j .text -j .data -O binary $< $@
  45. # Every thing below here is used by avr-libc's build system and can be ignored
  46. # by the casual user.
  47. FIG2DEV = fig2dev
  48. EXTRA_CLEAN_FILES = *.hex *.bin *.srec *.s *.i *~
  49. dox: eps png pdf
  50. eps: $(PRG).eps
  51. png: $(PRG).png
  52. pdf: $(PRG).pdf
  53. %.eps: %.fig
  54. $(FIG2DEV) -L eps $< $@
  55. %.pdf: %.fig
  56. $(FIG2DEV) -L pdf $< $@
  57. %.png: %.fig
  58. $(FIG2DEV) -L png $< $@
  59. program: install
  60. install: all
  61. $(AVRDUDE) -U flash:w:$(PRG).hex
  62. reset:
  63. $(AVRDUDE)
  64. fuses:
  65. $(AVRDUDE) -U lfuse:w:0xff:m -U hfuse:w:0x11:m -U efuse:w:0xfd:m -B100
  66. eeprom: $(PRG).eep
  67. $(AVRDUDE) -U eeprom:w:$(PRG).eep -B100