mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
dist/tools/mspdebug: build from source
This adds mspdebug as package, similar to EDBG, so that the programmer/debugger is build from source. This has the advantage that we can indeed provide patches of our own. The first patch fixes a bug with the CPU detection of `mspdebug` in combination with the Olimex MSP430-JTAG-TINY-V2. The second adds the `--expect-id <CPU_NAME>` argument. The RIOT integration is updated to directly make use of the `--expect-id` parameter. No more spending time debugging why firmware the firmware for the `olimex-msp430-h2618` doesn't run when flashed on the `olimex-msp430h1611` hardware :D
This commit is contained in:
parent
6deca8b87c
commit
aafc099a1c
1
dist/tools/mspdebug/.gitignore
vendored
Normal file
1
dist/tools/mspdebug/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/mspdebug
|
25
dist/tools/mspdebug/Makefile
vendored
Normal file
25
dist/tools/mspdebug/Makefile
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
PKG_NAME := mspdebug
|
||||
PKG_URL := https://github.com/dlbeer/mspdebug
|
||||
PKG_VERSION := 985b390ba22f4229aeca9f02e273a54eb4a76a9a
|
||||
PKG_LICENSE := GPL-2.0-only
|
||||
|
||||
# manually set some RIOT env vars, so this Makefile can be called stand-alone
|
||||
RIOTBASE ?= $(CURDIR)/../../..
|
||||
RIOTTOOLS ?= $(CURDIR)/..
|
||||
|
||||
PKG_SOURCE_DIR = $(CURDIR)/bin
|
||||
PKG_BUILD_OUT_OF_SOURCE = 0
|
||||
|
||||
include $(RIOTBASE)/pkg/pkg.mk
|
||||
|
||||
all: $(CURDIR)/mspdebug
|
||||
|
||||
$(CURDIR)/mspdebug:
|
||||
# Start mspdebug build in a clean environment, so variables set by RIOT's build process
|
||||
# for cross compiling a specific target platform are reset and mspdebug can
|
||||
# be built cleanly for the native platform.
|
||||
env -i PATH="$(PATH)" TERM="$(TERM)" "$(MAKE)" -C "$(PKG_BUILD_DIR)"
|
||||
mv $(PKG_BUILD_DIR)/mspdebug .
|
||||
|
||||
clean::
|
||||
rm -f $(CURDIR)/mspdebug
|
10
dist/tools/mspdebug/debug.sh
vendored
10
dist/tools/mspdebug/debug.sh
vendored
@ -5,10 +5,11 @@ MSPDEBUG_PROGRAMMER="$2"
|
||||
PROTOCOL="$3"
|
||||
MSPDEBUG_TTY="$4"
|
||||
DEBUG_ADAPTER_ID="$5"
|
||||
GDBPORT="$6"
|
||||
ELFFILE="$7"
|
||||
PREFIX="$8"
|
||||
RIOTBASE="$9"
|
||||
DEBUG_TARGET_ID="$6"
|
||||
GDBPORT="$7"
|
||||
ELFFILE="$8"
|
||||
PREFIX="$9"
|
||||
RIOTBASE="$10"
|
||||
|
||||
# The setsid command is needed so that Ctrl+C in GDB doesn't kill mspdebug
|
||||
: "${SETSID:=setsid}"
|
||||
@ -28,6 +29,7 @@ fi
|
||||
|
||||
sleep 2
|
||||
args=()
|
||||
args+=("--expect-id" "$DEBUG_TARGET_ID")
|
||||
if [ "JTAG" = "${PROTOCOL}" ]; then
|
||||
args+=("-j")
|
||||
elif [ "Spy-Bi-Wire" != "${PROTOCOL}" ]; then
|
||||
|
4
dist/tools/mspdebug/debug_srv.sh
vendored
4
dist/tools/mspdebug/debug_srv.sh
vendored
@ -5,13 +5,15 @@ MSPDEBUG_PROGRAMMER="$2"
|
||||
PROTOCOL="$3"
|
||||
MSPDEBUG_TTY="$4"
|
||||
DEBUG_ADAPTER_ID="$5"
|
||||
GDBPORT="$6"
|
||||
DEBUG_TARGET_ID="$6"
|
||||
GDBPORT="$7"
|
||||
|
||||
if [ -z "${MSPDEBUG_PROGRAMMER}" ]; then
|
||||
echo "MSPDEBUG_PROGRAMMER unset, cannot use mspdebug"
|
||||
fi
|
||||
|
||||
args=()
|
||||
args+=("--expect-id" "$DEBUG_TARGET_ID")
|
||||
if [ "JTAG" = "${PROTOCOL}" ]; then
|
||||
args+=("-j")
|
||||
else
|
||||
|
BIN
dist/tools/mspdebug/patches/6f507ddcd8a4db4b56bb4750ed837e505cb71abf.patch
vendored
Normal file
BIN
dist/tools/mspdebug/patches/6f507ddcd8a4db4b56bb4750ed837e505cb71abf.patch
vendored
Normal file
Binary file not shown.
BIN
dist/tools/mspdebug/patches/98a9522fd41402309a3c9f1fcff1b655c72dd795.patch
vendored
Normal file
BIN
dist/tools/mspdebug/patches/98a9522fd41402309a3c9f1fcff1b655c72dd795.patch
vendored
Normal file
Binary file not shown.
@ -1,12 +1,16 @@
|
||||
FLASHER ?= mspdebug
|
||||
FLASHFILE ?= $(HEXFILE)
|
||||
MSPDEBUG_PROGRAMMER ?= olimex
|
||||
MSPDEBUG ?= $(RIOTTOOLS)/mspdebug/mspdebug
|
||||
FLASHER ?= $(MSPDEBUG)
|
||||
FLASHDEPS += $(MSPDEBUG)
|
||||
|
||||
DEBUGSERVER_PORT ?= 2000
|
||||
DEBUGGER := $(RIOTTOOLS)/mspdebug/debug.sh
|
||||
MSPDEBUG_PROTOCOL ?= JTAG
|
||||
MSPDEBUG_TTY ?=
|
||||
|
||||
DEBUG_TARGET := $(call uppercase_and_underscore,$(CPU_MODEL))
|
||||
|
||||
ifeq (JTAG,$(strip $(MSPDEBUG_PROTOCOL)))
|
||||
FFLAGS += -j
|
||||
endif
|
||||
@ -16,12 +20,13 @@ endif
|
||||
ifneq (,$(strip $(DEBUG_ADAPTER_ID)))
|
||||
FFLAGS += -s "$(DEBUG_ADAPTER_ID)"
|
||||
endif
|
||||
FFLAGS += --expect-id "$(DEBUG_TARGET)"
|
||||
FFLAGS += $(MSPDEBUG_PROGRAMMER) "prog $(FLASHFILE)"
|
||||
|
||||
DEBUGGER_FLAGS = $(FLASHER) $(MSPDEBUG_PROGRAMMER) $(MSPDEBUG_PROTOCOL) "$(MSPDEBUG_TTY)" "$(DEBUG_ADAPTER_ID)" $(DEBUGSERVER_PORT) $(ELFFILE) $(PREFIX) $(RIOTBASE)
|
||||
DEBUGGER_FLAGS = $(MSPDEBUG) $(MSPDEBUG_PROGRAMMER) $(MSPDEBUG_PROTOCOL) "$(MSPDEBUG_TTY)" "$(DEBUG_ADAPTER_ID)" "$(DEBUG_TARGET)" $(DEBUGSERVER_PORT) $(ELFFILE) $(PREFIX) $(RIOTBASE)
|
||||
DEBUGSERVER := $(RIOTTOOLS)/mspdebug/debug_srv.sh
|
||||
DEBUGSERVER_FLAGS = $(FLASHER) $(MSPDEBUG_PROGRAMMER) $(MSPDEBUG_PROTOCOL) "$(MSPDEBUG_TTY)" "$(DEBUG_ADAPTER_ID)" $(DEBUGSERVER_PORT)
|
||||
DEBUGSERVER_FLAGS = $(MSPDEBUG) $(MSPDEBUG_PROGRAMMER) $(MSPDEBUG_PROTOCOL) "$(MSPDEBUG_TTY)" "$(DEBUG_ADAPTER_ID)" "$(DEBUG_TARGET)" $(DEBUGSERVER_PORT)
|
||||
|
||||
# setup reset tool
|
||||
RESET ?= mspdebug
|
||||
RESET ?= $(MSPDEBUG)
|
||||
RESET_FLAGS ?= -j $(MSPDEBUG_PROGRAMMER) reset
|
||||
|
@ -32,6 +32,12 @@ $(RIOTTOOLS)/edbg/edbg: $(RIOTTOOLS)/edbg/Makefile
|
||||
CC= CFLAGS= $(MAKE) -C $(RIOTTOOLS)/edbg
|
||||
@echo "[INFO] edbg binary successfully built!"
|
||||
|
||||
$(RIOTTOOLS)/mspdebug/mspdebug: $(RIOTTOOLS)/mspdebug/Makefile
|
||||
@echo "[INFO] mspdebug binary not found - building it from source now"
|
||||
@echo "[INFO] mspdebug requires readline and libusb-compat headers to build"
|
||||
CC= CFLAGS= $(MAKE) -C $(RIOTTOOLS)/mspdebug
|
||||
@echo "[INFO] mspdebug binary successfully built!"
|
||||
|
||||
$(RIOTTOOLS)/mosquitto_rsmb/mosquitto_rsmb:
|
||||
@echo "[INFO] rsmb binary not found - building it from source now"
|
||||
@$(MAKE) -C $(RIOTTOOLS)/mosquitto_rsmb
|
||||
|
Loading…
Reference in New Issue
Block a user