CVS: jtag/funclets eraseFlash.S,1.3,1.4 ihex2c.py,1.5,1.6 makefile,1.3,1.4

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

Modified Files:
	eraseFlash.S ihex2c.py makefile 
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: eraseFlash.S
===================================================================
RCS file: /cvsroot/mspgcc/jtag/funclets/eraseFlash.S,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -w -d -r1.3 -r1.4
--- eraseFlash.S	22 Dec 2005 00:57:17 -0000	1.3
+++ eraseFlash.S	22 Dec 2005 01:49:34 -0000	1.4
@@ -1,15 +1,17 @@
+
 /* Flash erase funclet to be used with MSP430mspgcc.dll/so.
 
 Three arguments must be supplied in RAM:
 srinit: initial value for SR, used to switch of DCO+
 type:   value for FCTL1, which selects MASS, MAIN or single segment erase
-addr:   an address within the segment to be erased
+addr:   an address within the segment to be erased1
+
+Notes:
+- SegmentA in F2xx devices is not erased
 */
 
 #include <io.h>
 
-#define ERASECYCLES   (5296 * 5)
-
 .text
 start:  .word   start
         .word   main
@@ -25,30 +27,11 @@
 ;        mov     #0xa544, &FCTL2         ;Source = MCLK, DIV = 5.
         mov     #0xa541, &FCTL2         ;Source = MCLK, DIV = 2.
         mov     #0xa500, &FCTL3         ;Clear bits.
-        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
-        
+        mov     #19, r9                 ;Bug requires additional erase cycles.
 .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     r8, r10                 ;Delay for FLASH to erase (BUSY does not work on older devices).
+        mov     #5300/3+1, 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.
@@ -56,11 +39,4 @@
         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: ihex2c.py
===================================================================
RCS file: /cvsroot/mspgcc/jtag/funclets/ihex2c.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -w -d -r1.5 -r1.6
--- ihex2c.py	8 Jan 2003 01:05:19 -0000	1.5
+++ ihex2c.py	22 Dec 2005 01:49:34 -0000	1.6
@@ -101,7 +101,7 @@
                 for i in range(length):
                     segmentdata.append( chr(int(l[9+2*i:11+2*i],16)) )
                 currentAddr = length + currentAddr
-            elif type == 0x01:
+            elif type in (0x01, 0x03):
                 pass
             else:
                 sys.stderr.write("Ignored unknown field (type 0x%02x) in ihex file.\n" % type)

Index: makefile
===================================================================
RCS file: /cvsroot/mspgcc/jtag/funclets/makefile,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -w -d -r1.3 -r1.4
--- makefile	22 Dec 2005 00:57:17 -0000	1.3
+++ makefile	22 Dec 2005 01:49:35 -0000	1.4
@@ -13,7 +13,7 @@
 .PHONY: all clean convert FORCE
 
 #a list of funclets for the default target "all"
-all: regtest.a43 blinking.a43 eraseFlash.a43 progFlash.a43 eraseFlash.lst progFlash.lst convert
+all: regtest.a43 blinking.a43 eraseFlash.a43 eraseFlashSegment.a43 progFlash.a43 eraseFlash.lst eraseFlashSegment.lst progFlash.lst convert
 
 #pattern rule for funclets
 #msp430-ld is used to link and NO libraries are linked!
@@ -31,8 +31,9 @@
 	msp430-objdump >$@ -DS $<
 
 #convert intel hex/a43 files to includable C files
-convert: eraseFlash.a43 progFlash.a43
+convert: eraseFlash.a43 progFlash.a43 eraseFlashSegment.a43
 	python ihex2c.py eraseFlash.a43 eraseFlash
+	python ihex2c.py eraseFlashSegment.a43 eraseFlashSegment
 	python ihex2c.py progFlash.a43 progFlash
 
 #clean (some) files generated during compilation



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