Texas Instruments TMS320F20x/F24x DSP Computer Drive User Manual


 
Sample Assembly Code to Erase and Reprogram the TMS320F240
PRELIMINARY
A-41
Assembly Source Listings and Program Examples
PRELIMINARY
;**Variables included from flash algorithms.
.include ”svar20.h” ;Variable declarations
.ref GCLR ;References clear algo.
.ref GPGMJ ;References program algo.
.ref GERS ;References erase algo.
.ref FLWS ;References flash–write algo.
;**Parameters used by flash algorithms.
.def PRG_bufaddr, PRG_paddr
.def PRG_length, PARMS
.def SEG_ST,SEG_END,PROTECT
;**F240 Register definitions
RTICR .set 07027h ;RTI Control Register
WDCR .set 07029h ;WD Control Register
CKCR0 .set 0702Bh ;Clock Control Register 0
CKCR1 .set 0702Dh ;Clock Control Register 1
SYSSR .set 0701Ah ;System Module Status Register
DP_PF1 .set 224 ;page 1 of peripheral file
;(7000h/80h)
*************************************************************
VARS: .usect ”PRG_data”,16 ;This is an uninitialized data *
;section required by the standard *
;flash algos for temporary *
;variables. Pointers to this *
;space are hardcoded in SVAR20.H, *
;and variables are init’d at *
;run time. *
*************************************************************
PARMS: .usect ”PRG_parm”,10 ;This is an uninitialized data *
;section that is used for *
;temporary variables and for *
;passing parameters to the flash *
;algorithms. *
*************************************************************
PROTECT .set PARMS ;Segment enable bits. *
**************************************************************
***** Parameters needed for Programming algorithm. ***
*************************************************************
PRG_bufaddr .set PARMS+1 ;Addr of buffer for pgm data. *
PRG_paddr .set PARMS+2 ;1st flash addr to program. *
PRG_length .set PARMS+3 ;Length of block to program. *
*************************************************************
*** Parameters needed for CLEAR, ERASE, and FLW algorithms. **
*************************************************************
SEG_ST .set PARMS+4 ;Segment start address. *
SEG_END .set PARMS+5 ;Segment end address. *
*************************************************************
**** Other misc variables. ****
*************************************************************
ERS_COUNT .set PARMS+6 ;Used for erase fail count. *
*************************************************************
.text
*************************************************************
** First, initialize the key F240 registers for use with *
** the EVM. *
*************************************************************