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 2015/11/03 23:41:36 UTC

[3/5] incubator-mynewt-larva git commit: Add download/debug support files for STM32F3 discovery board.

Add download/debug support files for STM32F3 discovery board.


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

Branch: refs/heads/master
Commit: d0aeff2eb2eab57694fb062177e85fef7df5f097
Parents: 337106c
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Tue Nov 3 14:39:51 2015 -0800
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Tue Nov 3 14:39:51 2015 -0800

----------------------------------------------------------------------
 hw/bsp/stm32f3discovery/egg.yml                 |  2 ++
 .../stm32f3discovery/stm32f3discovery_debug.sh  | 27 ++++++++++++++++++++
 .../stm32f3discovery_download.sh                | 21 +++++++++++++++
 3 files changed, 50 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/d0aeff2e/hw/bsp/stm32f3discovery/egg.yml
----------------------------------------------------------------------
diff --git a/hw/bsp/stm32f3discovery/egg.yml b/hw/bsp/stm32f3discovery/egg.yml
index 389f86f..f307b73 100644
--- a/hw/bsp/stm32f3discovery/egg.yml
+++ b/hw/bsp/stm32f3discovery/egg.yml
@@ -1,6 +1,8 @@
 egg.name: "hw/bsp/stm32f3discovery"
 egg.linkerscript: "stm32f3discovery.ld" 
 egg.linkerscript.bootloader.OVERWRITE: "boot-stm32f3discovery.ld"
+egg.downloadscript: "stm32f3discovery_download.sh"
+egg.debugscript: "stm32f3discovery_debug.sh"
 egg.cflags: -DSTM32F303xC
 egg.deps: 
     - hw/mcu/stm/stm32f3xx

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/d0aeff2e/hw/bsp/stm32f3discovery/stm32f3discovery_debug.sh
----------------------------------------------------------------------
diff --git a/hw/bsp/stm32f3discovery/stm32f3discovery_debug.sh b/hw/bsp/stm32f3discovery/stm32f3discovery_debug.sh
new file mode 100755
index 0000000..63ba061
--- /dev/null
+++ b/hw/bsp/stm32f3discovery/stm32f3discovery_debug.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+#
+# Called: $0 <binary> [identities...]
+#  - binary is the path to prefix to target binary, .elf appended to name is
+#    the ELF file
+#  - identities is the project identities string.
+# 
+#
+if [ $# -lt 1 ]; then
+    echo "Need binary to debug"
+    exit 1
+fi
+
+FILE_NAME=$1.elf
+GDB_CMD_FILE=.gdb_cmds
+
+echo "Debugging" $FILE_NAME
+
+#
+# Block Ctrl-C from getting passed to openocd.
+# Exit openocd when gdb detaches.
+#
+echo "shell /bin/sh -c 'trap \"\" 2; openocd -f board/stm32f3discovery.cfg -c \"gdb_port 3333; telnet_port 4444; stm32f3x.cpu configure -event gdb-detach {shutdown}\" -c init -c \"reset halt\"' & " > $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/d0aeff2e/hw/bsp/stm32f3discovery/stm32f3discovery_download.sh
----------------------------------------------------------------------
diff --git a/hw/bsp/stm32f3discovery/stm32f3discovery_download.sh b/hw/bsp/stm32f3discovery/stm32f3discovery_download.sh
new file mode 100755
index 0000000..4682d56
--- /dev/null
+++ b/hw/bsp/stm32f3discovery/stm32f3discovery_download.sh
@@ -0,0 +1,21 @@
+#!/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=0x08000000
+FILE_NAME=$1.elf.bin
+
+echo "Downloading" $FILE_NAME
+
+openocd -f board/stm32f3discovery.cfg -c init -c "reset halt" -c "flash write_image erase $FILE_NAME $FLASH_OFFSET" -c "reset run" -c shutdown
+