CVS: jtag/msp430 funclets.c,1.15,1.16

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

Modified Files:
	funclets.c 
Log Message:
that was as silly bug.. the "retry" loop was not warking correctly, it programmed each block 3 times and if one failed it aborted. that instead of the correct "try it up to 3 times if it fails", enjoy faster downloads :-)

Index: funclets.c
===================================================================
RCS file: /cvsroot/mspgcc/jtag/msp430/funclets.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -w -d -r1.15 -r1.16
--- funclets.c	4 Jan 2006 11:13:46 -0000	1.15
+++ funclets.c	4 Jan 2006 16:18:25 -0000	1.16
@@ -46,23 +46,23 @@
         //download data and start flash programing funclet in RAM, with retries
         for (tries=3; tries; tries--) {
             res = executeCode(code, (sizeof(funclet_progFlash) + blocksize)/sizeof(WORD), 1, 1000, NULL);
-            if (res != STATUS_OK) {
-                MSP430_Log(1, "funclets: programFlash: Flash write retrying in block 0x%04x\n", address);
-                GetDevice();
-            }
-        }
-        if (res != STATUS_OK) break;
+            if (res == STATUS_OK) {
         if (STATUS_OK == GetReg(15, &funclet_result)) {
-            if (funclet_result) {                               //read CCR0, it's used as return value
-                MSP430_Log(1, "funclets: programFlash: Flash write error in block 0x%04x\n", address);
-                res = STATUS_ERROR;
+                    if (funclet_result) {                                       //read return value
+                        MSP430_Log(1, "funclets: programFlash: Flash write error in block @0x%04x\n", address);
+                    } else {
+                        //funclet returned success
                 break;
             }
         } else {
-            MSP430_Log(1, "funclets: programFlash: failed to read funclet answer\n");
-            res = STATUS_ERROR;
-            break;
+                    MSP430_Log(1, "funclets: programFlash: failed to read funclet answer, retrying in block @0x%04x\n", address);
         }
+            } else {
+                MSP430_Log(1, "funclets: programFlash: Flash write retrying in block @0x%04x\n", address);
+                GetDevice();
+            }
+        }
+        if (res != STATUS_OK) break;
         //~ MSP430_Log(2, "block 0x%04x OK\n", address);
         address += blocksize;                                           //adjust for next block
         done += blocksize;                                              //advance in source buffer



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
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.