This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Initializes the PIE vector table

Other Parts Discussed in Thread: TMS320F28335

Hi,

 

I am going through example code in DSP2833x_PieVect.c for PIE vector table initialization from below path

c:\tidcs\c28\DSP2833x\v131\DSP2833x_common\source\DSP2833x_PieVect.c

 

In this code example vector table is copied from "PieVectTableInit" to "PieVectTable". Where "PieVectTable" is memory mapped using

 

#ifdef __cplusplus
#pragma DATA_SECTION("PieVectTableFile")
#else
#pragma DATA_SECTION(PieVectTable,"PieVectTableFile");
#endif
struct PIE_VECT_TABLE PieVectTable;

My query is whether I can directly map the register "PieVectTableInit" to "PieVectTableFile" as shown below

 

#ifdef __cplusplus
#pragma DATA_SECTION("PieVectTableFile")
#else
#pragma DATA_SECTION(PieVectTable,"PieVectTableFile");
#endif
struct PIE_VECT_TABLE PieVectTableInit;

 

This will reduce my memory consumption.

Finally before enabling interrupts I will keep the below line of code to enable PIE vector table.

 

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

Please let me know your comments.

 

Thanks & Regards

Vishnu Beema 

 

 

 

 

  • Vishnu,

    Short answer, no, you cannot do that.

    Where are you defining the values you want the vector table filled with? You have to embed the actual values you want to be written to the PIE RAM somewhere into your .out file. The least expensive (code size) way to do this is to use a constant structure declaration. That is why you have the declaration in the DSP28233x_PieVect.c file:

    const struct PIE_VECT_TABLE PieVectTableInit = {
    ...
    }

    If you tried mapping this constant structure straight to RAM it won't be programmed into your Flash. So, when you program your Flash, cycle power, and boot from Flash, the PIE RAM will have garbage in it because you never had any copy from nonvolatile memory (Flash) to initialize it. So, you have to create a constant structure mapped to Flash to hold the initial values, then you have to declare a variable structure (PieVectTable) mapped to the PIE RAM and copy the values from Flash into the RAM.

    Regards,
    Dave Foley

     

  • Hi,

    I tried to initialize directly to struction mapped to PIE table. It worked, and .ebss decreassed. But there is still more better option. Below is the explanation. I have take one the working build.

    In most of the applications there are two structures of type “RegPieVectTable_Struct”. One is “PieVectTableInit” global structure and the other is “strPieVectTable” structure mapped to PIE vector table location of controller. The PIE vector table is being initialized by using “ScPieVectorTableInitialization()” function. Because of current way of implementation, it will occupy .cinit, .text and .ebss.

    To avoid all these, below is the other way of implementation where you can reduce considerable amount of memory. The differences are captured in Table. All values are in “words”

    (Note: For TMS320F28335 size of word = byte = 2)

    Original

    Directly mapped

    Directly mapped - Original

    for loop

    for loop - Original

    .cinit

    8455

    8455

    0

    8196

    -259

    .text

    44046

    43976

    -70

    44043

    -3

    .ebss

    11236

    10980

    -256

    10980

    -256

    As shown in above table, by using below way of implementation you can save 259 words of .cinit, 256 words of .ebss and 3 words of .text section.

     

    After adding below code you can remove “PieVectTableInit” structure.

    Code for PIE Vector table initialization

     

    void ScPieVectorTableInitialization(void)

    {

                    INT16   i;

                    UINT32 *Source = (void *) PIE_RESERVED;

                    UINT32 *Dest     = (void *) &strPieVectTable;

     

                    EALLOW;

     

                    // Fill the first 12 vector table locations with "PIE_RESERVED"

                    for(i = 0; i <= 12; i++)

                        Dest[i] = (UINT32) Source;

     

                    Source = (void *) ILLEGAL_ISR;

     

                    // Fill the remaining vector table locations with "ILLEGAL_ISR"

                    for( ;i < 128; i++)

                        Dest[i] = (UINT32) Source;

                           

                    // Now assign the required ISR to the vector table                

        strPieVectTable.TINT2           = CtTimerTwoIsr;    // CPU-Timer2

                    strPieVectTable.XINT1           = Xint1Isr;

                    strPieVectTable.ADCINT       = AdcIsr;               // ADC

                    strPieVectTable.TINT0           = CtTimerZeroIsr;    // Timer 0

                    strPieVectTable.SCIRXINTB = ScibRxIsr;     // SCI-B

                    strPieVectTable.SCITXINTB = ScibTxIsr;     // SCI-B

     

                    EDIS;

                }

    Thanks & Regards

    Vishnu beema