Repository: incubator-mynewt-core Updated Branches: refs/heads/1_0_0_b1_dev 8694d49e8 -> 8fe1c8fbd
openocd download; add option to send commands to openocd post-init. 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/8fe1c8fb Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/8fe1c8fb Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/8fe1c8fb Branch: refs/heads/1_0_0_b1_dev Commit: 8fe1c8fbd94657d4f394f6c11edc5091338bd39f Parents: 8694d49 Author: Marko Kiiskila <ma...@runtime.io> Authored: Thu Nov 10 17:51:57 2016 -0800 Committer: Marko Kiiskila <ma...@runtime.io> Committed: Thu Nov 10 17:51:57 2016 -0800 ---------------------------------------------------------------------- hw/scripts/openocd.sh | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/8fe1c8fb/hw/scripts/openocd.sh ---------------------------------------------------------------------- diff --git a/hw/scripts/openocd.sh b/hw/scripts/openocd.sh index f2335c6..21c399d 100644 --- a/hw/scripts/openocd.sh +++ b/hw/scripts/openocd.sh @@ -22,6 +22,14 @@ # FLASH_OFFSET must contain the offset in flash where to place it # openocd_load () { + OCD_CMD_FILE=.openocd_cmds + + echo "$EXTRA_JTAG_CMD" > $OCD_CMD_FILE + echo "init" >> $OCD_CMD_FILE + echo "$CFG_POST_INIT" >> $OCD_CMD_FILE + echo "reset halt" >> $OCD_CMD_FILE + echo "flash write_image erase $FILE_NAME $FLASH_OFFSET" >> $OCD_CMD_FILE + if [ -z $FILE_NAME ]; then echo "Missing filename" return 1 @@ -34,14 +42,15 @@ 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 - openocd $CFG -c init -c "reset halt" -c "flash write_image erase $FILE_NAME $FLASH_OFFSET" -c shutdown - return $? + openocd $CFG -f $OCD_CMD_FILE -c shutdown + if [ $? -ne 0 ]; then + exit 1 + fi + rm $OCD_CMD_FILE + return 0 } #