summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLev A. Serebryakov <lev@FreeBSD.org>2016-03-12 13:29:48 +0000
committerLev A. Serebryakov <lev@FreeBSD.org>2016-03-12 13:29:48 +0000
commit274d020bc07b8b7055b208d71e4d20c4f611f015 (patch)
treee7856fe42cdc490445ad01f73becf45d5b2e0b39
parentDon't overwrite BUILD_DEPENDS and RUN_DEPENDS. (diff)
Add support for TI USB debug interfaces.
Submitted by: Andre Albsmeier <andre@fbsd.a.e4m.org>
Notes
Notes: svn path=/head/; revision=410881
-rw-r--r--devel/msp430-debug-stack/Makefile11
-rw-r--r--devel/msp430-debug-stack/files/mspfet.conf25
-rw-r--r--devel/msp430-debug-stack/files/patch-DLL430__v3_src_TI_DLL430_FetControl.cpp11
-rw-r--r--devel/msp430-debug-stack/files/patch-DLL430__v3_src_TI_DLL430_UsbCdcIoChannel.cpp42
-rw-r--r--devel/msp430-debug-stack/files/pkg-message.in8
-rw-r--r--devel/msp430-debug-stack/pkg-plist1
6 files changed, 96 insertions, 2 deletions
diff --git a/devel/msp430-debug-stack/Makefile b/devel/msp430-debug-stack/Makefile
index 2ae21ed470ec..d22adc830832 100644
--- a/devel/msp430-debug-stack/Makefile
+++ b/devel/msp430-debug-stack/Makefile
@@ -2,7 +2,7 @@
PORTNAME= msp430-debug-stack
PORTVERSION= 3.05.01.01
-PORTREVISION= 2
+PORTREVISION= 3
CATEGORIES= devel
MASTER_SITES= http://www.ti.com/lit/sw/slac460n/ \
http://www.ti.com/lit/ug/slau320v/:doc1 \
@@ -23,16 +23,21 @@ LIB_DEPENDS= libboost_filesystem.so:${PORTSDIR}/devel/boost-libs \
BROKEN_FreeBSD_9= does not build (internal compiler error)
-USES= compiler:c++11-lib gmake zip:infozip
+USES= compiler:c++11-lib dos2unix gmake zip:infozip
USE_LDCONFIG= yes
WRKSRC= ${WRKDIR}/MSPDebugStack_OS_Package
+DOS2UNIX_REGEX= .*\.(cpp|h)
MAKE_ARGS+= BOOST_DIR=${LOCALBASE} \
HIDAPI_DIR=${LOCALBASE}
MAKE_JOBS_UNSAFE= yes
+SUB_FILES+= pkg-message
+
+REINPLACE_ARGS= -i ""
+
post-patch:
@${FIND} ${WRKSRC}/DLL430_v3/src/TI/DLL430 \
\( -name '*.cpp' -o -name '*.h' \) -print0 | ${XARGS} -0 \
@@ -45,5 +50,7 @@ do-install:
${MKDIR} ${STAGEDIR}${DOCSDIR}
${INSTALL_DATA} ${DISTDIR}/${DIST_SUBDIR}/slau320v.pdf ${STAGEDIR}${DOCSDIR}/
${INSTALL_DATA} ${DISTDIR}/${DIST_SUBDIR}/slau656.pdf ${STAGEDIR}${DOCSDIR}/
+ ${MKDIR} ${STAGEDIR}${PREFIX}/etc/devd
+ ${INSTALL_DATA} ${FILESDIR}/mspfet.conf ${STAGEDIR}${PREFIX}/etc/devd
.include <bsd.port.mk>
diff --git a/devel/msp430-debug-stack/files/mspfet.conf b/devel/msp430-debug-stack/files/mspfet.conf
new file mode 100644
index 000000000000..c4c015f13fc1
--- /dev/null
+++ b/devel/msp430-debug-stack/files/mspfet.conf
@@ -0,0 +1,25 @@
+#
+# $FreeBSD$
+#
+# Warning: Only a single instance of each FET product is supported
+#
+
+attach 20 {
+ device-name "umodem[0-9]+";
+ match "vendor" "0x2047"; # TI MSPBSL_STANDARD_USB_VID
+ match "product" "0x001(0|3|4)"; # Products: UIF eZ-FET MSP-FET
+ match "interface" "0"; # JTAG-Interface
+ action "cd /dev; p=$product; dn=$device-name; \
+ un=$(sysctl -n dev.umodem.${dn#umodem}.ttyname); \
+ chmod 666 cua$un; ln -sf cua$un mspfet${p#0x}";
+};
+
+notify 20 {
+ match "system" "USB";
+ match "subsystem" "INTERFACE";
+ match "type" "DETACH";
+ match "vendor" "0x2047"; # TI MSPBSL_STANDARD_USB_VID
+ match "product" "0x001(0|3|4)"; # Products: UIF eZ-FET MSP-FET
+ match "interface" "0"; # JTAG-Interface
+ action "p=$product; rm /dev/mspfet${p#0x}";
+};
diff --git a/devel/msp430-debug-stack/files/patch-DLL430__v3_src_TI_DLL430_FetControl.cpp b/devel/msp430-debug-stack/files/patch-DLL430__v3_src_TI_DLL430_FetControl.cpp
new file mode 100644
index 000000000000..5002e77785dc
--- /dev/null
+++ b/devel/msp430-debug-stack/files/patch-DLL430__v3_src_TI_DLL430_FetControl.cpp
@@ -0,0 +1,11 @@
+--- DLL430_v3/src/TI/DLL430/FetControl.cpp.orig 2016-03-12 13:23:34 UTC
++++ DLL430_v3/src/TI/DLL430/FetControl.cpp
+@@ -214,7 +214,7 @@ bool FetControl::resetCommunication()
+ data.push_back(0x00);
+ this->sendData(data); // reset connection
+
+- std::this_thread::sleep_for(std::chrono::milliseconds(100));
++ std::this_thread::sleep_for(std::chrono::milliseconds(300));
+
+ HalExecElement* el = new HalExecElement(ID_Zero);
+ el->appendInputData8(STREAM_CORE_ZERO_VERSION);
diff --git a/devel/msp430-debug-stack/files/patch-DLL430__v3_src_TI_DLL430_UsbCdcIoChannel.cpp b/devel/msp430-debug-stack/files/patch-DLL430__v3_src_TI_DLL430_UsbCdcIoChannel.cpp
new file mode 100644
index 000000000000..939c47392302
--- /dev/null
+++ b/devel/msp430-debug-stack/files/patch-DLL430__v3_src_TI_DLL430_UsbCdcIoChannel.cpp
@@ -0,0 +1,42 @@
+--- DLL430_v3/src/TI/DLL430/UsbCdcIoChannel.cpp.orig 2016-03-12 13:23:34 UTC
++++ DLL430_v3/src/TI/DLL430/UsbCdcIoChannel.cpp
+@@ -303,6 +303,22 @@ void UsbCdcIoChannel::createCdcPortList(
+ }
+ #else
+ stringstream cdcIdStream;
++
++#ifdef __FreeBSD__
++
++ path p( "/dev" );
++ if( exists(p) && is_directory(p) ) {
++
++ cdcIdStream << hex << setfill('0') << "mspfet" << setw(4) << productId;
++
++ const directory_iterator end;
++ for( directory_iterator it(p); it != end; ++it ) {
++
++ string dir = it->path().string();
++ if( dir.find( cdcIdStream.str() ) != string::npos ) {
++ {
++
++#else
+ cdcIdStream << hex << setfill('0') << "usb:v" << setw(4) << vendorId << "p" << setw(4) << productId;
+
+ path p("/sys/class/tty/");
+@@ -317,13 +333,14 @@ void UsbCdcIoChannel::createCdcPortList(
+ string modalias;
+ int interfaceNumber = -1;
+
+- ifstream modAliasStream((it->path()/"device/modalias").string().c_str());
++ std::ifstream modAliasStream((it->path()/"device/modalias").string().c_str());
+ modAliasStream >> modalias;
+
+- ifstream ifNumStream((it->path()/"device/bInterfaceNumber").string().c_str());
++ std::ifstream ifNumStream((it->path()/"device/bInterfaceNumber").string().c_str());
+ ifNumStream >> interfaceNumber;
+ if (modalias.find(cdcIdStream.str()) == 0 && interfaceNumber == 0)
+ {
++#endif
+ const string filename = it->path().filename().string();
+ const string portPath = string("/dev/") + filename;
+
diff --git a/devel/msp430-debug-stack/files/pkg-message.in b/devel/msp430-debug-stack/files/pkg-message.in
new file mode 100644
index 000000000000..640337798f33
--- /dev/null
+++ b/devel/msp430-debug-stack/files/pkg-message.in
@@ -0,0 +1,8 @@
+-------------------------------------------------------------------------
+
+ When plugging in FET debuggers a symlink will be created from
+ the corresponding cuaU device to mspfetXX with XX being the
+ product number (see mspfet.conf).
+ Only a single instance of each FET product is supported.
+
+-------------------------------------------------------------------------
diff --git a/devel/msp430-debug-stack/pkg-plist b/devel/msp430-debug-stack/pkg-plist
index e0cbcadf09c2..0976e37f9a9d 100644
--- a/devel/msp430-debug-stack/pkg-plist
+++ b/devel/msp430-debug-stack/pkg-plist
@@ -8,3 +8,4 @@ include/libmsp430/MSP430_HIL.h
lib/libmsp430.so
%%PORTDOCS%%%%DOCSDIR%%/slau320v.pdf
%%PORTDOCS%%%%DOCSDIR%%/slau656.pdf
+etc/devd/mspfet.conf