Texas Instruments MSP430x1xx User Manual

Page 439

Advertising
background image

Flash Memory Access via JTAG and Software

C-27

Flash Memory

The target flash memory module can not execute the programming code se-
quence while data is being written to it. In the following example, a subroutine
moves the programming-code sequence to another memory such as RAM.

Source Start Address of The Code Sequence >> R7

Destination Start Address of The Code Sequence >> R10

Move One Word: (R7) >> (R10)

Increment Source and Destination Pointer in R7 and R10

Start-of-Subroutine: Load_Flash_Routine

End-of-Subroutine: RET

End-of-Source Code ?

;------------------------------------------------------------

; Definitions used in Subroutine:

; Move programming code sequence into RAM (load_flash_routine)
;------------------------------------------------------------

Flash_ram

.set

0222h ; Start address of flash

; program in the RAM

; program in the RAM

Prg_source_start

.set

0xxxxh ; Start address of code

; in the flash to be prg’ed

Prg_source_end

.set

0yyyyh ; End address of code

; in the flash to be prg’ed

Prg_dest_start

.set Flash_ram

load_flash_routine

; The code of the program which moves

; Flash access code (write, erase,..)

; starts at label load_flash_routine

push

r9

push

r10

mov

#Prg_source_start,R9 ; load pointer source

mov

#Prg_dest_start,R10

; load pointer destination

load_flash_prg

mov

@R9,0(R10)

; move a word

incd

R10

; destination pointer + 2

incd

R9

; source pointer + 2

cmp

# Prg_source_end,R9

; compare to end_of_code

jne

load_ flash_prg

pop

r9

pop

r10

ret

Advertising