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/11/03 21:17:33 UTC

[4/5] incubator-mynewt-core git commit: MYNEWT-418; construct start script in openocd_debug().

MYNEWT-418; construct start script in openocd_debug().


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

Branch: refs/heads/develop
Commit: 5e734a361ecd25a224072c4959e52898beedf867
Parents: 513bab2
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Thu Nov 3 14:03:41 2016 -0700
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Thu Nov 3 14:03:41 2016 -0700

----------------------------------------------------------------------
 hw/scripts/openocd.sh | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5e734a36/hw/scripts/openocd.sh
----------------------------------------------------------------------
diff --git a/hw/scripts/openocd.sh b/hw/scripts/openocd.sh
index 792ac07..4d6fc2e 100644
--- a/hw/scripts/openocd.sh
+++ b/hw/scripts/openocd.sh
@@ -15,6 +15,7 @@
 # specific language governing permissions and limitations
 # under the License.
 #
+. $CORE_PATH/hw/scripts/common.sh
 
 #
 # FILE_NAME must contain the name of the file to load
@@ -33,6 +34,9 @@ openocd_load () {
 	echo "Missing flash offset"
 	return 1
     fi
+    if [ ! -z "$EXTRA_JTAG_CMD" ]; then
+	CFG="$CFG -c $EXTRA_JTAG_CMD"
+    fi
 
     echo "Downloading" $FILE_NAME "to" $FLASH_OFFSET
 
@@ -40,7 +44,17 @@ openocd_load () {
     return $?
 }
 
+#
+# NO_GDB should be set if gdb should not be started
+# FILE_NAME should point to elf-file being debugged
+#
 openocd_debug () {
+    OCD_CMD_FILE=.openocd_cmds
+
+    echo "gdb_port 3333" > $OCD_CMD_FILE
+    echo "telnet_port 4444" >> $OCD_CMD_FILE
+    echo "$EXTRA_JTAG_CMD" >> $OCD_CMD_FILE
+
     if [ -z "$NO_GDB" ]; then
 	if [ -z $FILE_NAME ]; then
 	    echo "Missing filename"
@@ -55,7 +69,7 @@ openocd_debug () {
 	# Block Ctrl-C from getting passed to openocd.
 	#
 	set -m
-	openocd $CFG -c init -c halt &
+	openocd $CFG -f $OCD_CMD_FILE -c init -c halt &
 	set +m
 
     	GDB_CMD_FILE=.gdb_cmds
@@ -68,9 +82,11 @@ openocd_debug () {
 	rm $GDB_CMD_FILE
     else
 	# No GDB, wait for openocd to exit
-	openocd $CFG -c init -c halt
+	openocd $CFG -f $OCD_CMD_FILE -c init -c halt
     fi
 
+
+    rm $OCD_CMD_FILE
     return 0
 }