CVS: jtag/funclets eraseFlashSegment.S,1.4,1.5 progFlash.S,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/jtag/funclets
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2856/jtag/funclets

Modified Files:
	eraseFlashSegment.S progFlash.S 
Log Message:
- fix flash write to SegmentA on F2xx
- fix flash erase of SegmentA on F2xx

Index: eraseFlashSegment.S
===================================================================
RCS file: /cvsroot/mspgcc/jtag/funclets/eraseFlashSegment.S,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -d -r1.4 -r1.5
--- eraseFlashSegment.S	30 Dec 2005 03:30:50 -0000	1.4
+++ eraseFlashSegment.S	1 Feb 2006 23:59:11 -0000	1.5
@@ -38,8 +38,10 @@
         mov     #FWKEY, &FCTL3          ; Clear bits.
         mov     #1, r9                  ; just one loop suffices for segment erase
 
-        cmp     #0x1040, addr           ; check for SegmentA in F2xx devices
+        cmp     #0x1100, addr           ; check for SegmentA in F2xx devices
         jhs     .LAgain                 ; not segA -> start erase
+        cmp     #0x10c0, addr           ; check for SegmentA in F2xx devices
+        jlo     .LAgain                 ; not segA -> start erase
 
         ; Unlock SegmentA (F2xx)         
         bit     #LOCKA, &FCTL3          ; Test LOCKA

Index: progFlash.S
===================================================================
RCS file: /cvsroot/mspgcc/jtag/funclets/progFlash.S,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -w -d -r1.5 -r1.6
--- progFlash.S	30 Dec 2005 03:30:50 -0000	1.5
+++ progFlash.S	1 Feb 2006 23:59:11 -0000	1.6
@@ -36,6 +36,22 @@
         mov     addr, r9                ; Address to program.
         mov     length, r8              ; Length to program.
         mov     #buffer, r10            ; Buffer to program.
+
+        ; XXX doing it a bit too simple here: unlock SegmentA for any write
+        ; to the information memory. at least it's not unlocked for writes
+        ; to the main Flash...
+        cmp     #0x1100, addr           ; check for SegmentA in F2xx devices
+        jhs     .LProg                  ; not segA -> start erase
+        //~ cmp     #0x10c0, addr           ; check for SegmentA in F2xx devices
+        //~ jlo     .LAgain                 ; not segA -> start erase
+        
+        ; Unlock SegmentA (F2xx)
+        bit     #LOCKA, &FCTL3          ; Test LOCKA
+        jz      .Lunlocked              ; Already unlocked?
+        mov     #FWKEY|LOCKA, &FCTL3    ; No, unlock SegmentA
+.Lunlocked:
+        ; SegmentA is unlocked
+
 .LProg: cmp     @R10, 0(r9)             ; Value already present?
         jeq     .LNext                  ; Yes, so skip and advance to next.
         mov     #FWKEY|WRT, &FCTL1      ; No, so enable writing to flash.
@@ -52,6 +68,13 @@
         jnz     .LProg                  ; Program Length words.
         clr     R15                     ; set return value -> OK
 
+        ; Lock SegmentA again (F2xx)     
+        bit     #LOCKA, &FCTL3          ; Test LOCKA
+        jnz     .Llocked                ; Already locked?
+        mov     #FWKEY|LOCKA, &FCTL3    ; No, lock SegmentA
+.Llocked:
+        ; SegmentA is locked
+
 stop:   jmp     stop                    ; Wait here until detected by driver.
 
 buffer:                                 ; data follows, appended by driver



-------------------------------------------------------
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://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
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.