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/06/08 19:15:08 UTC

[1/2] incubator-mynewt-core git commit: config; use define instead of hardcoded value for max variable name.

Repository: incubator-mynewt-core
Updated Branches:
  refs/heads/develop 7bd06f431 -> c35d48d84


config; use define instead of hardcoded value for max variable name.


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

Branch: refs/heads/develop
Commit: 1b77365ac17db5a48cc2d0b738587c4b8b4717a9
Parents: 7bd06f4
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Tue Jun 7 12:21:26 2016 -0700
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Tue Jun 7 12:21:26 2016 -0700

----------------------------------------------------------------------
 sys/config/src/config_file.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/1b77365a/sys/config/src/config_file.c
----------------------------------------------------------------------
diff --git a/sys/config/src/config_file.c b/sys/config/src/config_file.c
index 402038c..046c5ac 100644
--- a/sys/config/src/config_file.c
+++ b/sys/config/src/config_file.c
@@ -222,8 +222,8 @@ static int
 conf_file_save_end(struct conf_store *cs)
 {
     struct conf_file *cf = (struct conf_file *)cs;
-    char name1[64];
-    char name2[64];
+    char name1[CONF_FILE_NAME_MAX];
+    char name2[CONF_FILE_NAME_MAX];
     int rc;
 
     fs_close(cf->cf_save_fp);


[2/2] incubator-mynewt-core git commit: arduino primo; allow use of either openocd or JLink to download/debug target.

Posted by ma...@apache.org.
arduino primo; allow use of either openocd or JLink to download/debug target.

Set 'openocd_debug' in target features to use openocd.


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

Branch: refs/heads/develop
Commit: c35d48d844dc42acd68cffcb9fd8b1d5e04d64bc
Parents: 1b77365
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Wed Jun 8 11:45:51 2016 -0700
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Wed Jun 8 11:45:51 2016 -0700

----------------------------------------------------------------------
 hw/bsp/arduino_primo_nrf52/primo_debug.sh    | 35 ++++++++++++----
 hw/bsp/arduino_primo_nrf52/primo_download.sh | 50 ++++++++++++++++++++---
 2 files changed, 71 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c35d48d8/hw/bsp/arduino_primo_nrf52/primo_debug.sh
----------------------------------------------------------------------
diff --git a/hw/bsp/arduino_primo_nrf52/primo_debug.sh b/hw/bsp/arduino_primo_nrf52/primo_debug.sh
index 5bb4bc0..53b715e 100755
--- a/hw/bsp/arduino_primo_nrf52/primo_debug.sh
+++ b/hw/bsp/arduino_primo_nrf52/primo_debug.sh
@@ -25,23 +25,42 @@
 # 
 #
 if [ $# -lt 1 ]; then
-    echo "Need binary to download"
+    echo "Need binary to debug"
     exit 1
 fi
 
+USE_OPENOCD=0
 MY_PATH=$1
 FILE_NAME=$2.elf
 GDB_CMD_FILE=.gdb_cmds
 
 echo "Debugging" $FILE_NAME
 
-#
-# Block Ctrl-C from getting passed to openocd.
-# Exit openocd when gdb detaches.
-#
-set -m
-openocd -s $MY_PATH -f arduino_primo.cfg -c "gdb_port 3333; telnet_port 4444; nrf52.cpu configure -event gdb-detach {shutdown}" -c init -c "reset halt" &
-set +m
+# Look for 'openocd_debug' from 3rd arg onwards
+shift
+shift
+while [ $# -gt 0 ]; do
+    if [ $1 = "openocd_debug" ]; then
+        USE_OPENOCD=1
+    fi
+    shift
+done
+
+if [ $USE_OPENOCD -eq 1 ]; then
+    #
+    # Block Ctrl-C from getting passed to openocd.
+    # Exit openocd when gdb detaches.
+    #
+    set -m
+    openocd -s $MY_PATH -f arduino_primo.cfg -c "gdb_port 3333; telnet_port 4444; nrf52.cpu configure -event gdb-detach {shutdown}" -c init -c "halt" &
+    set +m
+else
+    #
+    # Block Ctrl-C from getting passed to JLinkGDBServer
+    set -m
+    JLinkGDBServer -device nRF52 -speed 4000 -if SWD -port 3333 -singlerun > /dev/null &
+    set +m
+fi
 
 echo "target remote localhost:3333" > $GDB_CMD_FILE
 arm-none-eabi-gdb -x $GDB_CMD_FILE $FILE_NAME

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c35d48d8/hw/bsp/arduino_primo_nrf52/primo_download.sh
----------------------------------------------------------------------
diff --git a/hw/bsp/arduino_primo_nrf52/primo_download.sh b/hw/bsp/arduino_primo_nrf52/primo_download.sh
index 7178434..9940e39 100755
--- a/hw/bsp/arduino_primo_nrf52/primo_download.sh
+++ b/hw/bsp/arduino_primo_nrf52/primo_download.sh
@@ -25,17 +25,13 @@
 #
 #
 
-#
-# XXXX note that this is using openocd through STM32, with openocd
-# which has been patched to support nrf52 flash interface.
-#
-
 if [ $# -lt 2 ]; then
     echo "Need binary to download"
     exit 1
 fi
 
 IS_BOOTLOADER=0
+USE_OPENOCD=0
 MYPATH=$1
 BASENAME=$2
 GDB_CMD_FILE=.gdb_cmds
@@ -47,6 +43,9 @@ while [ $# -gt 0 ]; do
     if [ $1 = "bootloader" ]; then
         IS_BOOTLOADER=1
     fi
+    if [ $1 = "openocd_debug" ]; then
+	USE_OPENOCD=1
+    fi
     shift
 done
 
@@ -60,4 +59,43 @@ fi
 
 echo "Downloading" $FILE_NAME "to" $FLASH_OFFSET
 
-openocd -s $MYPATH -f arduino_primo.cfg -c init -c "reset halt" -c "flash write_image erase $FILE_NAME $FLASH_OFFSET" -c "reset run" -c shutdown
+if [ $USE_OPENOCD -eq 1 ]; then
+    #
+    # XXXX note that this is using openocd through STM32, with openocd
+    # which has been patched to support nrf52 flash.
+    #
+    openocd -s $MYPATH -f arduino_primo.cfg -c init -c "reset halt" -c "flash write_image erase $FILE_NAME $FLASH_OFFSET" -c "reset run" -c shutdown
+else
+    echo "shell /bin/sh -c 'trap \"\" 2;JLinkGDBServer -device nRF52 -speed 4000 -if SWD -port 3333 -singlerun' & " > $GDB_CMD_FILE
+    echo "target remote localhost:3333" >> $GDB_CMD_FILE
+    echo "restore $FILE_NAME binary $FLASH_OFFSET" >> $GDB_CMD_FILE
+    echo "quit" >> $GDB_CMD_FILE
+
+    msgs=`arm-none-eabi-gdb -x $GDB_CMD_FILE 2>&1`
+    echo $msgs > .gdb_out
+
+    rm $GDB_CMD_FILE
+
+    # Echo output from script run, so newt can show it if things go wrong.
+    echo $msgs
+
+    error=`echo $msgs | grep error`
+    if [ -n "$error" ]; then
+	exit 1
+    fi
+
+    error=`echo $msgs | grep -i failed`
+    if [ -n "$error" ]; then
+	exit 1
+    fi
+
+    error=`echo $msgs | grep -i "unknown / supported"`
+    if [ -n "$error" ]; then
+	exit 1
+    fi
+
+    error=`echo $msgs | grep -i "not found"`
+    if [ -n "$error" ]; then
+	exit 1
+    fi
+fi