Texas Instruments TMS320F20x/F24x DSP Computer Drive User Manual


 
Using the Algorithms With C Code to Erase and Reprogram the ’F240
PRELIMINARY
A-47
Assembly Source Listings and Program Examples
PRELIMINARY
A.6 Using the Algorithms With C Code to Erase and Reprogram the ’F240
Because the algorithm implementations do not follow the C-calling convention
of the ’C2000 C environment, they cannot be used directly from C. The assem-
bly code of section A.2,
C-Callable Interface to Flash Algorithms
, is provided
as a C-callable interface to the programming algorithms. The C source file and
linker command file provide a working example for the ’F240.
In this example, the algorithms reside in external SRAM. The code can be relo-
cated anywhere in program space, with the exceptions described in section
A.3,
Using the Algorithms With Assembly Code
.
Note:
This is not an actual application example since a boot mechanism is required
to load the external SRAM on powerup. This example uses the ’C2xx C-
source Debugger to download the code to the external SRAM. In addition,
no reset or interrupt vectors are initialized.
The system requirements are F240 EVM or target board with external pro-
gram space SRAM located at 0x8000 and a minimum of 1K words.
A.6.1 C Code That Calls the Interface to Flash Algorithms for TMS320F240
/***********************************************/
/* Filname: sample24.c */
/* Description: This is an example of how to */
/* program the ’F2XX flash from C code. */
/* The C–callable interface for the standard */
/* flash algorithms is used. This interface is */
/* defined in the file <flash.asm>, as two */
/* C–callable functions: erase(), and program() */
/* At link time, this example must be combined */
/* with the code in <flash.asm> as well as with */
/* the object modules for the standard algos. */
/***************************************************/
/* This example is setup for the TMS320F240, */
/* and uses the B1 DARAM as a buffer for program– */
/* –ming data. The code first claers, erases, */
/* then programs the first three locations. */
/***************************************************/
/* Rev1.0 03/98 JGC */
/***************************************************/