diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-11-09 23:59:46 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-11-09 23:59:46 +0000 |
commit | 7b62ca71ac0e3ca2c133be8a7d8e07264f5efea8 (patch) | |
tree | 93bfdd4085c7065656d2c224d1f1ab7ce7799ddc /nuttx/configs/stm3210e-eval/tools/oocd.sh | |
parent | 90a4b4973d3425e2f9b86445779fd5c974d23e27 (diff) | |
download | px4-nuttx-7b62ca71ac0e3ca2c133be8a7d8e07264f5efea8.tar.gz px4-nuttx-7b62ca71ac0e3ca2c133be8a7d8e07264f5efea8.tar.bz2 px4-nuttx-7b62ca71ac0e3ca2c133be8a7d8e07264f5efea8.zip |
More PIC32 debug updates
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4083 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/configs/stm3210e-eval/tools/oocd.sh')
-rwxr-xr-x | nuttx/configs/stm3210e-eval/tools/oocd.sh | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/nuttx/configs/stm3210e-eval/tools/oocd.sh b/nuttx/configs/stm3210e-eval/tools/oocd.sh new file mode 100755 index 000000000..d2cd6ae27 --- /dev/null +++ b/nuttx/configs/stm3210e-eval/tools/oocd.sh @@ -0,0 +1,90 @@ +#!/bin/sh + +# Get command line parameters + +USAGE="USAGE: $0 [-dh] <TOPDIR>" +ADVICE="Try '$0 -h' for more information" + + +while [ ! -z "$1" ]; do + case $1 in + -d ) + set -x + ;; + -h ) + echo "$0 is a tool for generation of proper version files for the NuttX build" + echo "" + echo $USAGE + echo "" + echo "Where:" + echo " -d" + echo " Enable script debug" + echo " -h" + echo " show this help message and exit" + echo " Use the OpenOCD 0.4.0" + echo " <TOPDIR>" + echo " The full path to the top-level NuttX directory" + exit 0 + ;; + * ) + break; + ;; + esac + shift +done + +TOPDIR=$1 +if [ -z "${TOPDIR}" ]; then + echo "Missing argument" + echo $USAGE + echo $ADVICE + exit 1 +fi + +# This script *probably* only works with the following versions of OpenOCD: + +# Local search directory and configurations + +OPENOCD_SEARCHDIR="${TOPDIR}/configs/stm3210e-eval/tools" +OPENOCD_WSEARCHDIR="`cygpath -w ${OPENOCD_SEARCHDIR}`" + +OPENOCD_PATH="/cygdrive/c/Program Files (x86)/OpenOCD/0.4.0/bin" +OPENOCD_EXE=openocd.exe +OPENOCD_INTERFACE="olimex-arm-usb-ocd.cfg" + + +OPENOCD_TARGET="stm32.cfg" +OPENOCD_ARGS="-s ${OPENOCD_WSEARCHDIR} -f ${OPENOCD_INTERFACE} -f ${OPENOCD_TARGET}" + +echo "Trying OpenOCD 0.4.0 path: ${OPENOCD_PATH}/${OPENOCD_EXE}" + +# Verify that everything is what it claims it is and is located where it claims it is. + +if [ ! -x "${OPENOCD_PATH}/${OPENOCD_EXE}" ]; then + echo "OpenOCD executable does not exist: ${OPENOCD_PATH}/${OPENOCD_EXE}" + exit 1 +fi +if [ ! -f "${OPENOCD_SEARCHDIR}/${OPENOCD_TARGET}" ]; then + echo "OpenOCD target config file does not exist: ${OPENOCD_SEARCHDIR}/${OPENOCD_TARGET}" + exit 1 +fi +if [ ! -f "${OPENOCD_SEARCHDIR}/${OPENOCD_INTERFACE}" ]; then + echo "OpenOCD interface config file does not exist: ${OPENOCD_SEARCHDIR}/${OPENOCD_INTERFACE}" + exit 1 +fi + +# Enable debug if so requested + +if [ "X$2" = "X-d" ]; then + OPENOCD_ARGS=$OPENOCD_ARGS" -d3" + set -x +fi + +# Okay... do it! + +echo "Starting OpenOCD" +"${OPENOCD_PATH}/${OPENOCD_EXE}" ${OPENOCD_ARGS} & +echo "OpenOCD daemon started" +ps -ef | grep openocd +echo "In GDB: target remote localhost:3333" + |