Makefile 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. # Makefile for ATmegaBOOT
  2. # E.Lins, 18.7.2005
  3. # $Id$
  4. # program name should not be changed...
  5. PROGRAM = ATmegaBOOT_1284P
  6. # enter the target CPU frequency
  7. AVR_FREQ = 16000000L
  8. MCU_TARGET = atmega1284p
  9. LDSECTION = --section-start=.text=0x1F800
  10. OBJ = $(PROGRAM).o
  11. OPTIMIZE = -Os
  12. DEFS = -DWATCHDOG_MODS -DBAUD_RATE=57600
  13. LIBS =
  14. CC = avr-gcc
  15. # Override is only needed by avr-lib build system.
  16. override CFLAGS = -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) -DF_CPU=$(AVR_FREQ) $(DEFS)
  17. override LDFLAGS = -Wl,$(LDSECTION)
  18. #override LDFLAGS = -Wl,-Map,$(PROGRAM).map,$(LDSECTION)
  19. OBJCOPY = avr-objcopy
  20. OBJDUMP = avr-objdump
  21. all: CFLAGS += '-DMAX_TIME_COUNT=16000000L>>1' -DADABOOT
  22. all: $(PROGRAM).hex
  23. $(PROGRAM).hex: $(PROGRAM).elf
  24. $(OBJCOPY) -j .text -j .data -O ihex $< $@
  25. $(PROGRAM).elf: $(OBJ)
  26. $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
  27. $(OBJ): ATmegaBOOT.c
  28. avr-gcc $(CFLAGS) $(LDFLAGS) -c -Wall -mmcu=$(MCU_TARGET) ATmegaBOOT.c -o $(PROGRAM).o
  29. %.lst: %.elf
  30. $(OBJDUMP) -h -S $< > $@
  31. %.srec: %.elf
  32. $(OBJCOPY) -j .text -j .data -O srec $< $@
  33. %.bin: %.elf
  34. $(OBJCOPY) -j .text -j .data -O binary $< $@
  35. clean:
  36. rm -rf *.o *.elf *.lst *.map *.sym *.lss *.eep *.srec *.bin *.hex