From f33487d6bc53aa3ae641df66bc807b36a2ba8441 Mon Sep 17 00:00:00 2001
From: "Michael D. M. Dryden" <mdryden@chem.utoronto.ca>
Date: Tue, 10 Feb 2015 23:34:07 -0500
Subject: [PATCH] Added avrdude flashing to makefile.

---
 DSTAT-temp/Makefile  | 12 ++++++++++++
 DSTAT-temp/config.mk |  4 ++++
 2 files changed, 16 insertions(+)

diff --git a/DSTAT-temp/Makefile b/DSTAT-temp/Makefile
index bd0371d..080fd91 100644
--- a/DSTAT-temp/Makefile
+++ b/DSTAT-temp/Makefile
@@ -481,3 +481,15 @@ cleandoc:
 # Rebuild the Doxygen generated documentation.
 .PHONY: rebuilddoc
 rebuilddoc: cleandoc doc
+
+# Program to µC
+.PHONY: program
+program: all flash
+
+# Flash µC - flash and disables JTAG
+AVRDUDE_FLAGS = -p x256a3u -c $(AVRDUDE_PROG) -P $(AVRDUDE_PORT) -U flash:w:dstat-firmware.hex:i -U fuse4:w:0xff:m
+
+flash: $(TARGET).hex
+	avrdude $(AVRDUDE_FLAGS)
+
+
diff --git a/DSTAT-temp/config.mk b/DSTAT-temp/config.mk
index df9f608..a0f9b72 100644
--- a/DSTAT-temp/config.mk
+++ b/DSTAT-temp/config.mk
@@ -43,6 +43,10 @@ BUILD_DIR =
 MCU = atxmega256a3u
 F_CPU = 20000000
 
+# Programming settings
+AVRDUDE_PROG = avrispmkII
+AVRDUDE_PORT = usb
+
 # Application target name. Given with suffix .a for library and .elf for a
 # standalone application.
 TARGET = dstat-firmware.elf
-- 
GitLab