Skip to content

Commit 17fe3f4

Browse files
author
Hinnerk van Bruinehsen
committed
boards:mega2560: add debug and debug-server targets
1 parent 1c150ce commit 17fe3f4

File tree

4 files changed

+31
-3
lines changed

4 files changed

+31
-3
lines changed

boards/arduino-mega2560/Makefile.include

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,28 @@ else
2828
endif
2929
export FLASHER
3030
export PORT
31+
export DIST_PATH = $(RIOTBOARD)/$(BOARD)/dist
32+
export DEBUGSERVER_PORT = 4242
33+
export DEBUGSERVER = $(DIST_PATH)/debug_srv.sh
34+
export DEBUGSERVER_FLAGS = "-g -j usb :$(DEBUGSERVER_PORT)"
35+
export DEBUGGER_FLAGS = "-x $(RIOTBOARD)/$(BOARD)/dist/gdb.conf $(ELFFILE)"
36+
export DEBUGGER = $(DIST_PATH)/debug.sh $(DEBUGSERVER_FLAGS) $(DIST_PATH) $(DEBUGSERVER_PORT)
37+
38+
# PROGRAMMER defaults to stk500v2 which is the internal flasher via USB. Can be
39+
# overridden for debugging (which requires changes that require to use an ISP)
40+
export PROGRAMMER ?= stk500v2
41+
42+
ifeq ($(PROGRAMMER), stk500v2)
43+
export PROGRAMMER_FLAGS = -P $(PORT) -b 115200
44+
endif
3145

3246
# define build specific options
3347
export CPU_USAGE = -mmcu=atmega2560
3448
export CFLAGS += -ggdb -g3 -std=gnu99 -Os -Wall -Wstrict-prototypes $(CPU_USAGE)
3549
export ASFLAGS += -ggdb -g3 $(CPU_USAGE) $(FPU_USAGE)
3650
export LINKFLAGS += -g3 -ggdb -std=gnu99 $(CPU_USAGE) $(FPU_USAGE) -static -lgcc -e reset_handler
37-
# linkerscript specified in cpu/Makefile.include
38-
#export LINKFLAGS += -T$(LINKERSCRIPT)
3951
export OFLAGS += -j .text -j .data -O ihex
40-
export FFLAGS += -p m2560 -c stk500v2 -P $(PORT) -b 115200 -F -U flash:w:bin/$(BOARD)/$(PROJECT)$(APPLICATION).hex
52+
export FFLAGS += -p m2560 -c $(PROGRAMMER) $(PROGRAMMER_FLAGS) -F -U flash:w:bin/$(BOARD)/$(PROJECT)$(APPLICATION).hex
4153

4254
# export board specific includes to the global includes-listing
4355
export INCLUDES += -I$(RIOTBOARD)/$(BOARD)/include
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
sleep 2
3+
setsid -w avarice $1 &
4+
#sleep 2 && $2/avr-gdb-wrapper -ex "target remote localhost:$3" $4
5+
sleep 3 && avr-gdb -ex "target remote localhost:$3" $4
6+
7+
# avarice exits with 1 if the connection is released, therefore we always exit with 0
8+
exit 0
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
sleep 2
4+
avarice $1
5+
6+
# avarice exits with 1 if the connection is released, therefore we always exit with 0
7+
exit 0
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
set $pc=0x00

0 commit comments

Comments
 (0)