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.

TMS320F28379D: Code works from RAM, not from FLASH

Part Number: TMS320F28379D


I have some code that works well when running from RAM, but not when I try building from Flash.  I use the CLA.  The linker command files look to be correct, according to what I have read online.  The two CLA tasks trigger once, and then never again.  

The code startup, roughly:

EALLOW

Device_init();

Interrupt_initModule();

Interrupt_initVectorTable();

setupADCs();

setupGPIO();

setupPWM();

setupCLA();

Interrupt_register(INT_CLA1_1, &ISR_cla1_task1);
Interrupt_register(INT_CLA1_2, &ISR_cla1_task2);

ADC_setInterruptSource(ADCC_BASE, ADC_INT_NUMBER1, ADC_SOC_NUMBER1);
ADC_clearInterruptStatus(ADCC_BASE, ADC_INT_NUMBER1);
ADC_enableInterrupt(ADCC_BASE, ADC_INT_NUMBER1);

    calcOffsetsADC();

EDIS;

ADC_enableInterrupt(ADCC_BASE, ADC_INT_NUMBER1)

Interrupt_enable(INT_CLA1_1);

EPWM_clearEventTriggerInterruptFlag(EPWM2_BASE);
Interrupt_enable(INT_CLA1_2);
EINT;

while(1);

CLA Task 1 is triggered by ADCC Interrupt 1

CLA Task 2 is triggered by EPWM2

The CLA interrupt ISRs are

__interrupt void ISR_cla1_task1(void)
{

ADC_clearInterruptStatus(ADCC_BASE, ADC_INT_NUMBER1);

Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP11);
//
// Check if overflow has occurred
//
if(true == ADC_getInterruptOverflowStatus(ADCC_BASE, ADC_INT_NUMBER1))
{
ADC_clearInterruptOverflowStatus(ADCC_BASE, ADC_INT_NUMBER1);
ADC_clearInterruptStatus(ADCC_BASE, ADC_INT_NUMBER1);
}
return;
}

__interrupt void ISR_cla1_task2(void)
{

EPWM_clearEventTriggerInterruptFlag(EPWM2_BASE);
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP11);
return;
}

I see that both CLA tasks run one time.  I'm kind of at a loss as to what to look at next for this.  Any suggestions?

  • Please share the linker cmd file.

    Note that the cla program and const needs to be loaded to Flash and copied to the LSRAM at runtime.

    Regards,

    Veena

  • I am doing this:

    void setupCLA()
    {
    #ifdef _FLASH
        //
        // Copy CLA code from its load address (FLASH) to CLA program RAM
        //
        // Note: during debug the load and run addresses can be
        // the same as Code Composer Studio can load the CLA program
        // RAM directly.
        //
        // The ClafuncsLoadStart, ClafuncsLoadEnd, and ClafuncsRunStart
        // symbols are created by the linker.
        //
        memcpy((uint32_t *)&Cla1funcsRunStart, (uint32_t *)&Cla1funcsLoadStart,
                (uint32_t)&Cla1funcsLoadSize);
    
        memcpy((uint32_t *)&Cla1ConstRunStart, (uint32_t *)&Cla1ConstLoadStart,
                (uint32_t)&Cla1ConstLoadSize);
    #endif

  • Linker file uploaded:

  • FYI...I ended up manually verifying / modifying section assignments versus mainly re-using the existing linker cmd file copied from a TI sample project, and it seems to be working better.  Not sure exactly which part was the actual issue and fix.