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.

TMS320F280039C: EALLOW/EDIS not allowed in CLA background or a sub inline function?

Part Number: TMS320F280039C
Other Parts Discussed in Thread: C2000WARE

Dear Champs,

I am asking this for our customer?

The user uses CLA task8 as background task.

We found, such simple statement could not be used in the background task as long as EALLOW/EDIS are used.

1. Below codes in 

#pragma INTERRUPT(Cla1Task8_background, "BACKGROUND")
interrupt void Cla1Task8_background()
{

......

EALLOW;
GpioCtrlRegs.GPAMUX1.bit.GPIO0 = 0;
GpioCtrlRegs.GPAMUX1.bit.GPIO1 = 0;
EDIS;

.......

}

2. Below codes in a sub inline function called in the background task.

#pragma INTERRUPT(Cla1Task8_background, "BACKGROUND")

interrupt void Cla1Task8_background()
{

......

config_PWM_to_GPIO();

.......

}

#pragma FUNC_ALWAYS_INLINE(config_PWM_to_GPIO)
static inline void config_PWM_to_GPIO()
{
EALLOW;
GpioCtrlRegs.GPAMUX1.bit.GPIO0 = 0;
GpioCtrlRegs.GPAMUX1.bit.GPIO1 = 0;
EDIS;
// GPIO_setPinConfig(GPIO_0_GPIO0); this is not allowed either because EALLOW/EDIS are used inside.
}

The compiler errors are:

error #99923: CLA does not permit function calls in background tasks. Try inlining function.

Is EALLOW/EDIS not allowed in CLA background task?

If so, how does the user modify these registers protected by EALLOW in CLA background task?

Wayne Huang

  • Hi Wayne,

    for CLA sourcecode you have to use MEALLOW and MEDIS instead of EALLOW and EDIS.
    Look at TRM (spruiw9) Chapter 7.6.3 (page 835/836).

    Regards,

    Jan

  • Hi Jan,

    In C2000Ware header file, the EALLOW and EDIS macro are mapped apprpriately according to CPU type, so this is not the issue here.

    Here is the snippet:

    //
    // Define to allow writes to protected registers
    //
    #ifndef EALLOW
    #ifndef __TMS320C28XX_CLA__
    #define EALLOW __eallow()
    #else
    #define EALLOW __meallow()
    #endif // __TMS320C28XX_CLA__
    #endif // EALLOW

    Thanks,

    Ashwini

  • Hi Wayne,

    The EALLOW and EDIS are mapped to CLA compiler intrinsics which appear to be function calls hence you are seeing the error. Let me ask the Compiler team if there is some way these can be used in Background task.

    Thanks,

    Ashwini

  • Hi Wayne,

    Both the compiler team and I tried and we could not reproduce this issue - the compile worked just fine for background task and inline function. Can you let me know the compiler version and compiler optimization options being used?

    Thanks,
    Ashwini

  • Dear Ashwini,

    I used below to reproduce the user's behavior.

    CCS 11.0

    C2000ware V4

    Compiler V21.6.0.LTS

    --opt_level 1

    --opt_for_speed 3

    I also sent you the project to reproduce this issue.

    Let me know if you have any further question about reproducing this issue.

    Wayne Huang

  • Dear Ashwini,

    We tried to use __meallow() to replace EALLOW and __mdis() to replace EDIS, and it works now for the above two usages.

    So, the questions left are:

    1) You said below. Why does it not work?

     //
    // Define to allow writes to protected registers
    //
    #ifndef EALLOW
    #ifndef __TMS320C28XX_CLA__
    #define EALLOW __eallow()
    #else
    #define EALLOW __meallow()
    #endif // __TMS320C28XX_CLA__
    #endif // EALLOW

    2) If we use driverlib like GPIO_setPinConfig(GPIO_14_GPIO14);, which has EALLOW/EDIS inside, does it work on CLA side?

    (Now, it does not work on my side.)

    Wayne Huang

  • Hi Wayne,

    Thanks a lot for sharing the code. I will take a look.

    Regarding GPIO_setPinConfig(GPIO_14_GPIO14), this should work on CLA side as well, looking at the project you sent may offer some clues as to why it does not work for you.

    I will get back to you in a day or two at most.

    Thanks,

    Ashwini

  • Hi Ashwini,

    if you work with the CLA you have to consider other rules than with the CPU. Therefore the substitution of MEALLOW and MEDIS obsolute makes no sense.
    Instead of simplification, everything is unnecessarily complicated. The proof of this is obviously Wayne's problem.
    What is so difficult about using the CLA command set as well?

    Regards, Jan

  • Hi Jan,

    The application Wayne sent is including bitfield header file f28003x_device.h which unlike the driverlib header file maps the defines to C28 instrincs __eallow() and __edis() only. As a result the driverlib source code compiled for CLA does not work as the C28 defines are being picked up.

    The fix will be to update the f28003x_device.h. For example, for EALLOW, update the definition

    From (current):

    #define EALLOW __eallow()

     To:

    #ifndef EALLOW
    #ifndef __TMS320C28XX_CLA__
    #define EALLOW __eallow()
    #else
    #define EALLOW __meallow()
    #endif // __TMS320C28XX_CLA__
    #endif // EALLOW

    The software team has been notified of this issue.

    Thanks,

    Ashwini

  • Hello Ashwini,

    I am not a friend of this replacement.
    I want MEALLOW / MEDIS to appear in my CLA code and not EALLOW / EDIS (which are CPU instructions).

    Regards,
    Jan

  • Hi,

    Regarding using GPIO_setPinConfig on CLA, I would like to add that :

    1. GPIO control registers are not accessible by CLA. Only GPIO data registers are accessible by CLA.

    2. GPIO_setPinConfig is defined in a .c file, Hence it uses the C28x instructions. You can use the inline functions defined in the .h files in CLA code.

    Regards,

    Veena

  • Hi Jan,

    EALLOW and EDIS are macro names that are in the C code that can be called by both CLA and C28. The macro names reflect the C28 name as originally the code was written for C28. The macro will get mapped to the  CLA or C28 instruction based on whether the  CLA code is calling the C code (in which case __TMS320C28XX_CLA__ is defined by compiler) or by C28 code.

    Thanks,

    Ashwini

  • Hi Wayne,

    A issue has been filed with the software team to fix the bitfield header file.

    For now, you can update the bitfield header file f28003x_device.h with the EALLOW and EDIS definitions found in the driverlib file.

    Thanks,

    Ashwini