mynewt-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject [2/5] incubator-mynewt-core git commit: MYNEWT-418; olimex - use common functions for debug/download.
Date Thu, 03 Nov 2016 21:17:31 GMT
MYNEWT-418; olimex - use common functions for debug/download.


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

Branch: refs/heads/develop
Commit: ffe55aaed24b7b5c4aaad2a11b8e1496707318da
Parents: 77a5ab4
Author: Marko Kiiskila <marko@runtime.io>
Authored: Thu Nov 3 12:45:10 2016 -0700
Committer: Marko Kiiskila <marko@runtime.io>
Committed: Thu Nov 3 12:45:37 2016 -0700

----------------------------------------------------------------------
 .../olimex_stm32-e407_devboard_debug.sh         | 37 +++++++-------------
 .../olimex_stm32-e407_devboard_download.sh      | 35 +++++++-----------
 2 files changed, 26 insertions(+), 46 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/ffe55aae/hw/bsp/olimex_stm32-e407_devboard/olimex_stm32-e407_devboard_debug.sh
----------------------------------------------------------------------
diff --git a/hw/bsp/olimex_stm32-e407_devboard/olimex_stm32-e407_devboard_debug.sh b/hw/bsp/olimex_stm32-e407_devboard/olimex_stm32-e407_devboard_debug.sh
index 2190a9c..7717a11 100755
--- a/hw/bsp/olimex_stm32-e407_devboard/olimex_stm32-e407_devboard_debug.sh
+++ b/hw/bsp/olimex_stm32-e407_devboard/olimex_stm32-e407_devboard_debug.sh
@@ -18,41 +18,30 @@
 #
 
 # Called with following variables set:
+#  - CORE_PATH is absolute path to @apache-mynewt-core
 #  - BSP_PATH is absolute path to hw/bsp/bsp_name
 #  - BIN_BASENAME is the path to prefix to target binary,
 #    .elf appended to name is the ELF file
 #  - FEATURES holds the target features string
 #  - EXTRA_JTAG_CMD holds extra parameters to pass to jtag software
 #  - RESET set if target should be reset when attaching
+#  - NO_GDB set if we should not start gdb to debug
 #
-if [ -z "$BIN_BASENAME" ]; then
-    echo "Need binary to debug"
-    exit 1
-fi
-
-if [ -z "$BSP_PATH" ]; then
-    echo "Need BSP path for openocd script location"
-    exit 1
-fi
+. $CORE_PATH/hw/scripts/openocd.sh
 
 FILE_NAME=$BIN_BASENAME.elf
-GDB_CMD_FILE=.gdb_cmds
+OCD_CMD_FILE=.openocd_cmds
 
-echo "Debugging" $FILE_NAME
+CFG="-f interface/ftdi/olimex-arm-usb-tiny-h.cfg -s $BSP_PATH -f f407.cfg"
 
-#
-# Block Ctrl-C from getting passed to openocd.
+echo "gdb_port 3333" > $OCD_CMD_FILE
+echo "telnet_port 4444" >> $OCD_CMD_FILE
 # Exit openocd when gdb detaches.
-#
-set -m
-openocd -f interface/ftdi/olimex-arm-usb-tiny-h.cfg -s $BSP_PATH -f f407.cfg -c "gdb_port
3333; telnet_port 4444; stm32f4x.cpu configure -event gdb-detach {resume;shutdown}" -c "$EXTRA_JTAG_CMD"
-c init -c halt &
-set +m
-
-echo "target remote localhost:3333" > $GDB_CMD_FILE
-# Whether target should be reset or not
-if [ ! -z "$RESET" ]; then
-    echo "mon reset halt" >> $GDB_CMD_FILE
+echo "stm32f4x.cpu configure -event gdb-detach {resume;shutdown}" >> $OCD_CMD_FILE
+if [ ! -z "$EXTRA_JTAG_CMD" ]; then
+    echo "$EXTRA_JTAG_CMD" >> $OCD_CMD_FILE
 fi
 
-arm-none-eabi-gdb -x $GDB_CMD_FILE $FILE_NAME
-rm $GDB_CMD_FILE
+openocd_debug
+
+rm $OCD_CMD_FILE

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/ffe55aae/hw/bsp/olimex_stm32-e407_devboard/olimex_stm32-e407_devboard_download.sh
----------------------------------------------------------------------
diff --git a/hw/bsp/olimex_stm32-e407_devboard/olimex_stm32-e407_devboard_download.sh b/hw/bsp/olimex_stm32-e407_devboard/olimex_stm32-e407_devboard_download.sh
index 7c52f6b..660171f 100755
--- a/hw/bsp/olimex_stm32-e407_devboard/olimex_stm32-e407_devboard_download.sh
+++ b/hw/bsp/olimex_stm32-e407_devboard/olimex_stm32-e407_devboard_download.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
 # distributed with this work for additional information
@@ -17,7 +17,7 @@
 # under the License.
 #
 
-# Called with following variables set:
+#  - CORE_PATH is absolute path to @apache-mynewt-core
 #  - BSP_PATH is absolute path to hw/bsp/bsp_name
 #  - BIN_BASENAME is the path to prefix to target binary,
 #    .elf appended to name is the ELF file
@@ -25,33 +25,24 @@
 #  - FEATURES holds the target features string
 #  - EXTRA_JTAG_CMD holds extra parameters to pass to jtag software
 #  - MFG_IMAGE is "1" if this is a manufacturing image
+#  - FLASH_OFFSET contains the flash offset to download to
+#  - BOOTLOADER is set if downloading a bootloader
 
-if [ -z "$BIN_BASENAME" ]; then
-    echo "Need binary to download"
-    exit 1
-fi
-
-IS_BOOTLOADER=0
+. $CORE_PATH/hw/scripts/openocd.sh
 
-# Look for 'bootloader' in FEATURES
-for feature in $FEATURES; do
-    if [ $feature == "BOOT_LOADER" ]; then
-        IS_BOOTLOADER=1
-    fi
-done
+CFG="-f interface/ftdi/olimex-arm-usb-tiny-h.cfg -s $BSP_PATH -f f407.cfg"
+if [ ! -z "$EXTRA_JTAG_CMD" ]; then
+    CFG="$CFG -c $EXTRA_JTAG_CMD"
+fi
 
 if [ "$MFG_IMAGE" ]; then
-    FLASH_OFFSET=0x0
-    FILE_NAME=$BIN_BASENAME.bin
-elif [ $IS_BOOTLOADER -eq 1 ]; then
     FLASH_OFFSET=0x08000000
+    FILE_NAME=$BIN_BASENAME.bin
+elif [ "$BOOT_LOADER" ]; then
     FILE_NAME=$BIN_BASENAME.elf.bin
 else
-    FLASH_OFFSET=0x08020000
     FILE_NAME=$BIN_BASENAME.img
 fi
 
-echo "Downloading" $FILE_NAME "to" $FLASH_OFFSET
-
-openocd -f interface/ftdi/olimex-arm-usb-tiny-h.cfg -s $BSP_PATH -f f407.cfg -c "$EXTRA_JTAG_CMD"
-c init -c "reset halt" -c "flash write_image erase $FILE_NAME $FLASH_OFFSET" -c "reset run"
-c shutdown
-
+openocd_load
+openocd_reset_run


Mime
View raw message