diff --git a/nuttx/configs/ea3152/tools/armusbocd.cfg b/nuttx/configs/ea3152/tools/armusbocd.cfg index 733e3768c..5765dda79 100644 --- a/nuttx/configs/ea3152/tools/armusbocd.cfg +++ b/nuttx/configs/ea3152/tools/armusbocd.cfg @@ -21,7 +21,7 @@ daemon_startup reset #target #target arm9ejs -target arm926ejs little run_and_halt 0 arm926ejs +target arm926ejs little run_and_halt 1 arm926ejs run_and_halt_time 0 30 #target_script 0 reset oocd_flash2138.script diff --git a/nuttx/configs/ea3152/tools/jlink.cfg b/nuttx/configs/ea3152/tools/jlink.cfg new file mode 100644 index 000000000..f5ff7c7be --- /dev/null +++ b/nuttx/configs/ea3152/tools/jlink.cfg @@ -0,0 +1,8 @@ +# +# Segger J-Link +# +# http://www.segger.com/jlink.html +# + +interface jlink + diff --git a/nuttx/configs/ea3152/tools/oocd.sh b/nuttx/configs/ea3152/tools/oocd.sh index 0953ba703..1a137b0fd 100755 --- a/nuttx/configs/ea3152/tools/oocd.sh +++ b/nuttx/configs/ea3152/tools/oocd.sh @@ -1,10 +1,64 @@ #!/bin/sh +# Get command line parameters + +USAGE="USAGE: $0 [-dhjo14] " +ADVICE="Try '$0 -h' for more information" + +INTERFACE=Olimex +OPENOCD=0.1.0 + +while [ ! -z "$1" ]; do + case $1 in + -d ) + set -x + ;; + -j ) + INTERFACE=Jlink + ;; + -o ) + INTERFACE=Olimex + ;; + -1 ) + OPENOCD=0.1.0 + ;; + -4 ) + OPENOCD=0.4.0 + ;; + -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 " -j" + echo " Use the Segger J-link interface" + echo " -o" + echo " Use the Olimex ARM USB OCD interface (Default)" + echo " -1" + echo " Use the Olimex GCCFD OpenOCD 0.1.0 (Default)" + echo " -4" + echo " Use the OpenOCD 0.4.0" + echo " " + echo " The full path to the top-level NuttX directory" + exit 0 + ;; + * ) + break; + ;; + esac + shift +done + TOPDIR=$1 -USAGE="$0 [-d]" if [ -z "${TOPDIR}" ]; then echo "Missing argument" echo $USAGE + echo $ADVICE exit 1 fi @@ -13,31 +67,42 @@ fi ############################################################################### # This script *probably* only works with the following versions of OpenOCD: -OPENOCD_PATH="/cygdrive/c/OpenOCD/openocd-0.4.0/src" -OPENOCD_EXE=openocd.exe +if [ "X${OPENOCD}" = "X0.4.0" ]; then -echo "Trying OpenOCD 0.4.0 path: ${OPENOCD_PATH}/${OPENOCD_EXE}" + # Local search directory and configurations -if [ -x "${OPENOCD_PATH}/${OPENOCD_EXE}" ]; then + OPENOCD_SEARCHDIR="${TOPDIR}/configs/ea3152/tools" + OPENOCD_WSEARCHDIR="`cygpath -w ${OPENOCD_SEARCHDIR}`" - # Local search directory and configurations + if [ "X${INTERFACE}" = "XJlink" ]; then + OPENOCD_PATH="/cygdrive/c/Program Files (x86)/OpenOCD/0.4.0/bin" + OPENOCD_EXE=openocd.exe + OPENOCD_INTERFACE="jlink.cfg" + else + OPENOCD_PATH="/cygdrive/c/OpenOCD/openocd-0.4.0/src" + OPENOCD_EXE=openocd.exe + OPENOCD_INTERFACE="olimex-arm-usb-ocd.cfg" + fi - OPENOCD_SEARCHDIR="${TOPDIR}/configs/ea3152/tools" - OPENOCD_WSEARCHDIR="`cygpath -w ${OPENOCD_SEARCHDIR}`" - OPENOCD_INTERFACE="olimex-arm-usb-ocd.cfg" - OPENOCD_TARGET="lpc3152.cfg" - OPENOCD_ARGS="-s ${OPENOCD_WSEARCHDIR} -f ${OPENOCD_INTERFACE} -f ${OPENOCD_TARGET}" + OPENOCD_TARGET="lpc3152.cfg" + OPENOCD_ARGS="-s ${OPENOCD_WSEARCHDIR} -f ${OPENOCD_INTERFACE} -f ${OPENOCD_TARGET}" - # Verify that everything is what it claims it is and is located where it claims it is. + echo "Trying OpenOCD 0.4.0 path: ${OPENOCD_PATH}/${OPENOCD_EXE}" - 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 + # 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 ############################################################################### @@ -46,39 +111,47 @@ if [ -x "${OPENOCD_PATH}/${OPENOCD_EXE}" ]; then ############################################################################### else - echo "OpenOCD 0.4.0 path does not exist: ${OPENOCD_PATH}/${OPENOCD_EXE}" + if [ "X${OPENOCD}" = "X0.1.0" ]; then - OPENOCD_PATH="/cygdrive/c/gccfd/openocd/bin" - OPENOCD_EXE=openocd-ftd2xx.exe + OPENOCD_PATH="/cygdrive/c/gccfd/openocd/bin" + OPENOCD_EXE=openocd-ftd2xx.exe - echo "Trying GCCFD OpenOCD 0.1.0 path: ${OPENOCD_PATH}/${OPENOCD_EXE}" + echo "Trying GCCFD OpenOCD 0.1.0 path: ${OPENOCD_PATH}/${OPENOCD_EXE}" - # Local search directory and configurations + # Local search directory and configurations - OPENOCD_CFG="${TOPDIR}/configs/ea3152/tools/armusbocd.cfg" - OPENOCD_ARGS="-f `cygpath -w ${OPENOCD_CFG}`" + if [ "X${INTERFACE}" = "XJlink" ]; then + echo "The Olimex OpenOCD doesn't support J-Link" + exit 1 + fi - if [ ! -f ${OPENOCD_CFG} ]; then - echo "OpenOCD config file does not exist: ${OPENOCD_CFG}" - exit 1 - fi + OPENOCD_CFG="${TOPDIR}/configs/ea3152/tools/armusbocd.cfg" + OPENOCD_ARGS="-f `cygpath -w ${OPENOCD_CFG}`" - # Verify that everything is what it claims it is and is located where it claims it is. + # Verify that everything is what it claims it is and is located where it claims it is. - 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 + if [ ! -f ${OPENOCD_CFG} ]; then + echo "OpenOCD config file does not exist: ${OPENOCD_CFG}" + exit 1 + fi + if [ ! -x "${OPENOCD_PATH}/${OPENOCD_EXE}" ]; then + echo "OpenOCD executable does not exist: ${OPENOCD_PATH}/${OPENOCD_EXE}" + exit 1 + fi + if [ ! -d "${OPENOCD_PATH}" ]; then + echo "OpenOCD path does not exist: ${OPENOCD_PATH}" + exit 1 + fi + if [ ! -f ${OPENOCD_CFG} ]; then + echo "OpenOCD config file does not exist: ${OPENOCD_CFG}" + exit 1 + fi + else + echo "Unsupported OpenOCD version" + echo $ADVICE + exit 1 + fi fi -############################################################################### # Enable debug if so requested @@ -90,7 +163,7 @@ fi # Okay... do it! echo "Starting OpenOCD" -${OPENOCD_PATH}/${OPENOCD_EXE} ${OPENOCD_ARGS} & +"${OPENOCD_PATH}/${OPENOCD_EXE}" ${OPENOCD_ARGS} & echo "OpenOCD daemon started" ps -ef | grep openocd echo "In GDB: target remote localhost:3333"