Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 Mar 2016 13:29:48 +0000 (UTC)
From:      "Lev A. Serebryakov" <lev@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r410881 - in head/devel/msp430-debug-stack: . files
Message-ID:  <201603121329.u2CDTmIN063310@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: lev
Date: Sat Mar 12 13:29:48 2016
New Revision: 410881
URL: https://svnweb.freebsd.org/changeset/ports/410881

Log:
   Add support for TI USB debug interfaces.
  
  Submitted by:	Andre Albsmeier <andre@fbsd.a.e4m.org>

Added:
  head/devel/msp430-debug-stack/files/mspfet.conf   (contents, props changed)
  head/devel/msp430-debug-stack/files/patch-DLL430__v3_src_TI_DLL430_FetControl.cpp   (contents, props changed)
  head/devel/msp430-debug-stack/files/patch-DLL430__v3_src_TI_DLL430_UsbCdcIoChannel.cpp   (contents, props changed)
  head/devel/msp430-debug-stack/files/pkg-message.in   (contents, props changed)
Modified:
  head/devel/msp430-debug-stack/Makefile
  head/devel/msp430-debug-stack/pkg-plist

Modified: head/devel/msp430-debug-stack/Makefile
==============================================================================
--- head/devel/msp430-debug-stack/Makefile	Sat Mar 12 13:12:24 2016	(r410880)
+++ head/devel/msp430-debug-stack/Makefile	Sat Mar 12 13:29:48 2016	(r410881)
@@ -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:${PO
 
 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>

Added: head/devel/msp430-debug-stack/files/mspfet.conf
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/msp430-debug-stack/files/mspfet.conf	Sat Mar 12 13:29:48 2016	(r410881)
@@ -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}";
+};

Added: head/devel/msp430-debug-stack/files/patch-DLL430__v3_src_TI_DLL430_FetControl.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/msp430-debug-stack/files/patch-DLL430__v3_src_TI_DLL430_FetControl.cpp	Sat Mar 12 13:29:48 2016	(r410881)
@@ -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);

Added: head/devel/msp430-debug-stack/files/patch-DLL430__v3_src_TI_DLL430_UsbCdcIoChannel.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/msp430-debug-stack/files/patch-DLL430__v3_src_TI_DLL430_UsbCdcIoChannel.cpp	Sat Mar 12 13:29:48 2016	(r410881)
@@ -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;
+ 

Added: head/devel/msp430-debug-stack/files/pkg-message.in
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/msp430-debug-stack/files/pkg-message.in	Sat Mar 12 13:29:48 2016	(r410881)
@@ -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.
+
+-------------------------------------------------------------------------

Modified: head/devel/msp430-debug-stack/pkg-plist
==============================================================================
--- head/devel/msp430-debug-stack/pkg-plist	Sat Mar 12 13:12:24 2016	(r410880)
+++ head/devel/msp430-debug-stack/pkg-plist	Sat Mar 12 13:29:48 2016	(r410881)
@@ -8,3 +8,4 @@ include/libmsp430/MSP430_HIL.h
 lib/libmsp430.so
 %%PORTDOCS%%%%DOCSDIR%%/slau320v.pdf
 %%PORTDOCS%%%%DOCSDIR%%/slau656.pdf
+etc/devd/mspfet.conf



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201603121329.u2CDTmIN063310>