CVS: python msp430-bsl.py,1.5,1.6 msp430-jtag.py,1.5,1.6
Chris Liechti <[email protected]>
| Newsgroups | gmane.comp.hardware.texas-instruments.msp430.gcc.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/mspgcc/python
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11784/python
Modified Files:
msp430-bsl.py msp430-jtag.py
Log Message:
- implement --erase for the bsl too
- --erase now allows ranges of addresses
Index: msp430-bsl.py
===================================================================
RCS file: /cvsroot/mspgcc/python/msp430-bsl.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -w -d -r1.5 -r1.6
--- msp430-bsl.py 8 Sep 2004 14:53:38 -0000 1.5
+++ msp430-bsl.py 6 Nov 2004 00:15:48 -0000 1.6
@@ -28,7 +28,7 @@
Version: %s
If "-" is specified as file the data is read from the stdinput.
-A file ending with ".txt" is considered to be in TIText format,
+A file ending with ".txt" is considered to be in TI-Text format,
'.a43' and '.hex' as IntelHex and all other filenames are
considered as ELF files.
@@ -56,7 +56,7 @@
-D, --debug Increase level of debug messages. This won't be
very useful for the average user...
-I, --intelhex Force fileformat to IntelHex
- -T, --titext Force fileformat to be TIText
+ -T, --titext Force fileformat to be TI-Text
-N, --notimeout Don't use timeout on serial port (use with care)
-B, --bsl=bsl.txt Load and use new BSL from the TI Text file
-S, --speed=baud Reconfigure speed, only possible with newer
@@ -81,6 +81,10 @@
Program Flow Specifiers:
-e, --masserase Mass Erase (clear all flash memory)
+ --erase=address Selectively erase segment at the specified address
+ (requires --password)
+ --erase=adr1-adr2 Selectively erase a range of segments
+ (requires --password)
-E, --erasecheck Erase Check by file
-p, --program Program file
-v, --verify Verify by file
@@ -107,8 +111,12 @@
vector. (see also -g)
-w, --wait Wait for <ENTER> before closing serial port.
+Address parameters for --erase, --upload, --size can be given in
+decimal, hexadecimal or octal.
+
If it says "NAK received" it's probably because you specified no or a
-wrong password.
+wrong password. NAKs during programming indicate that the flash was not
+erased before programming.
""" % (sys.argv[0], VERSION))
@@ -146,7 +154,7 @@
"upload=", "download=", "size=", "hex", "bin", "ihex",
"intelhex", "titext", "notimeout", "bsl=", "speed=",
"bslversion", "f1x", "f4x", "invert-reset", "invert-test",
- "no-BSL-download", "force-BSL-download"]
+ "no-BSL-download", "force-BSL-download", "erase="]
)
except getopt.GetoptError:
# print help information and exit:
@@ -197,6 +205,36 @@
bslobj.meraseCycles = meraseCycles
elif o in ("-e", "--masserase"):
toinit.append(bslobj.actionMassErase) #Erase Flash
+ elif o == "--erase":
+ if '-' in a:
+ adr, adr2 = a.split('-', 1)
+ try:
+ adr = int(adr, 0)
+ except ValueError:
+ sys.stderr.write("Address range start address must be a valid number in dec, hex or octal\n")
+ sys.exit(2)
+ try:
+ adr2 = int(adr2, 0)
+ except ValueError:
+ sys.stderr.write("Address range end address must be a valid number in dec, hex or octal\n")
+ sys.exit(2)
+ while adr <= adr2:
+ if adr < 0x1100:
+ modulo = 128
+ elif adr < 0x1200:
+ modulo = 256
+ else:
+ modulo = 512
+ adr = adr - (adr % modulo)
+ toinit.append(bslobj.makeActionSegmentErase(adr))
+ adr = adr + modulo
+ else:
+ try:
+ seg = int(a, 0)
+ toinit.append(bslobj.makeActionSegmentErase(seg))
+ except ValueError:
+ sys.stderr.write("Segment address must be a valid number in dec, hex or octal or a range adr1-adr2\n")
+ sys.exit(2)
elif o in ("-E", "--erasecheck"):
toinit.append(bslobj.actionEraseCheck) #Erase Check (by file)
elif o in ("-p", "--programm"):
@@ -312,6 +350,25 @@
sys.stderr.write("Warning: option --reset ignored as --upload is specified!\n")
reset = 0
+ if toinit:
+ if DEBUG > 0: #debug
+ #show a nice list of sheduled actions
+ sys.stderr.write("TOINIT list:\n")
+ for f in toinit:
+ try:
+ sys.stderr.write(" %s\n" % f.func_name)
+ except AttributeError:
+ sys.stderr.write(" %r\n" % f)
+ if todo:
+ if DEBUG > 0: #debug
+ #show a nice list of sheduled actions
+ sys.stderr.write("TODO list:\n")
+ for f in todo:
+ try:
+ sys.stderr.write(" %s\n" % f.func_name)
+ except AttributeError:
+ sys.stderr.write(" %r\n" % f)
+
sys.stderr.flush()
#prepare data to download
@@ -359,14 +416,6 @@
#work list
if todo:
- if DEBUG > 0: #debug
- #show a nice list of sheduled actions
- sys.stderr.write("TODO list:\n")
- for f in todo:
- try:
- sys.stderr.write(" %s\n" % f.func_name)
- except AttributeError:
- sys.stderr.write(" %r\n" % f)
for f in todo: f() #work through todo list
if reset: #reset device first if desired
Index: msp430-jtag.py
===================================================================
RCS file: /cvsroot/mspgcc/python/msp430-jtag.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -w -d -r1.5 -r1.6
--- msp430-jtag.py 1 Aug 2004 16:04:17 -0000 1.5
+++ msp430-jtag.py 6 Nov 2004 00:15:48 -0000 1.6
@@ -33,7 +33,7 @@
Version: %s
If "-" is specified as file the data is read from stdin.
-A file ending with ".txt" is considered to be in TIText format all
+A file ending with ".txt" is considered to be in TI-Text format all
other filenames are considered to be in IntelHex format.
General options:
@@ -43,7 +43,7 @@
-D, --debug Increase level of debug messages. This won't be
very useful for the average user...
-I, --intelhex Force fileformat to IntelHex
- -T, --titext Force fileformat to be TIText
+ -T, --titext Force fileformat to be TI-Text
-f, --funclet The given file is a funclet (a small program to
be run in RAM)
-R, --ramsize Specify the amont of RAM to be used to program
@@ -55,6 +55,7 @@
-m, --mainerase Erase main flash memory only
--eraseinfo Erase info flash memory only (0x1000-0x10ff)
--erase=address Selectively erase segment at the specified address
+ --erase=adr1-adr2 Selectively erase a range of segments
-E, --erasecheck Erase Check by file
-p, --program Program file
-v, --verify Verify by file
@@ -86,6 +87,9 @@
the programm that is specified in the reset
interrupt vector. (see also -g)
-w, --wait Wait for <ENTER> before closing parallel port.
+
+Address parameters for --erase, --upload, --size can be given in
+decimal, hexadecimal or octal.
""" % (sys.argv[0], VERSION))
def main():
@@ -137,11 +141,34 @@
elif o in ("-m", "--mainerase"):
toinit.append(jtagobj.actionMainErase) #Erase main Flash
elif o == "--erase":
+ if '-' in a:
+ adr, adr2 = a.split('-', 1)
+ try:
+ adr = int(adr, 0)
+ except ValueError:
+ sys.stderr.write("Address range start address must be a valid number in dec, hex or octal\n")
+ sys.exit(2)
+ try:
+ adr2 = int(adr2, 0)
+ except ValueError:
+ sys.stderr.write("Address range end address must be a valid number in dec, hex or octal\n")
+ sys.exit(2)
+ while adr <= adr2:
+ if adr < 0x1100:
+ modulo = 128
+ elif adr < 0x1200:
+ modulo = 256
+ else:
+ modulo = 512
+ adr = adr - (adr % modulo)
+ toinit.append(jtagobj.makeActionSegmentErase(adr))
+ adr = adr + modulo
+ else:
try:
seg = int(a, 0)
toinit.append(jtagobj.makeActionSegmentErase(seg))
except ValueError:
- sys.stderr.write("Segment address must be a valid number in dec, hex or octal\n")
+ sys.stderr.write("Segment address must be a valid number in dec, hex or octal or a range adr1-adr2\n")
sys.exit(2)
elif o == "--eraseinfo":
toinit.append(jtagobj.makeActionSegmentErase(0x1000))
@@ -249,6 +276,25 @@
if DEBUG > 5: sys.stderr.write("File: %r\n" % filename)
+ if toinit:
+ if DEBUG > 0: #debug
+ #show a nice list of sheduled actions
+ sys.stderr.write("TOINIT list:\n")
+ for f in toinit:
+ try:
+ sys.stderr.write(" %s\n" % f.func_name)
+ except AttributeError:
+ sys.stderr.write(" %r\n" % f)
+ if todo:
+ if DEBUG > 0: #debug
+ #show a nice list of sheduled actions
+ sys.stderr.write("TODO list:\n")
+ for f in todo:
+ try:
+ sys.stderr.write(" %s\n" % f.func_name)
+ except AttributeError:
+ sys.stderr.write(" %r\n" % f)
+
sys.stderr.flush()
jtagobj.connect(lpt) #try to open port
@@ -262,14 +308,6 @@
#work list
if todo:
- if DEBUG > 0: #debug
- #show a nice list of sheduled actions
- sys.stderr.write("TODO list:\n")
- for f in todo:
- try:
- sys.stderr.write(" %s\n" % f.func_name)
- except AttributeError:
- sys.stderr.write(" %r\n" % f)
for f in todo: f() #work through todo list
if reset: #reset device first if desired
-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click