mynewt-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject incubator-mynewt-larva git commit: First take on debug/download scripts for NRF 52.
Date Wed, 04 Nov 2015 19:30:23 GMT
Repository: incubator-mynewt-larva
Updated Branches:
  refs/heads/master 99feb02d0 -> e19a4f98c


First take on debug/download scripts for NRF 52.


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

Branch: refs/heads/master
Commit: e19a4f98c05418cdb99c93791c76ee7487056bbf
Parents: 99feb02
Author: Marko Kiiskila <marko@runtime.io>
Authored: Wed Nov 4 11:29:14 2015 -0800
Committer: Marko Kiiskila <marko@runtime.io>
Committed: Wed Nov 4 11:29:14 2015 -0800

----------------------------------------------------------------------
 hw/bsp/nrf52pdk/egg.yml              |  2 ++
 hw/bsp/nrf52pdk/nrf52pdk_debug.sh    | 26 +++++++++++++++++
 hw/bsp/nrf52pdk/nrf52pdk_download.sh | 48 +++++++++++++++++++++++++++++++
 3 files changed, 76 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/e19a4f98/hw/bsp/nrf52pdk/egg.yml
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf52pdk/egg.yml b/hw/bsp/nrf52pdk/egg.yml
index c4e10da..3939a18 100644
--- a/hw/bsp/nrf52pdk/egg.yml
+++ b/hw/bsp/nrf52pdk/egg.yml
@@ -1,6 +1,8 @@
 egg.name: "hw/bsp/nrf52pdk"
 egg.linkerscript: "nrf52pdk.ld" 
 egg.linkerscript.bootloader.OVERWRITE: "boot-nrf52pdk.ld"
+egg.downloadscript: nrf52pdk_download.sh
+egg.debugscript: nrf52pdk_debug.sh
 egg.cflags: -DNRF52
 egg.deps: 
     - hw/mcu/nordic/nrf52xxx

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/e19a4f98/hw/bsp/nrf52pdk/nrf52pdk_debug.sh
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf52pdk/nrf52pdk_debug.sh b/hw/bsp/nrf52pdk/nrf52pdk_debug.sh
new file mode 100755
index 0000000..beeef5e
--- /dev/null
+++ b/hw/bsp/nrf52pdk/nrf52pdk_debug.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+#
+# Called: $0 <binary> [identities...]
+#  - binary is the path to prefix to target binary, .elf.bin appended to this
+#    name is the raw binary format of the binary.
+#  - identities is the project identities string. So you can have e.g. different
+#    flash offset for bootloader identity
+# 
+#
+if [ $# -lt 1 ]; then
+    echo "Need binary to download"
+    exit 1
+fi
+
+FILE_NAME=$1.elf
+GDB_CMD_FILE=.gdb_cmds
+
+echo "Debugging" $FILE_NAME
+
+echo "shell /bin/sh -c 'trap \"\" 2;JLinkGDBServer -device nRF52 -speed 4000 -if SWD $JLINK_SCRIPT
-port 3333 -singlerun' & " > $GDB_CMD_FILE
+echo "target remote localhost:3333" >> $GDB_CMD_FILE
+
+arm-none-eabi-gdb -x $GDB_CMD_FILE $FILE_NAME
+
+rm $GDB_CMD_FILE
+

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/e19a4f98/hw/bsp/nrf52pdk/nrf52pdk_download.sh
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf52pdk/nrf52pdk_download.sh b/hw/bsp/nrf52pdk/nrf52pdk_download.sh
new file mode 100755
index 0000000..78ce539
--- /dev/null
+++ b/hw/bsp/nrf52pdk/nrf52pdk_download.sh
@@ -0,0 +1,48 @@
+#!/bin/sh
+#
+# Called: $0 <binary> [identities...]
+#  - binary is the path to prefix to target binary, .elf.bin appended to this
+#    name is the raw binary format of the binary.
+#  - identities is the project identities string. So you can have e.g. different
+#    flash offset for bootloader identity
+# 
+#
+if [ $# -lt 1 ]; then
+    echo "Need binary to download"
+    exit 1
+fi
+
+FLASH_OFFSET=0x0
+FILE_NAME=$1.elf.bin
+JLINK_SCRIPT=.download.jlink
+
+echo "Downloading" $FILE_NAME "to" $FLASH_OFFSET
+
+cat > $JLINK_SCRIPT <<EOF
+w 4001e504 1
+loadbin $FILE_NAME $FLASH_OFFSET
+q
+EOF
+
+msgs=`JLinkExe -device nRF52 -speed 4000 -if SWD $JLINK_SCRIPT`
+
+# Echo output from script run, so newt can show it if things go wrong.
+echo $msgs
+rm $JLINK_SCRIPT
+
+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
+
+exit 0


Mime
View raw message