CVS: python/mspgcc jtag.py, 1.12, 1.13 memory.py, 1.2, 1.3
Chris Liechti <[email protected]> Tue, 13 Mar 2007 04:34:04 -0700
| Newsgroups | gmane.comp.hardware.texas-instruments.msp430.gcc.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/mspgcc/python/mspgcc
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv17483/python/mspgcc
Modified Files:
jtag.py memory.py
Log Message:
- fix progress bar for numbers > 32767
- fix load binary from .z43
- mspgcc.Memory's loadFile can handle file objects too
Index: jtag.py
===================================================================
RCS file: /cvsroot/mspgcc/python/mspgcc/jtag.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -w -d -r1.12 -r1.13
--- jtag.py 8 Dec 2006 18:14:07 -0000 1.12
+++ jtag.py 13 Mar 2007 11:34:00 -0000 1.13
@@ -275,7 +275,7 @@
except AttributeError:
pass
- messagecallback = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.c_short, ctypes.c_short) #void f(WORD count, WORD total)
+ messagecallback = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.c_ushort, ctypes.c_ushort) #void f(WORD count, WORD total)
class ParJTAG:
"""implementation of the _parjtag module in python with the help of ctypes"""
@@ -299,11 +299,11 @@
if interface == 'spy-bi-wire':
status = MSP430_Configure(INTERFACE_MODE, SPYBIWIRE_IF)
if status != STATUS_OK:
- raise IOError("Could not configure the library: %s" % MSP430_Error_String(MSP430_Error_Number()))
+ raise IOError("Could not configure the library: %s (device not spi-bi-wire capable?)" % MSP430_Error_String(MSP430_Error_Number()))
else:
status = MSP430_Configure(INTERFACE_MODE, JTAG_IF)
if status != STATUS_OK:
- raise IOError("Could not configure the library: %s" % MSP430_Error_String(MSP430_Error_Number()))
+ raise IOError("Could not configure the library: %s (spy-bi-wire device/connection?)" % MSP430_Error_String(MSP430_Error_Number()))
else:
if interface != 'JTAG':
raise ValueError("interface != 'JTAG' is not supported with this backend")
@@ -596,6 +596,7 @@
different output."""
sys.stderr.write("\r%d%%" % (100*count/total))
sys.stderr.flush()
+ return 0
def actionProgram(self):
"""Program data into flash memory."""
Index: memory.py
===================================================================
RCS file: /cvsroot/mspgcc/python/mspgcc/memory.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -d -r1.2 -r1.3
--- memory.py 18 May 2006 22:54:46 -0000 1.2
+++ memory.py 13 Mar 2007 11:34:00 -0000 1.3
@@ -115,29 +115,37 @@
if len(section.data):
self.segments.append( Segment(section.lma, section.data) )
- def loadFile(self, filename):
+ def loadFile(self, filename, fileobj=None):
"""fill memory with the contents of a file. file type is determined from extension"""
+ close = 0
+ if fileobj is None:
+ fileobj = open(filename, "rb")
+ close = 1
+ try:
#first check extension
try:
if filename[-4:].lower() == '.txt':
- self.loadTIText(open(filename, "rb"))
+ self.loadTIText(fileobj)
return
elif filename[-4:].lower() in ('.a43', '.hex'):
- self.loadIHex(open(filename, "rb"))
+ self.loadIHex(fileobj)
return
except FileFormatError:
pass #do contents based detection below
#then do a contents based detection
try:
- self.loadELF(open(filename, "rb"))
+ self.loadELF(fileobj)
except elf.ELFException:
try:
- self.loadIHex(open(filename, "rb"))
+ self.loadIHex(fileobj)
except FileFormatError:
try:
- self.loadTIText(open(filename, "rb"))
+ self.loadTIText(fileobj)
except FileFormatError:
raise FileFormatError('file could not be loaded (not ELF, Intel-Hex, or TI-Text)')
+ finally:
+ if close:
+ fileobj.close()
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
def saveIHex(self, filelike):
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV