2010-06-20 21:09:12 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
TOPDIR=$1
|
2011-07-09 20:53:12 +08:00
|
|
|
CFGFILE=$2
|
2010-06-20 21:09:12 +08:00
|
|
|
USAGE="$0 <TOPDIR> [-d]"
|
2011-07-09 20:53:12 +08:00
|
|
|
|
2010-06-20 21:09:12 +08:00
|
|
|
if [ -z "${TOPDIR}" ]; then
|
|
|
|
echo "Missing argument"
|
|
|
|
echo $USAGE
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2011-07-09 20:53:12 +08:00
|
|
|
if [ -z "${CFGFILE}" ]; then
|
|
|
|
echo "Using olimex.cfg"
|
|
|
|
CFGFILE=olimex.cfg
|
|
|
|
fi
|
|
|
|
|
2010-06-20 21:09:12 +08:00
|
|
|
OPENOCD_PATH="/cygdrive/c/OpenOCD/openocd-0.4.0/src"
|
|
|
|
OPENOCD_EXE=openocd.exe
|
2011-07-09 20:53:12 +08:00
|
|
|
OPENOCD_CFG="${TOPDIR}/configs/nucleus2g/tools/${CFGFILE}"
|
2010-06-20 21:09:12 +08:00
|
|
|
OPENOCD_ARGS="-f `cygpath -w ${OPENOCD_CFG}`"
|
|
|
|
|
|
|
|
if [ "X$2" = "X-d" ]; then
|
|
|
|
OPENOCD_ARGS=$OPENOCD_ARGS" -d3"
|
|
|
|
set -x
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -d ${OPENOCD_PATH} ]; then
|
|
|
|
echo "OpenOCD path does not exist: ${OPENOCD_PATH}"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if [ ! -x ${OPENOCD_PATH}/${OPENOCD_EXE} ]; then
|
|
|
|
echo "OpenOCD does not exist: ${OPENOCD_PATH}/${OPENOCD_EXE}"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if [ ! -f ${OPENOCD_CFG} ]; then
|
|
|
|
echo "OpenOCD config file does not exist: ${OPENOCD_CFG}"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Starting OpenOCD"
|
|
|
|
${OPENOCD_PATH}/${OPENOCD_EXE} ${OPENOCD_ARGS} &
|
|
|
|
echo "OpenOCD daemon started"
|
|
|
|
ps -ef | grep openocd
|
|
|
|
echo "In GDB: target remote localhost:3333"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|