CVS: python msp430-jtag.py,1.32,1.33

"Chris Liechti" <[email protected]> Sun, 8 Feb 2009 19:39:05 +0000
Newsgroups gmane.comp.hardware.texas-instruments.msp430.gcc.cvs
Message-ID <[email protected]>
Update of /cvsroot/mspgcc/python
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv32014

Modified Files:
	msp430-jtag.py 
Log Message:
- added --spy-bi-wire-jtag option (4 wire on spy-bi-wire devices)
- fix for edd length segments
- comment updtes


Index: msp430-jtag.py
===================================================================
RCS file: /cvsroot/mspgcc/python/msp430-jtag.py,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -w -d -r1.32 -r1.33
--- msp430-jtag.py	28 May 2008 12:49:55 -0000	1.32
+++ msp430-jtag.py	8 Feb 2009 19:39:03 -0000	1.33
@@ -1,7 +1,8 @@
 #!/usr/bin/env python
-# JTAG programmer for the MSP430 embedded proccessor.
 #
-# (C) 2002-2006 Chris Liechti <[email protected]>
+# JTAG programmer for the MSP430 embedded processor.
+#
+# (C) 2002-2009 Chris Liechti <[email protected]>
 # this is distributed under a free software license, see license.txt
 #
 # http://mspgcc.sf.net
@@ -17,7 +18,7 @@
 from mspgcc.util import hexdump, makeihex
 
 
-VERSION = "2.3"
+VERSION = "2.4"
 
 DEBUG = 0                           #disable debug messages by default
 
@@ -33,11 +34,13 @@
 USAGE: %(prog)s [options] [file]
 Version: %(version)s
 
-If "-" is specified as file the data is read from stdin.
 File format is autodetected, unless one of the options below is used.
-Prefered file extensions are ".txt" for TI-Text format, ".a43" or ".hex" for
+Preferred file extensions are ".txt" for TI-Text format, ".a43" or ".hex" for
 Intel HEX. ELF files can also be loaded.
 
+If "-" is specified as file the data is read from stdin and intel-hex format
+is expected by default.
+
 General options:
   -h, --help            Show this help text.
   --help-backend        Show help about the different backends.
@@ -51,8 +54,8 @@
 
 Connection:
   -l, --lpt=name        Specify an other parallel port or serial port for the
-                        USBFET (the later requires %(libprefix)sMSP430%(libsuffix)s instead of
-                        %(libprefix)sMSP430mspgcc%(libsuffix)s).
+                        USBFET (the later requires %(msp430)s instead of
+                        %(msp430mspgcc)s).
                         (defaults to "LPT1" ("/dev/parport0" on Linux))
   --slowdown=microsecs  Artificially slow down the communication. Can help
                         with long lines, try values between 1 and 50 (parallel
@@ -60,14 +63,15 @@
                         (experts only)
   --backend=backend     Select an alternate backend. See --help-backend for
                         more information.
-  --spy-bi-wire         Interface is two-wire spy-bi-wire instead of standard
-                        JTAG.
+  --spy-bi-wire-jtag    Interface is 4 wire on a spy-bi-wire capable device.
+  --spy-bi-wire         Interface is 2 wire on a spy-bi-wire capable device.
 
-Note: On Windows, use "TIUSB" or "COM5" etc if using MSP430.dll from TI.
+Note: On Windows, use "USB", "TIUSB" or "COM5" etc if using MSP430.dll from TI.
       On other platforms, e.g. Linux, use "/dev/ttyUSB0" etc. if using
       libMSP430.so.
-      If a %(libprefix)sMSP430%(libsuffix)s is found, it is prefered, otherwise
-      %(libprefix)sMSP430mspgcc%(libsuffix)s is used.
+      If a %(msp430)s is found, it is prefered, otherwise
+      %(msp430mspgcc)s is used.
+
 Note: --slowdown > 50 can result in failures for the ramsize autodetection
       (use --ramsize option to fix this). Use the --debug option and watch
       the outputs. The DCO clock adjustment and thus the Flash timing may be
@@ -89,7 +93,7 @@
 
 Note: Writing and/or reading RAM before and/or after running a funclet may not
       work as expected on devices with the JTAG bug like the F123.
-Note: Only possible with %(libprefix)sMSP430mspgcc%(libsuffix)s, not other backends.
+Note: Only possible with %(msp430mspgcc)s, not other backends.
 
 Program flow specifiers:
   -e, --masserase       Mass Erase (clear all flash memory).
@@ -129,18 +133,17 @@
                         This can be used to clone a device.
 
 Do before exit:
-  -g, --go=address      Start programm execution at specified address.
+  -g, --go=address      Start program execution at specified address.
                         This implies option "w" (wait)
   -r, --reset           Reset connected MSP430. Starts application.
                         This is a normal device reset and will start
-                        the programm that is specified in the reset
+                        the program that is specified in the reset
                         interrupt vector. (see also -g)
   -w, --wait            Wait for <ENTER> before closing parallel port.
   --no-close            Do not close port on exit. Allows to power devices
                         from the parallel port interface.
 
-
-Address parameters for --erase, --upload, --size can be given in
+Address parameters for --erase, --upload, --size, --execute can be given in
 decimal, hexadecimal or octal.
 
 Examples:
@@ -149,8 +152,8 @@
 """ % {
         'prog': sys.argv[0],
         'version': VERSION,
-        'libprefix': (sys.platform != 'win32') and 'lib' or '',
-        'libsuffix': (sys.platform != 'win32') and '.so' or '.dll',
+        'msp430': (sys.platform != 'win32') and 'libMSP430.so' or 'MSP430.dll',
+        'msp430mspgcc': (sys.platform != 'win32') and 'libMSP430mspgcc.so' or 'MSP430mspgcc.dll',
     })
 
 
@@ -160,42 +163,52 @@
 The backend can be chosen with the --backend command line option.
 
 "mspgcc"
-    Using %(libprefix)sMSP430mspgcc%(libsuffix)s, the open source implementation
+    Using %(msp430mspgcc)s, the open source implementation
     from the mspgcc project.
 
 "ti" (default)
-    Using %(libprefix)sMSP430%(libsuffix)s, the proprietary library from TI or a
-    compatible one from a 3rd pary supplier.
+    Using %(msp430)s, the proprietary library from TI or a
+    compatible one from a 3rd party supplier.
 
 "parjtag"
-    Old way of using %(libprefix)sMSP430mspgcc%(libsuffix)s. Use "mspgcc" instead.
+    Old way of using %(msp430mspgcc)s. Use "mspgcc" instead.
 
-Compatibility of backends:
-    +===========================================+========+========+
-    | Feature                                   | mspgcc | ti     |
-    +===========================================+========+========+
-    | 4 Wire JTAG                               | yes    | yes    |
-    +-------------------------------------------+--------+--------+
-    | 4 Wire JTAG on devices with spy-bi-wire   | yes(1) | no     |
-    +-------------------------------------------+--------+--------+
-    | using --spy-bi-wire option                | no     | yes    |
-    +-------------------------------------------+--------+--------+
-    | support for USB JTAG adapters             | no     | yes    |
-    +-------------------------------------------+--------+--------+
-    | unsing --funclet option                   | yes    | no     |
-    +===========================================+========+========+
+Software support for interfaces:
+    +============================+==========+==========+==========+
+    | device JTAG                |  mspgcc  |         ti          |
+    | capabilities               |   FET    |   FET    | USB-FET  |
+    +============================+==========+==========+==========+
+    | standard    / 4 wire       |   yes    |   yes    |   yes    |
+    +----------------------------+----------+----------+----------+
+    | spy-bi-wire / 4 wire (1)   |  yes(2)  |   no     |  yes(3)  |
+    +----------------------------+----------+----------+----------+
+    | spy-bi-wire / 2 wire       |   no     |   no     |  yes(4)  |
+    +============================+==========+==========+==========+
 
 Notes:
-    (1) Timing critical, may not work on all machines or at every try.
+    (1) 4 wire JTAG on devices with spy-bi-wire capability needs special
+        timings.
+    (2) Timing critical, may not work on all machines or at every try.
+    (3) Using --spy-bi-wire-jtag option.
+    (4) Using --spy-bi-wire option.
+
+Features of backends:
+    +=======================================+==========+==========+
+    | Feature                               |  mspgcc  |   ti     |
+    +=======================================+==========+==========+
+    | Support for USB JTAG adapters         |   no     |   yes    |
+    +---------------------------------------+----------+----------+
+    | Using --funclet option                |   yes    |   no     |
+    +=======================================+==========+==========+
 
 """ % { 
         'prog': sys.argv[0],
-        'libprefix': (sys.platform != 'win32') and 'lib' or '',
-        'libsuffix': (sys.platform != 'win32') and '.so' or '.dll',
+        'msp430': (sys.platform != 'win32') and 'libMSP430.so' or 'MSP430.dll',
+        'msp430mspgcc': (sys.platform != 'win32') and 'libMSP430mspgcc.so' or 'MSP430mspgcc.dll',
     })
 
 def parseAddressRange(text):
-    """parse a single address or a address range and return a tuple."""
+    """parse a single address or an address range and return a tuple."""
     if '-' in text:
         adr1, adr2 = text.split('-', 1)
         try:
@@ -249,7 +262,9 @@
              "upload=", "download=", "size=", "hex", "bin", "ihex",
              "intelhex", "titext", "elf", "funclet", "ramsize=", "progress",
              "no-close", "parameter=", "result=", "timeout=", "secure",
-             "quiet", "backend=", "help-backend", "slowdown=", "spy-bi-wire"]
+             "quiet", "backend=", "help-backend", "slowdown=",
+             "spy-bi-wire-jtag", "spy-bi-wire"
+             ]
         )
     except getopt.GetoptError, e:
         # print help information and exit:
@@ -427,6 +442,8 @@
             HIL_SetSlowdown(slowdown)
         elif o == "--spy-bi-wire":
             jtag.interface = 'spy-bi-wire'
+        elif o == "--spy-bi-wire-jtag":
+            jtag.interface = 'spy-bi-wire-jtag'
 
     if DEBUG:
         if quiet:
@@ -544,7 +561,7 @@
 
         #work list
         if todo:
-            for f in todo: f()                          #work through todo list
+            for f in todo: f()                          # work through TODO list
 
         if reset:                                       #reset device first if desired
             jtagobj.reset()
@@ -555,7 +572,7 @@
         if funclet is not None:                         #download and start funclet
             jtagobj.actionFunclet(timeout)
 
-        if goaddr is not None:                          #start user programm at specified address
+        if goaddr is not None:                          # start user program at specified address
             jtagobj.actionRun(goaddr)                   #load PC and execute
 
         for format, function, args in results:
@@ -575,7 +592,7 @@
                 if outputformat == HEX:                 #depending on output format
                     hexdump((start, data))              #print a hex display
                 elif outputformat == INTELHEX:
-                    makeihex((start, data), eof=0)      #ouput a intel-hex file
+                    makeihex((start, data), eof=0)      # output a intel-hex file
                 else:
                     if sys.platform == "win32":
                         #ensure that the console is in binary mode


------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com