Makefile 968 B

12345678910111213141516171819202122232425262728293031323334
  1. ###################################################################
  2. # Makefile for arduino_dualboot hack
  3. # visit http://blog.vinu.co.in for more details
  4. ###################################################################
  5. PROJECT=arduino_dualboot
  6. SOURCES=main.c i2c.c uart.c
  7. CC=avr-gcc
  8. OBJCOPY=avr-objcopy
  9. MMCU=atmega328p
  10. LD_FLAGS = -Wl,--section-start=.text=0x7800
  11. C_FLAGS = -mmcu=$(MMCU) -Os -Wall -std=c99
  12. PROGRAMMER=arduino
  13. BURN=../AVRDUDESS/avrdude.exe
  14. MCU=m328p
  15. COM=COM16
  16. $(PROJECT).hex: $(PROJECT).out
  17. $(OBJCOPY) -j .text -j .data -O ihex $(PROJECT).out $(PROJECT).hex
  18. $(PROJECT).out: $(SOURCES)
  19. $(CC) $(C_FLAGS) $(LD_FLAGS) -I./ -o $(PROJECT).out $(SOURCES)
  20. avr-size $(PROJECT).out
  21. p: $(PROJECT).hex
  22. $(BURN) -c $(PROGRAMMER) -p $(MCU) -U flash:w:$(PROJECT).hex -b 19200 -P $(COM)
  23. f:
  24. $(BURN) -c $(PROGRAMMER) -p $(MCU) -U lfuse:w:0xef:m -U hfuse:w:0xda:m -U efuse:w:0xfd:m -b 19200 -P $(COM)
  25. clean:
  26. rm arduino_dualboot.hex arduino_dualboot.out