aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorSpencer Oliver <spen@spen-soft.co.uk>2013-12-19 21:33:19 +0000
committerSpencer Oliver <spen@spen-soft.co.uk>2014-01-09 15:20:51 +0000
commit4dc8cd201c667bac72bc083ef1fa1b285eb093fc (patch)
treedeefe8349199480a80a8defcbf42d7b4f9c5f18a /contrib
parent4bff54ccf455fbdfd2bdf9aa371c79f267d486d9 (diff)
cmsis-dap: add initial cmsis-dap support
This is based on work from: https://github.com/TheShed/OpenOCD-CMSIS-DAP/tree/cmsis-dap Main changes include moving over to using HIDAPI rather than libusb-1.0 and cleaning up to merge into master. Support for reset using srst has also been added. It has been tested on all the mbed boards as well as the Freedom board from Freescale. These boards only implement SWD mode, however JTAG mode has been tested with a Keil ULINK2 and a stm32 target - but requires a lot more work. Change-Id: I96d5ee1993bc9c0526219ab754c5aad3b55d812d Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Signed-off-by: Andrey Yurovsky <yurovsky@gmail.com> Reviewed-on: http://openocd.zylin.com/1542 Tested-by: jenkins
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/cross-build.sh15
-rw-r--r--contrib/openocd.udev14
2 files changed, 28 insertions, 1 deletions
diff --git a/contrib/cross-build.sh b/contrib/cross-build.sh
index 397b7f41..74ab0f4f 100755
--- a/contrib/cross-build.sh
+++ b/contrib/cross-build.sh
@@ -20,6 +20,7 @@
#
# Usage:
# export LIBUSB1_SRC=/path/to/libusb-1.0
+# export HIDAPI_SRC=/path/to/hidapi
# export OPENOCD_CONFIG="--enable-..."
# cd /work/dir
# /path/to/openocd/contrib/cross-build.sh <host-triplet>
@@ -36,13 +37,16 @@ WORK_DIR=$PWD
## Source code paths, customize as necessary
: ${OPENOCD_SRC:="`dirname "$0"`/.."}
: ${LIBUSB1_SRC:=/path/to/libusb}
+: ${HIDAPI_SRC:=/path/to/hidapi}
OPENOCD_SRC=`readlink -m $OPENOCD_SRC`
LIBUSB1_SRC=`readlink -m $LIBUSB1_SRC`
+HIDAPI_SRC=`readlink -m $HIDAPI_SRC`
HOST_TRIPLET=$1
BUILD_DIR=$WORK_DIR/$HOST_TRIPLET-build
LIBUSB1_BUILD_DIR=$BUILD_DIR/libusb1
+HIDAPI_BUILD_DIR=$BUILD_DIR/hidapi
OPENOCD_BUILD_DIR=$BUILD_DIR/openocd
## Root of host file tree
@@ -90,6 +94,17 @@ $LIBUSB1_CONFIG
make
make install DESTDIR=$SYSROOT
+# hidapi build & install into sysroot
+if [ -d $HIDAPI_SRC ] ; then
+ mkdir -p $HIDAPI_BUILD_DIR
+ cd $HIDAPI_BUILD_DIR
+ $HIDAPI_SRC/configure --build=`$HIDAPI_SRC/config.guess` --host=$HOST_TRIPLET \
+ --with-sysroot=$SYSROOT --prefix=$PREFIX \
+ $HIDAPI_CONFIG
+ make
+ make install DESTDIR=$SYSROOT
+fi
+
# OpenOCD build & install into sysroot
mkdir -p $OPENOCD_BUILD_DIR
cd $OPENOCD_BUILD_DIR
diff --git a/contrib/openocd.udev b/contrib/openocd.udev
index 7065014a..c1e04b5f 100644
--- a/contrib/openocd.udev
+++ b/contrib/openocd.udev
@@ -1,5 +1,5 @@
ACTION!="add|change", GOTO="openocd_rules_end"
-SUBSYSTEM!="usb|tty", GOTO="openocd_rules_end"
+SUBSYSTEM!="usb|tty|hidraw", GOTO="openocd_rules_end"
# Olimex ARM-USB-OCD
ATTRS{idVendor}=="15ba", ATTRS{idProduct}=="0003", MODE="664", GROUP="plugdev"
@@ -89,4 +89,16 @@ ATTRS{idVendor}=="0483", ATTRS{idProduct}=="3748", MODE="664", GROUP="plugdev"
# opendous and estick
ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="204f", MODE="664", GROUP="plugdev"
+# mbed CMSIS-DAP
+ATTRS{idVendor}=="0d28", ATTRS{idProduct}=="0204", MODE="664", GROUP="plugdev"
+KERNEL=="hidraw*", ATTRS{idVendor}=="0d28", ATTRS{idProduct}=="0204", MODE="664", GROUP="plugdev"
+
+# Freescale Freedom Board CMSIS-DAP
+ATTRS{idVendor}=="c251", ATTRS{idProduct}=="f002", MODE="664", GROUP="plugdev"
+KERNEL=="hidraw*", ATTRS{idVendor}=="c251", ATTRS{idProduct}=="f002", MODE="664", GROUP="plugdev"
+
+# Keil ULINK2 CMSIS-DAP
+ATTRS{idVendor}=="c251", ATTRS{idProduct}=="2722", MODE="664", GROUP="plugdev"
+KERNEL=="hidraw*", ATTRS{idVendor}=="c251", ATTRS{idProduct}=="2722", MODE="664", GROUP="plugdev"
+
LABEL="openocd_rules_end"