PRELIMINARY

Sample Assembly Code to Erase and Reprogram the TMS320F240

depletion:

 

 

LACL

ERS_COUNT

;Get erase fail count.

ADD

#1

;Increment fail count.

SACL

ERS_COUNT

;Save new count.

SUB

#10

;CHECK for max of 10.

BCND

ers_error,GT

;If ers_cout>10 then hard fail.

CALL

FLWS

;Else, try to recover from

 

 

;depletion.

LACL

ERROR

;Check for FLASH±WRITE error.

BCND

ers_error,neq

;If couldn't recover, then hard

 

 

;fail.

B

ers_loop

;Else, Try erase again.

ers_error:

**************************************************************

**

If here, then an unrecoverable error occurred during

**

**

erase.

**

**

In an actual application, the system takes some action

**

**

to indicate that service is required.

**

**************************************************************

B ers_error ;Error while erasing.

ers_done:

**********************************************************

**

If here, then flash is erased and ready to be

**

**

reprogrammed.

**

**

This is a good place in the example to set a

**

**

breakpoint so that erasure can be verified (i.e.,

**

**

all flash bits should be 1).

**

**********************************************************

**************************************************************

**

At this point, an actual application fills a buffer with **

**

the data to be programmed. To simulate this in the

**

**

example, three DARAM locations are initialized.

**

**************************************************************

LAR

AR1, #0380h

;Using last 128 words of B1

DARAM

 

 

;as buffer.

 

MAR

*,AR1

 

 

SPLK

#0AAAAh,*+

;Use dummy data for buffer.

 

SPLK

#05555h,*+

 

 

SPLK

#0AAAAh,*

 

 

PRELIMINARY

Assembly Source Listings and Program Examples

A-43

Page 95
Image 95
Texas Instruments TMS320F20x/F24x DSP manual Lacl Erscount, Daram