From 56483bc3226bf3630ba5210ef6ed50477b0f42f7 Mon Sep 17 00:00:00 2001 From: "james.goppert" Date: Thu, 23 Jun 2011 21:36:20 +0000 Subject: [PATCH] Added debug/ upload targets to Arduino.mk git-svn-id: https://arducopter.googlecode.com/svn/trunk@2656 f9c3cf11-9bcb-44bc-f272-b75c42450872 --- libraries/AP_Common/Arduino.mk | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/libraries/AP_Common/Arduino.mk b/libraries/AP_Common/Arduino.mk index 497b68b22d..170e6ed287 100644 --- a/libraries/AP_Common/Arduino.mk +++ b/libraries/AP_Common/Arduino.mk @@ -78,7 +78,11 @@ BUILDROOT := $(abspath $(TMPDIR)/$(SKETCH).build) # # The Makefile calling us must specify BOARD # -include $(TMPDIR)/config.mk +include $(SKETCHBOOK)/config.mk +ifeq ($(PORT),) +$(error ERROR: could not locate $(SKETCHBOOK)/config.mk, please run 'make configure' first) +endif + HARDWARE ?= arduino ifeq ($(BOARD),) $(error ERROR: must set BOARD before including this file) @@ -276,6 +280,9 @@ endif MCU := $(shell grep $(BOARD).build.mcu $(BOARDFILE) | cut -d = -f 2) F_CPU := $(shell grep $(BOARD).build.f_cpu $(BOARDFILE) | cut -d = -f 2) HARDWARE_CORE := $(shell grep $(BOARD).build.core $(BOARDFILE) | cut -d = -f 2) +UPLOAD_SPEED := $(shell grep $(BOARD).upload.speed $(BOARDFILE) | cut -d = -f 2) +UPLOAD_PROTOCOL := $(shell grep $(BOARD).upload.protocol $(BOARDFILE) | cut -d = -f 2) + ifeq ($(MCU),) $(error ERROR: Could not locate board $(BOARD) in $(BOARDFILE)) endif @@ -324,6 +331,12 @@ ALLDEPS = $(ALLOBJS:%.o=%.d) all: $(SKETCHELF) $(SKETCHEEP) $(SKETCHHEX) upload: + avrdude -c $(UPLOAD_PROTOCOL) -p $(MCU) -P $(PORT) -b$(UPLOAD_SPEED) -U $(SKETCHHEX) + +debug: + avarice --mkII --capture --jtag usb :4242 & \ + gnome-terminal -x avr-gdb $(SKETCHELF) \ + echo -e '\n\nat the gdb prompt type "target remote localhost:4242"' clean: @rm -fr $(BUILDROOT)