CVS: jtag/msp430 funclets.c,1.6,1.7

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-serv14641/jtag/msp430

Modified Files:
	funclets.c 
Log Message:
- fixes in eraseFlash funclet
- separate mass/main and segment erase, so that each program fits in 128 bytes RAM (important for the smallest MSP430 derrivates)
- improve funclets build

Index: funclets.c
===================================================================
RCS file: /cvsroot/mspgcc/jtag/msp430/funclets.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -w -d -r1.6 -r1.7
--- funclets.c	21 Dec 2005 23:08:15 -0000	1.6
+++ funclets.c	22 Dec 2005 01:49:35 -0000	1.7
@@ -69,30 +69,46 @@
 
 // ----------------------------------------------------------------------------
 #include "eraseFlash.ci"                        //include the program to erase the flash
+#include "eraseFlashSegment.ci"                 //include the program to erase the flash by segment
 
 /** msp430 code to erase flash */
 STATUS_T eraseFlash(WORD type, WORD address) {
-    WORD fctl1;
     MSP430_Log(2, "funclets: eraseFlash(%d, 0x%04x)\n", type, address);
     //select correct erase mode
     switch (type) {
-        case ERASE_SEGMENT:     fctl1 = 0xA502; break;
-        case ERASE_MAIN:        fctl1 = 0xA504; break;
-        case ERASE_ALL:         fctl1 = 0xA506; break;
-        default: return STATUS_ERROR;
-    }
+        case ERASE_SEGMENT:
+            //fill in arguments
+            funclet_eraseFlashSegment[3] = 0;//srinit;  //TODO: need arg for DCO+?
+            funclet_eraseFlashSegment[4] = 0xA502;      //set FCTL1 contents
+            funclet_eraseFlashSegment[5] = address;     //address within the segment to be erased
+            //download erase prog and execute
+            return executeCode(funclet_eraseFlashSegment, sizeof(funclet_eraseFlashSegment)/sizeof(WORD), 1, 1);
+            
+        case ERASE_MAIN:
     //fill in arguments
     funclet_eraseFlash[3] = 0;//srinit;         //TODO: need arg for DCO+?
-    funclet_eraseFlash[4] = fctl1;              //set FCTL1 contents
+            funclet_eraseFlash[4] = 0xA504;             //set FCTL1 contents
+            funclet_eraseFlash[5] = address;            //address within the segment to be erased
+            //download erase prog and execute
+            return executeCode(funclet_eraseFlash, sizeof(funclet_eraseFlash)/sizeof(WORD), 1, 1);
+        
+        case ERASE_ALL:
+            //fill in arguments
+            funclet_eraseFlash[3] = 0;//srinit;         //TODO: need arg for DCO+?
+            funclet_eraseFlash[4] = 0xA506;             //set FCTL1 contents
     funclet_eraseFlash[5] = address;            //address within the segment to be erased
     //download erase prog and execute
     return executeCode(funclet_eraseFlash, sizeof(funclet_eraseFlash)/sizeof(WORD), 1, 1);
+        
+        default:
+            return STATUS_ERROR;
+    }
 }
 
 // ----------------------------------------------------------------------------
 
-//The following functions were originaly developed by TI. I added debug outputs an
-//simpified some parts
+//The following functions were originaly developed by TI. I added debug
+//outputs and simpified some parts
 //questions to chris.
 
 /**



-------------------------------------------------------
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.