Added debug/ upload targets to Arduino.mk

git-svn-id: https://arducopter.googlecode.com/svn/trunk@2656 f9c3cf11-9bcb-44bc-f272-b75c42450872
This commit is contained in:
james.goppert 2011-06-23 21:36:20 +00:00
parent f2457c94d9
commit 6959c2d6f9

View File

@ -78,7 +78,11 @@ BUILDROOT := $(abspath $(TMPDIR)/$(SKETCH).build)
# #
# The Makefile calling us must specify BOARD # 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 HARDWARE ?= arduino
ifeq ($(BOARD),) ifeq ($(BOARD),)
$(error ERROR: must set BOARD before including this file) $(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) MCU := $(shell grep $(BOARD).build.mcu $(BOARDFILE) | cut -d = -f 2)
F_CPU := $(shell grep $(BOARD).build.f_cpu $(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) 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),) ifeq ($(MCU),)
$(error ERROR: Could not locate board $(BOARD) in $(BOARDFILE)) $(error ERROR: Could not locate board $(BOARD) in $(BOARDFILE))
endif endif
@ -324,6 +331,12 @@ ALLDEPS = $(ALLOBJS:%.o=%.d)
all: $(SKETCHELF) $(SKETCHEEP) $(SKETCHHEX) all: $(SKETCHELF) $(SKETCHEEP) $(SKETCHHEX)
upload: 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: clean:
@rm -fr $(BUILDROOT) @rm -fr $(BUILDROOT)