You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ma...@apache.org on 2016/12/29 18:59:30 UTC

[3/4] incubator-mynewt-core git commit: Check for JLinkGDBServerCL or JLinkGDBServer in path

Check for JLinkGDBServerCL or JLinkGDBServer in path


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/e4f71de1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/e4f71de1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/e4f71de1

Branch: refs/heads/develop
Commit: e4f71de16ef2504855874e174f54c6698d568d47
Parents: e2d3f66
Author: Simon Ratner <si...@probablyprime.net>
Authored: Thu Dec 29 10:15:21 2016 -0800
Committer: Simon Ratner <si...@probablyprime.net>
Committed: Thu Dec 29 10:27:46 2016 -0800

----------------------------------------------------------------------
 hw/scripts/jlink.sh | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/e4f71de1/hw/scripts/jlink.sh
----------------------------------------------------------------------
diff --git a/hw/scripts/jlink.sh b/hw/scripts/jlink.sh
index 0318d74..07e3fee 100644
--- a/hw/scripts/jlink.sh
+++ b/hw/scripts/jlink.sh
@@ -17,6 +17,15 @@
 
 . $CORE_PATH/hw/scripts/common.sh
 
+if which JLinkGDBServerCL >/dev/null 2>&1; then
+  JLINK_GDB_SERVER=JLinkGDBServerCL
+elif which JLinkGDBServer >/dev/null 2>&1; then
+  JLINK_GDB_SERVER=JLinkGDBServer
+else
+  echo "Cannot find JLinkGDBServer, make sure J-Link tools are in your PATH"
+  exit 1
+fi
+
 #
 # FILE_NAME is the file to load
 # FLASH_OFFSET is location in the flash
@@ -45,7 +54,7 @@ jlink_load () {
     # downloading somewhere in the flash. So need to figure out how to tell it
     # not to do that, or report failure if gdb fails to write this file
     #
-    echo "shell sh -c \"trap '' 2; JLinkGDBServer -device $JLINK_DEV -speed 4000 -if SWD -port 3333 -singlerun &\" " > $GDB_CMD_FILE
+    echo "shell sh -c \"trap '' 2; $JLINK_GDB_SERVER -device $JLINK_DEV -speed 4000 -if SWD -port 3333 -singlerun &\" " > $GDB_CMD_FILE
     echo "target remote localhost:3333" >> $GDB_CMD_FILE
     echo "mon reset" >> $GDB_CMD_FILE
     echo "restore $FILE_NAME binary $FLASH_OFFSET" >> $GDB_CMD_FILE
@@ -109,7 +118,7 @@ jlink_debug() {
 
 	# Monitor mode. Background process gets it's own process group.
 	set -m
-	JLinkGDBServer -device $JLINK_DEV -speed 4000 -if SWD -port 3333 -singlerun > /dev/null &
+	$JLINK_GDB_SERVER -device $JLINK_DEV -speed 4000 -if SWD -port 3333 -singlerun > /dev/null &
 	set +m
 
 	echo "target remote localhost:3333" > $GDB_CMD_FILE