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 2017/03/10 21:29:44 UTC

[1/5] incubator-mynewt-core git commit: Fix ctrl-c handling on Windows by launching separate cmd instances

Repository: incubator-mynewt-core
Updated Branches:
  refs/heads/develop 2b3d6ccf7 -> 631db7704


Fix ctrl-c handling on Windows by launching separate cmd instances


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/56444edf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/56444edf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/56444edf

Branch: refs/heads/develop
Commit: 56444edfae339e40330686aeb3ca9d8a641eea7f
Parents: 2b3d6cc
Author: Simon Ratner <si...@probablyprime.net>
Authored: Sat Mar 4 11:41:30 2017 -0800
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Fri Mar 10 13:10:05 2017 -0800

----------------------------------------------------------------------
 hw/scripts/jlink.sh   | 63 ++++++++++++++++++++++++++++------------------
 hw/scripts/openocd.sh | 32 ++++++++++++++++-------
 2 files changed, 61 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/56444edf/hw/scripts/jlink.sh
----------------------------------------------------------------------
diff --git a/hw/scripts/jlink.sh b/hw/scripts/jlink.sh
index e6a4dfe..2f3fbe8 100644
--- a/hw/scripts/jlink.sh
+++ b/hw/scripts/jlink.sh
@@ -105,37 +105,50 @@ jlink_load () {
 #
 jlink_debug() {
     if [ -z "$NO_GDB" ]; then
-	GDB_CMD_FILE=.gdb_cmds
+        GDB_CMD_FILE=.gdb_cmds
 
-	if [ -z $FILE_NAME ]; then
+        if [ -z $FILE_NAME ]; then
             echo "Missing filename"
             exit 1
-	fi
-	if [ ! -f "$FILE_NAME" ]; then
+        fi
+        if [ ! -f "$FILE_NAME" ]; then
             echo "Cannot find file" $FILE_NAME
             exit 1
-	fi
-
-	echo "Debugging" $FILE_NAME
-
-	# Monitor mode. Background process gets it's own process group.
-	set -m
-	$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
-	# Whether target should be reset or not
-	if [ ! -z "$RESET" ]; then
-	    echo "mon reset" >> $GDB_CMD_FILE
-	    echo "si" >> $GDB_CMD_FILE
-	fi
-	echo "$EXTRA_GDB_CMDS" >> $GDB_CMD_FILE
-
-	arm-none-eabi-gdb -x $GDB_CMD_FILE $FILE_NAME
-
-	rm $GDB_CMD_FILE
+        fi
+
+        echo "Debugging" $FILE_NAME
+
+        if [ -x "$COMSPEC" ]; then
+            #
+            # Launch jlink server in a separate command interpreter, to make
+            # sure it doesn't get killed by Ctrl-C signal from bash.
+            #
+            $COMSPEC /C "start $COMSPEC /C $JLINK_GDB_SERVER -device $JLINK_DEV -speed 4000 -if SWD -port 3333 -singlerun"
+        else
+            #
+            # Block Ctrl-C from getting passed to jlink server.
+            #
+            set -m
+            $JLINK_GDB_SERVER -device $JLINK_DEV -speed 4000 -if SWD -port 3333 -singlerun > /dev/null &
+            set +m
+        fi
+
+        echo "target remote localhost:3333" > $GDB_CMD_FILE
+        # Whether target should be reset or not
+        if [ ! -z "$RESET" ]; then
+            echo "mon reset" >> $GDB_CMD_FILE
+            echo "si" >> $GDB_CMD_FILE
+        fi
+        echo "$EXTRA_GDB_CMDS" >> $GDB_CMD_FILE
+
+        if [ -x "$COMSPEC" ]; then
+            $COMSPEC /C "start $COMSPEC /C arm-none-eabi-gdb -x $GDB_CMD_FILE $FILE_NAME"
+        else
+            arm-none-eabi-gdb -x $GDB_CMD_FILE $FILE_NAME
+            rm $GDB_CMD_FILE
+        fi
     else
-	$JLINK_GDB_SERVER -device $JLINK_DEV -speed 4000 -if SWD -port 3333 -singlerun
+        $JLINK_GDB_SERVER -device $JLINK_DEV -speed 4000 -if SWD -port 3333 -singlerun
     fi
     return 0
 }

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/56444edf/hw/scripts/openocd.sh
----------------------------------------------------------------------
diff --git a/hw/scripts/openocd.sh b/hw/scripts/openocd.sh
index 7c6c012..e838bcd 100644
--- a/hw/scripts/openocd.sh
+++ b/hw/scripts/openocd.sh
@@ -76,12 +76,20 @@ openocd_debug () {
             exit 1
         fi
 
-        #
-        # Block Ctrl-C from getting passed to openocd.
-        #
-        set -m
-        openocd $CFG -f $OCD_CMD_FILE -c init -c halt &
-        set +m
+        if [ -x "$COMSPEC" ]; then
+            #
+            # Launch openocd in a separate command interpreter, to make sure
+            # it doesn't get killed by Ctrl-C signal from bash.
+            #
+            $COMSPEC /C "start $COMSPEC /C openocd $CFG -f $OCD_CMD_FILE -c init -c halt"
+        else
+            #
+            # Block Ctrl-C from getting passed to openocd.
+            #
+            set -m
+            openocd $CFG -f $OCD_CMD_FILE -c init -c halt &
+            set +m
+        fi
 
         GDB_CMD_FILE=.gdb_cmds
 
@@ -89,15 +97,21 @@ openocd_debug () {
         if [ ! -z "$RESET" ]; then
             echo "mon reset halt" >> $GDB_CMD_FILE
         fi
-        arm-none-eabi-gdb -x $GDB_CMD_FILE $FILE_NAME
-        rm $GDB_CMD_FILE
+        if [ -x "$COMSPEC" ]; then
+            $COMSPEC /C "start $COMSPEC /C arm-none-eabi-gdb -x $GDB_CMD_FILE $FILE_NAME"
+        else
+            arm-none-eabi-gdb -x $GDB_CMD_FILE $FILE_NAME
+            rm $GDB_CMD_FILE
+        fi
     else
         # No GDB, wait for openocd to exit
         openocd $CFG -f $OCD_CMD_FILE -c init -c halt
         return $?
     fi
 
-    rm $OCD_CMD_FILE
+    if [ ! -x "$COMSPEC" ]; then
+        rm $OCD_CMD_FILE
+    fi
     return 0
 }
 


[4/5] incubator-mynewt-core git commit: Re-add double cmd.exe invocation.

Posted by ma...@apache.org.
Re-add double cmd.exe invocation.


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/f6951e68
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/f6951e68
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/f6951e68

Branch: refs/heads/develop
Commit: f6951e6889d631e112d18514b891d98e42fca8ff
Parents: 9cd69a3
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Sat Mar 4 20:44:03 2017 -0800
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Fri Mar 10 13:10:54 2017 -0800

----------------------------------------------------------------------
 hw/scripts/jlink.sh   | 13 ++++++++++---
 hw/scripts/openocd.sh | 12 ++++++++----
 2 files changed, 18 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f6951e68/hw/scripts/jlink.sh
----------------------------------------------------------------------
diff --git a/hw/scripts/jlink.sh b/hw/scripts/jlink.sh
index 7b35017..5087ceb 100644
--- a/hw/scripts/jlink.sh
+++ b/hw/scripts/jlink.sh
@@ -17,6 +17,8 @@
 
 . $CORE_PATH/hw/scripts/common.sh
 
+JLINK_GDB_SERVER=JLinkGDBServer
+
 #
 # FILE_NAME is the file to load
 # FLASH_OFFSET is location in the flash
@@ -123,7 +125,7 @@ jlink_debug() {
             # Launch jlink server in a separate command interpreter, to make
             # sure it doesn't get killed by Ctrl-C signal from bash.
             #
-            $COMSPEC "/C start $JLINK_GDB_SERVER -device $JLINK_DEV -speed 4000 -if SWD -port 3333 -singlerun"
+            $COMSPEC "/C start $COMSPEC /C $JLINK_GDB_SERVER -device $JLINK_DEV -speed 4000 -if SWD -port 3333 -singlerun"
         else
             #
             # Block Ctrl-C from getting passed to jlink server.
@@ -141,8 +143,13 @@ jlink_debug() {
         fi
         echo "$EXTRA_GDB_CMDS" >> $GDB_CMD_FILE
 
-        arm-none-eabi-gdb -x $GDB_CMD_FILE $FILE_NAME
-        rm $GDB_CMD_FILE
+	if [ $WINDOWS -eq 1 ]; then
+	    FILE_NAME=`echo $FILE_NAME | sed 's/\//\\\\/g'`
+	    $COMSPEC "/C start $COMSPEC /C arm-none-eabi-gdb -x $GDB_CMD_FILE $FILE_NAME"
+	else
+            arm-none-eabi-gdb -x $GDB_CMD_FILE $FILE_NAME
+            rm $GDB_CMD_FILE
+	fi
     else
         $JLINK_GDB_SERVER -device $JLINK_DEV -speed 4000 -if SWD -port 3333 -singlerun
     fi

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f6951e68/hw/scripts/openocd.sh
----------------------------------------------------------------------
diff --git a/hw/scripts/openocd.sh b/hw/scripts/openocd.sh
index a20e451..12e5e32 100644
--- a/hw/scripts/openocd.sh
+++ b/hw/scripts/openocd.sh
@@ -84,8 +84,7 @@ openocd_debug () {
             # it doesn't get killed by Ctrl-C signal from bash.
             #
             CFG=`echo $CFG | sed 's/\//\\\\/g'`
-            echo $CFG
-            $COMSPEC "/C start openocd openocd $CFG -f $OCD_CMD_FILE -c init -c halt"
+            $COMSPEC "/C start $COMSPEC /C openocd -l openocd.log $CFG -f $OCD_CMD_FILE -c init -c halt"
         else
             #
             # Block Ctrl-C from getting passed to openocd.
@@ -101,8 +100,13 @@ openocd_debug () {
         if [ ! -z "$RESET" ]; then
             echo "mon reset halt" >> $GDB_CMD_FILE
         fi
-        arm-none-eabi-gdb -x $GDB_CMD_FILE $FILE_NAME
-        rm $GDB_CMD_FILE
+	if [ $WINDOWS -eq 1 ]; then
+	    FILE_NAME=`echo $FILE_NAME | sed 's/\//\\\\/g'`
+            $COMSPEC "/C start $COMSPEC /C arm-none-eabi-gdb -x $GDB_CMD_FILE $FILE_NAME"
+	else
+            arm-none-eabi-gdb -x $GDB_CMD_FILE $FILE_NAME
+            rm $GDB_CMD_FILE
+	fi
     else
         # No GDB, wait for openocd to exit
         openocd $CFG -f $OCD_CMD_FILE -c init -c halt


[5/5] incubator-mynewt-core git commit: This closes #203.

Posted by ma...@apache.org.
This closes #203.

Merge branch 'fix-ctrl-c-win2' of https://github.com/mkiiskila/incubator-mynewt-core into develop


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/631db770
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/631db770
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/631db770

Branch: refs/heads/develop
Commit: 631db770443b9f208ca37712e8f040c01c439fba
Parents: 2b3d6cc f6951e6
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Fri Mar 10 13:28:54 2017 -0800
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Fri Mar 10 13:28:54 2017 -0800

----------------------------------------------------------------------
 hw/scripts/common.sh  | 14 ++++++++
 hw/scripts/jlink.sh   | 80 +++++++++++++++++++++++++++-------------------
 hw/scripts/openocd.sh | 36 +++++++++++++++------
 3 files changed, 89 insertions(+), 41 deletions(-)
----------------------------------------------------------------------



[3/5] incubator-mynewt-core git commit: Use $OS to determine whether running on windows or not.

Posted by ma...@apache.org.
Use $OS to determine whether running on windows or not.


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/9cd69a34
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/9cd69a34
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/9cd69a34

Branch: refs/heads/develop
Commit: 9cd69a34301772260c4db02e7afc3b0844247348
Parents: 567a360
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Sat Mar 4 20:42:45 2017 -0800
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Fri Mar 10 13:10:54 2017 -0800

----------------------------------------------------------------------
 hw/scripts/common.sh | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/9cd69a34/hw/scripts/common.sh
----------------------------------------------------------------------
diff --git a/hw/scripts/common.sh b/hw/scripts/common.sh
index ee85a90..2563b29 100644
--- a/hw/scripts/common.sh
+++ b/hw/scripts/common.sh
@@ -34,9 +34,8 @@ common_file_to_load () {
 # Also check if $COMSPEC is set or not.
 #
 windows_detect() {
-    BUILD_OS=`uname`
     WINDOWS=0
-    if [ $BUILD_OS = "Windows_NT" ]; then
+    if [ $OS = "Windows_NT" ]; then
 	WINDOWS=1
     fi
     if [ $WINDOWS -eq 1 -a -z "$COMSPEC" ]; then


[2/5] incubator-mynewt-core git commit: scripts; pathnames need to be converted when calling cmd.exe. CMDSPEC not set when using win-bash.

Posted by ma...@apache.org.
scripts; pathnames need to be converted when calling cmd.exe.
CMDSPEC not set when using win-bash.


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/567a360f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/567a360f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/567a360f

Branch: refs/heads/develop
Commit: 567a360fe0c4eb8f0d5d1c15585b6805e3559c27
Parents: 56444ed
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Sat Mar 4 19:07:48 2017 -0800
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Fri Mar 10 13:10:53 2017 -0800

----------------------------------------------------------------------
 hw/scripts/common.sh  | 15 +++++++++++++++
 hw/scripts/jlink.sh   | 30 +++++++++++++-----------------
 hw/scripts/openocd.sh | 16 ++++++++--------
 3 files changed, 36 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/567a360f/hw/scripts/common.sh
----------------------------------------------------------------------
diff --git a/hw/scripts/common.sh b/hw/scripts/common.sh
index 06b6f2b..ee85a90 100644
--- a/hw/scripts/common.sh
+++ b/hw/scripts/common.sh
@@ -28,3 +28,18 @@ common_file_to_load () {
         FILE_NAME=$BIN_BASENAME.img
     fi
 }
+
+#
+# Check if this is executing in Windows. If so, set variable WINDOWS to 1.
+# Also check if $COMSPEC is set or not.
+#
+windows_detect() {
+    BUILD_OS=`uname`
+    WINDOWS=0
+    if [ $BUILD_OS = "Windows_NT" ]; then
+	WINDOWS=1
+    fi
+    if [ $WINDOWS -eq 1 -a -z "$COMSPEC" ]; then
+	COMSPEC=cmd.exe
+    fi
+}

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/567a360f/hw/scripts/jlink.sh
----------------------------------------------------------------------
diff --git a/hw/scripts/jlink.sh b/hw/scripts/jlink.sh
index 2f3fbe8..7b35017 100644
--- a/hw/scripts/jlink.sh
+++ b/hw/scripts/jlink.sh
@@ -17,15 +17,6 @@
 
 . $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
@@ -35,6 +26,10 @@ jlink_load () {
     GDB_CMD_FILE=.gdb_cmds
     GDB_OUT_FILE=.gdb_out
 
+    windows_detect
+    if [ $WINDOWS -eq 1 ]; then
+	JLINK_GDB_SERVER=JLinkGDBServerCL
+    fi
     if [ -z $FILE_NAME ]; then
         echo "Missing filename"
         exit 1
@@ -104,6 +99,11 @@ jlink_load () {
 # RESET is set if we should reset the target at attach time
 #
 jlink_debug() {
+    windows_detect
+    if [ $WINDOWS -eq 1 ]; then
+	JLINK_GDB_SERVER=JLinkGDBServerCL
+    fi
+
     if [ -z "$NO_GDB" ]; then
         GDB_CMD_FILE=.gdb_cmds
 
@@ -118,12 +118,12 @@ jlink_debug() {
 
         echo "Debugging" $FILE_NAME
 
-        if [ -x "$COMSPEC" ]; then
+        if [ $WINDOWS -eq 1 ]; then
             #
             # Launch jlink server in a separate command interpreter, to make
             # sure it doesn't get killed by Ctrl-C signal from bash.
             #
-            $COMSPEC /C "start $COMSPEC /C $JLINK_GDB_SERVER -device $JLINK_DEV -speed 4000 -if SWD -port 3333 -singlerun"
+            $COMSPEC "/C start $JLINK_GDB_SERVER -device $JLINK_DEV -speed 4000 -if SWD -port 3333 -singlerun"
         else
             #
             # Block Ctrl-C from getting passed to jlink server.
@@ -141,12 +141,8 @@ jlink_debug() {
         fi
         echo "$EXTRA_GDB_CMDS" >> $GDB_CMD_FILE
 
-        if [ -x "$COMSPEC" ]; then
-            $COMSPEC /C "start $COMSPEC /C arm-none-eabi-gdb -x $GDB_CMD_FILE $FILE_NAME"
-        else
-            arm-none-eabi-gdb -x $GDB_CMD_FILE $FILE_NAME
-            rm $GDB_CMD_FILE
-        fi
+        arm-none-eabi-gdb -x $GDB_CMD_FILE $FILE_NAME
+        rm $GDB_CMD_FILE
     else
         $JLINK_GDB_SERVER -device $JLINK_DEV -speed 4000 -if SWD -port 3333 -singlerun
     fi

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/567a360f/hw/scripts/openocd.sh
----------------------------------------------------------------------
diff --git a/hw/scripts/openocd.sh b/hw/scripts/openocd.sh
index e838bcd..a20e451 100644
--- a/hw/scripts/openocd.sh
+++ b/hw/scripts/openocd.sh
@@ -62,6 +62,8 @@ openocd_load () {
 openocd_debug () {
     OCD_CMD_FILE=.openocd_cmds
 
+    windows_detect
+
     echo "gdb_port 3333" > $OCD_CMD_FILE
     echo "telnet_port 4444" >> $OCD_CMD_FILE
     echo "$EXTRA_JTAG_CMD" >> $OCD_CMD_FILE
@@ -76,12 +78,14 @@ openocd_debug () {
             exit 1
         fi
 
-        if [ -x "$COMSPEC" ]; then
+        if [ $WINDOWS -eq 1 ]; then
             #
             # Launch openocd in a separate command interpreter, to make sure
             # it doesn't get killed by Ctrl-C signal from bash.
             #
-            $COMSPEC /C "start $COMSPEC /C openocd $CFG -f $OCD_CMD_FILE -c init -c halt"
+            CFG=`echo $CFG | sed 's/\//\\\\/g'`
+            echo $CFG
+            $COMSPEC "/C start openocd openocd $CFG -f $OCD_CMD_FILE -c init -c halt"
         else
             #
             # Block Ctrl-C from getting passed to openocd.
@@ -97,12 +101,8 @@ openocd_debug () {
         if [ ! -z "$RESET" ]; then
             echo "mon reset halt" >> $GDB_CMD_FILE
         fi
-        if [ -x "$COMSPEC" ]; then
-            $COMSPEC /C "start $COMSPEC /C arm-none-eabi-gdb -x $GDB_CMD_FILE $FILE_NAME"
-        else
-            arm-none-eabi-gdb -x $GDB_CMD_FILE $FILE_NAME
-            rm $GDB_CMD_FILE
-        fi
+        arm-none-eabi-gdb -x $GDB_CMD_FILE $FILE_NAME
+        rm $GDB_CMD_FILE
     else
         # No GDB, wait for openocd to exit
         openocd $CFG -f $OCD_CMD_FILE -c init -c halt