CVS: python/msp430 jtag.py,1.11,1.12

Chris Liechti <[email protected]>
Newsgroups gmane.comp.hardware.texas-instruments.msp430.gcc.cvs
Message-ID <[email protected]>
Update of /cvsroot/mspgcc/python/msp430
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4068/msp430

Modified Files:
	jtag.py 
Log Message:
add some docs, better error messages


Index: jtag.py
===================================================================
RCS file: /cvsroot/mspgcc/python/msp430/jtag.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -w -d -r1.11 -r1.12
--- jtag.py	5 Oct 2005 15:25:23 -0000	1.11
+++ jtag.py	13 Oct 2005 01:02:37 -0000	1.12
@@ -41,10 +41,19 @@
     try:
         import _parjtag
     except ImportError:
-        raise ImportError("Can not find neither _parjtag nor ctypes. No JTAG backend available.")
+        raise ImportError(
+            "Can not find neither _parjtag nor ctypes. No JTAG backend available.\n"
+            "\n"
+            "The ctypes backend is prefered. Make sure that the ctypes python\n"
+            "extension is available on this system.\n"
+            "\n"
+            "Alternatively, the older _parjtag backend is a python extension that\n"
+            "can be built from sources from http://mspgcc.sf.net\n"
+        )
     else:
         backend = "_parjtag so/dll"
 else:
+    #create a wrapper class with ctypes, that has the same API as _parjtag
     backend = "ctypes"
     
     STATUS_OK   = 0
@@ -53,10 +62,16 @@
     WRITE       = 0
     READ        = 1
     if sys.platform == 'win32':
+        #the library uis found on the PATH, respectively in the executables directory
         MSP430mspgcc = ctypes.windll.MSP430mspgcc
     else:
+        #an absolute path to the library has to be given.
+        #LIBMSPGCC_PATH is used to pass its location
         import os
+        try:
         MSP430mspgcc = ctypes.cdll.LoadLibrary(os.path.join(os.environ['LIBMSPGCC_PATH'], 'libMSP430mspgcc.so'))
+        except KeyError:
+            raise KeyError('The environment variable "LIBMSPGCC_PATH" must point to the folder that contains "libMSP430mspgcc.so"')
     
     MSP430_Initialize               = MSP430mspgcc.MSP430_Initialize
     MSP430_Initialize.argtypes      = [ctypes.c_char_p, ctypes.POINTER(ctypes.c_long)]



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.