CVS: jtag/funclets eraseFlash.S,1.2,1.3 makefile,1.2,1.3
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-serv2464/jtag/funclets
Modified Files:
eraseFlash.S makefile
Log Message:
- F2xx support
- unlock segmentA if its a segment erase of that segment
- erase cycles adjusted
Index: eraseFlash.S
===================================================================
RCS file: /cvsroot/mspgcc/jtag/funclets/eraseFlash.S,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -d -r1.2 -r1.3
--- eraseFlash.S 10 Jan 2003 02:59:35 -0000 1.2
+++ eraseFlash.S 22 Dec 2005 00:57:17 -0000 1.3
@@ -25,11 +25,30 @@
; mov #0xa544, &FCTL2 ;Source = MCLK, DIV = 5.
mov #0xa541, &FCTL2 ;Source = MCLK, DIV = 2.
mov #0xa500, &FCTL3 ;Clear bits.
- mov #10, r9 ;Bug requires 10 erase cycles.
+ mov #1, r9 ;just one loop suffices for segemnt erase
+ mov #4820/3+1, r8 ;erase cycles for a segment
+
+ cmp #0xA502, type ;is it ERASE_SEGMENT?
+ jne .LeMass ;no -> mass or main erase
+ cmp #0x1040, addr ;check for segemnt A in F2xx devices
+ jhs .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
+
+ jmp .LAgain ;start erase
+
+.LeMass:mov #19, r9 ;Bug requires additional erase cycles.
+ mov 5300/3+1, r8 ;increase erase cycles for a mass or main erase
+
.LAgain:mov type, &FCTL1 ;Load FCTL1 value. MUST CONTAIN PASSWORD.
mov addr, r10 ;Load (page) address to erase.
mov #0xffff, 0(r10) ;Write data into the address (to erase the FLASH).
- mov #(ERASECYCLES/3), r10 ;Delay for FLASH to erase (BUSY does not work on older devices).
+ mov r8, r10 ;Delay for FLASH to erase (BUSY does not work on older devices).
.LWait: dec r10 ;Loop requires 3 clock cycles.
jnz .LWait ;
mov #0xA500, &FCTL1 ;Clear ERASE + MERAS bits.
@@ -37,4 +56,11 @@
dec r9 ;Loop on erase cycles.
jnz .LAgain ;
+ ; 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.
Index: makefile
===================================================================
RCS file: /cvsroot/mspgcc/jtag/funclets/makefile,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -d -r1.2 -r1.3
--- makefile 8 Jan 2003 04:44:35 -0000 1.2
+++ makefile 22 Dec 2005 00:57:17 -0000 1.3
@@ -6,7 +6,7 @@
#programs. CC is used for all source files incl. .S and .c
#assembler needs the define so that the includes work properly
CC = msp430-gcc
-CPU = msp430x1121
+CPU = msp430x2121
ASFLAGS = -mmcu=${CPU} -D_GNU_ASSEMBLER_
CFLAGS = -mmcu=${CPU} -O2 -Wall -g
-------------------------------------------------------
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