Digital Signal Processing Reference
In-Depth Information
// Flash_sine.c Sine generation-illustrates use of flash memory
#include "dsk6713_aic23.h" //codec-DSK support file
Uint32 fs=DSK6713_AIC23_FREQ_8KHZ; //set sampling rate
short loop = 0, gain = 10;
short sine_table[8] = {0,707,1000,707,0,-707,-1000,-707};//sine values
interrupt void c_int11() //interrupt service routine
{
output_sample(sine_table[loop]*gain);//output with gain
if (++loop > 7) loop = 0; //if end of buffer,reinit index
return;
}
void main()
{
comm_intr();
//init DSK, codec, McBSP
while(1);
//infinite loop
}
FIGURE 2.29. C source program to program the onboard flash ( flash_sine.c ).
Example 2.19: Use of Flash Memory—Programming the
Onboard Flash ( Flash_sine )
This example illustrates the use of the onboard flash memory to run an application.
It illustrates the steps used to invoke the flash utilities, erase the onboard flash, and
reprogram it for a specific application. A 1-kHz sine generation program is used as
an application example. Figure 2.29 shows the C source sine generation program
flash_sine.c that implements this project example .
1. Build this project as flash_sine . Add the necessary support files to this
project: the initialization “black box” file, the appropriate vector file, the linker
command file, and the three library support files. Load and run the executable
(.out) file, and verify that a 1-kHz sine wave is generated.
2. Remove (delete) the vector and the linker command files from the project to
replace them with the following files:
(a) vecs_int_flash.asm —a modified version of the vector file included
with CCS to copy the code from flash to internal memory upon boot up.
It includes a starting address for flash and the code size.
(b) c6713dsk_flash.cmd —a new linker command file. It sets up a section
called bootload starting at 0x200 with a length of 0x200.
These two files are included on the CD. Rebuild the project and verify again
that the 1-kHz tone is generated using the new executable (.out) file.
Creating .hex File
The executable (.out) file needs to be converted from a COFF to a hex file format
that can then be loaded into flash. The COFF- to-hex converter file hex6x.exe
Search WWH ::




Custom Search