Page 1 of 1

C28 Interrupt Vectors in Tutorial Programs

PostPosted: Thu Feb 20, 2003 12:18 pm
by aek
There has been some confusion re the initialization of peripheral interrupt vectors in the tutorial programs ...

The PIE vectors for the tutorials are defined in salvo ut u1syswvectors.asm. The tutorials use only one interrupt source -- Timer2. Timer2's interrupt vector is INT14.

INT14 is the 15th PIE vector -- see TI's SPRU078, section 6 for more information.

If one were to initialize all of the PIE vectors at runtime, as is shown in DSP28_PieVect.c of SPRC097 (available from TI's website):

void InitPieVectTable(void)
int16 i;
Uint32 *Source = (void *) &PieVectTableInit;
Uint32 *Dest = (void *) &PieVectTable;

for(i=0; i < 128; i++)
*Dest++ = *Source++;

// Enable the PIE Vector Table
PieCtrlRegs.PIECRTL.bit.ENPIE = 1;


then INT14 would be the 15th vector defined in the struct PieVectTableInit defined above.

However, the tutorials initialize the vector tables at link time, and they do so by placing the vectors in a defined segment called vectors which immediately follows the defined segment called .reset. The .reset segment contains only the first vector, the reset vector. The INT1 vector is the next vector, and it is at the start of the vectors segment. Therefore INT14 is the 14th vector of the vectors segment, not the 15th.

The vector locations can be verified by inspecting the .map file of a tutorial project after it has been built.

So, in summary, there are two ways to initialize the C28x's vector tables -- at link time or at runtime. As implemented, Salvo's tutorials do it at link time using defined segments, one for the reset vector and another for all the rest.

N.B. One advantage to using link-time vector initialization is that it does not require the ROM of a function to initialize the vectors. However, link-time loads are not always possible in certain development and/or target environments.