Part Number: TMS320F280049C
Other Parts Discussed in Thread: TMS320F28035
Tool/software: Code Composer Studio
Dear Sir,
I have tested your example code "adc_ex1_soc_epwm" with TMS320F280049C, and it is no problem (after compiler, the address of PieVectTableInit is 0x00A800).
I have made same code for TMS320F28035, and it is no problem.
And I re-used same code with TMS320F280049C but it couldn't copy interrupt vector table correctly (after compiler, the address of PieVectTableInit is 0x088F02).
It always copy a strange number into the destination.
I have modified my code in the following three situations.
1. Same as your example - Failed
2. Create a local variable for indirect copying - Failed
3. Create a global variable for indirect copying - Passed
Your example code "adc_ex1_soc_epwm":
C code -
void
InitPieVectTable(void)
{
Uint16 i;
Uint32 *Source = (void *) &PieVectTableInit;
Uint32 *Dest = (void *) &PieVectTable;
//
// Do not write over first 3 32-bit locations (these locations are
// initialized by Boot ROM with boot variables)
//
Source = Source + 3;
Dest = Dest + 3;
EALLOW;
for(i = 0; i < 221; i++)
{
*Dest++ = *Source++;
}
EDIS;
//
// Enable the PIE Vector Table
//
PieCtrlRegs.PIECTRL.bit.ENPIE = 1;
}
Assembly code -
285 {
InitPieVectTable():
0003db: FE06 ADDB SP, #6
287 Uint32 *Source = (void *) &PieVectTableInit;
0003dc: 8F00A800 MOVL XAR4, #0x00a800
0003de: A842 MOVL *-SP[2], XAR4
288 Uint32 *Dest = (void *) &PieVectTable;
0003df: 8F000D00 MOVL XAR4, #0x000d00
0003e1: A844 MOVL *-SP[4], XAR4
294 Source = Source + 3;
0003e2: 0206 MOVB ACC, #6
0003e3: 0742 ADDL ACC, *-SP[2]
0003e4: 1E42 MOVL *-SP[2], ACC
295 Dest = Dest + 3;
0003e5: 0206 MOVB ACC, #6
0003e6: 0744 ADDL ACC, *-SP[4]
0003e7: 1E44 MOVL *-SP[4], ACC
297 EALLOW;
0003e8: 7622 EALLOW
299 for(i = 0; i < 221; i++)
0003e9: 2B45 MOV *-SP[5], #0
0003ea: 9245 MOV AL, *-SP[5]
0003eb: 52DD CMPB AL, #0xdd
0003ec: 670D SB C$L2, HIS
301 *Dest++ = *Source++;
C$L1:
0003ed: 8344 MOVL XAR5, *-SP[4]
0003ee: 8A42 MOVL XAR4, *-SP[2]
0003ef: A0A9 MOVL @ACC, XAR5
0003f0: C484 MOVL XAR6, *XAR4++
0003f1: 0902 ADDB ACC, #2
0003f2: A842 MOVL *-SP[2], XAR4
0003f3: 1E44 MOVL *-SP[4], ACC
0003f4: C2C5 MOVL *+XAR5[0], XAR6
299 for(i = 0; i < 221; i++)
0003f5: 0A45 INC *-SP[5]
0003f6: 9245 MOV AL, *-SP[5]
0003f7: 52DD CMPB AL, #0xdd
0003f8: 68F5 SB C$L1, LO
304 EDIS;
C$L2:
0003f9: 761A EDIS
309 PieCtrlRegs.PIECTRL.bit.ENPIE = 1;
0003fa: 761F0033 MOVW DP, #0x33
0003fc: 1A200001 OR @0x20, #0x0001
310 }
0003fe: FE86 SUBB SP, #6
0003ff: 0006 LRETR
My code in situation 1:
C code -
void PIEVECT_init()
{
int16 i;
Uint32 *pSource = (void *) &PieVectTableInit;
Uint32 *pDest = (void *) &(PIE_VECT->PIE1_RESERVED_INT); // get address of table
// Do not write over first 3 32-bit locations (these locations are
// initialized by Boot ROM with boot variables)
pSource = pSource + 3;
pDest = pDest + 3;
EALLOW();
for(i=0; i < 221; i++){
*pDest++ = *pSource++;
}
EDIS();
// Enable the PIE Vector Table
PIE->PIECTRL.bit.ENPIE = 1;
}
Assembly code -
21 pSource = pSource + 3;
PIEVECT_init():
08834e: 8F488F08 MOVL XAR5, #0x088f08
088350: 7622 EALLOW
22 pDest = pDest + 3;
088351: 8F000D06 MOVL XAR4, #0x000d06
088353: BEDC MOVB XAR6, #0xdc
26 *pDest++ = *pSource++;
C$L42:
088354: 0685 MOVL ACC, *XAR5++
088355: 1E84 MOVL *XAR4++, ACC
25 for(i=0; i < 221; i++){
088356: 000EFFFE BANZ 65534,AR6--
088358: 761A EDIS
31 PIE->PIECTRL.bit.ENPIE = 1;
088359: F5A90CE0 MOV @AL, *(0:0x0ce0)
08835b: FF69 SPM #0
08835c: 5001 ORB AL, #0x1
08835d: F4A90CE0 MOV *(0:0x0ce0), @AL
08835f: 0006 LRETR
My code in situation 2:
C code -
void PIEVECT_init()
{
int16 i;
Uint32 *pSource = (void *) &PieVectTableInit;
//Uint32 *Dest = (void *) &PieVectTable;
Uint32 *pDest = (void *) &(PIE_VECT->PIE1_RESERVED_INT); // get address of table
Uint32 tempBuf;
// Do not write over first 3 32-bit locations (these locations are
// initialized by Boot ROM with boot variables)
pSource = pSource + 3;
pDest = pDest + 3;
EALLOW();
for(i=0; i < 221; i++){
tempBuf = *pSource;
*pDest = tempBuf;
pSource++;
pDest++;
}
EDIS();
// Enable the PIE Vector Table
PIE->PIECTRL.bit.ENPIE = 1;
}
Assembly code -
22 pSource = pSource + 3;
PIEVECT_init():
08834e: 8F488F08 MOVL XAR5, #0x088f08
088350: 7622 EALLOW
23 pDest = pDest + 3;
088351: 8F000D06 MOVL XAR4, #0x000d06
088353: BEDC MOVB XAR6, #0xdc
28 *pDest = tempBuf;
C$L42:
088354: 0685 MOVL ACC, *XAR5++
088355: 1E84 MOVL *XAR4++, ACC
26 for(i=0; i < 221; i++){
088356: 000EFFFE BANZ 65534,AR6--
088358: 761A EDIS
35 PIE->PIECTRL.bit.ENPIE = 1;
088359: F5A90CE0 MOV @AL, *(0:0x0ce0)
08835b: FF69 SPM #0
08835c: 5001 ORB AL, #0x1
08835d: F4A90CE0 MOV *(0:0x0ce0), @AL
08835f: 0006 LRETR
My code in situation 3:
C code -
Uint32 tempBuf;
void PIEVECT_init()
{
int16 i;
Uint32 *pSource = (void *) &PieVectTableInit;
Uint32 *pDest = (void *) &(PIE_VECT->PIE1_RESERVED_INT); // get address of table
// Do not write over first 3 32-bit locations (these locations are
// initialized by Boot ROM with boot variables)
pSource = pSource + 3;
pDest = pDest + 3;
EALLOW();
for(i=0; i < 221; i++){
tempBuf = *pSource;
*pDest = tempBuf;
pSource++;
pDest++;
}
EDIS();
// Enable the PIE Vector Table
PIE->PIECTRL.bit.ENPIE = 1;
}
Assembly code -
22 pSource = pSource + 3;
PIEVECT_init():
088330: 8F488F0C MOVL XAR5, #0x088f0c
088332: 7622 EALLOW
23 pDest = pDest + 3;
088333: 8F000D06 MOVL XAR4, #0x000d06
088335: BEDC MOVB XAR6, #0xdc
27 tempBuf = *pSource;
C$L42:
088336: 0685 MOVL ACC, *XAR5++
088337: 761F0296 MOVW DP, #0x296
28 *pDest = tempBuf;
088339: 1E84 MOVL *XAR4++, ACC
27 tempBuf = *pSource;
08833a: 1E32 MOVL @0x32, ACC
26 for(i=0; i < 221; i++){
08833b: 000EFFFB BANZ 65531,AR6--
08833d: 761A EDIS
35 PIE->PIECTRL.bit.ENPIE = 1;
08833e: F5A90CE0 MOV @AL, *(0:0x0ce0)
088340: FF69 SPM #0
088341: 5001 ORB AL, #0x1
088342: F4A90CE0 MOV *(0:0x0ce0), @AL
088344: 0006 LRETR
Best Regards,
Johnson