CVS: jtag/funclets lockSegmentA.S,NONE,1.1

Chris Liechti <[email protected]> Wed, 15 Nov 2006 13:08:41 -0800
Newsgroups gmane.comp.hardware.texas-instruments.msp430.gcc.cvs
Message-ID <[email protected]>
Update of /cvsroot/mspgcc/jtag/funclets
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv15656/jtag/funclets

Added Files:
	lockSegmentA.S 
Log Message:
docs, missing file

--- NEW FILE: lockSegmentA.S ---
/* Flash segmentA (un)lock funclet to be used with MSP430mspgcc.dll/so.

The data to be programmed is appended to this code by the download library.

One argument must be supplied in RAM:
lock: boolean value 0 unlocks, other values lock the segment

Notes:
- none

This program must be linked specialy so that it's placed in the RAM.
(see makefile).
The first six bytes and their content is mandatory. Also must the funclet
end with a "jmp $" instruction.
*/

#include <io.h>

.text
start:  .word   start
        .word   main
        .word   stop

lock:   .word   0                       ; arg 1

main:   mov     #WDTPW|WDTHOLD, &WDTCTL ; Disable Watchdog.
        dint                            ; Disable interrupts.

        tst     lock                    ; lock or unlock?
        jnz     .Llock                  ; != 0 -> lock
        
        ; Unlock SegmentA (F2xx)
        bit     #LOCKA, &FCTL3          ; Test LOCKA
        jz      .Lunlocked              ; Already unlocked?
        mov     #FWKEY|LOCKA, &FCTL3    ; No, unlock SegmentA
.Lunlocked:
        ; SegmentA is unlocked
        jmp     stop

.Llock:
        ; Lock SegmentA again (F2xx)     
        bit     #LOCKA, &FCTL3          ; Test LOCKA
        jnz     .Llocked                ; Already locked?
        mov     #FWKEY|LOCKA, &FCTL3    ; No, lock SegmentA
.Llocked:
        ; SegmentA is locked

        mov     #FWKEY|LOCK, &FCTL3     ; set LOCK bit.

stop:   jmp     stop                    ; Wait here until detected by driver.

buffer:                                 ; data follows, appended by driver


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV