Texas Instruments TMS320F20x/F24x DSP Computer Drive User Manual


 
Sample Assembly Code to Erase and Reprogram the TMS320F206
PRELIMINARY
A-34
PRELIMINARY
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 has 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 SARAM locations are initialized. **
**********************************************************
LAR AR1, #0c00h ;Using last 3K of SARAM as
;buffer.
MAR *,AR1
SPLK #0AAAAh,*+ ;Use dummy data for buffer.
SPLK #05555h,*+
SPLK #0AAAAh,*
**********************************************************
** Now that the data to be programmed is ready, the **
** programming algorithm is invoked. Note that four **
** parameters must be initialized before calling the **
** algorithm. **
**********************************************************
LDP #PARMS
**********Put parameters where they belong.**********
splk #0ff00h,PROTECT
splk #0c00h,PRG_bufaddr
splk #04000h,PRG_paddr
splk #3,PRG_length
***********Next program flash ************
CALL GPGMJ ;Program flash from buffer.
LACL ERROR ;Check for program error.
BCND prg_error,neq ;If error then clear ACC.
B prg_done ;Else, No errors programming.