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.

TMS320F280049C: How to inline Assembly funtion to CLA background task when Optimizing is on

Part Number: TMS320F280049C
Other Parts Discussed in Thread: C2000WARE

I am working on a project use CCS10.3,and I wish to run PI control in CLA background task.PI control code was write with Assembly.

Here's the problem:when I turn the Optimizing on(--opt_level 1(or 2,3,4)),a error  been occurred: #99923 "../cla_ex4_pwm_control_cla.cla", line 533: CLA does not permit function calls in background tasks. Try inlining function.

There's no problem if Optimizing is off,but execute time of code in CPU almost double.

So,is there a way to inline Assembly fuction to CLA background task?

  • Hi SH Feng,

    I tried this out on CCS 10.2 and saw the compiler error even at optimization level 0. Background tasks are not allowed to have function calls.

    To use the PI code in the background task, you can call the inline functions defined in the DCLCLA.h header file. The details of the functions can be found in the DCL User's Guide in your C2000Ware installation.

    Thanks,

    Ashwini

  • Hello Ashwini Athalye,

     Thanks for your help.I noticed inline C function take much more cycles when run(ex:PI_L1 34 cycles & PI_L2 118  cycles).

    I tried remove "background" statement at background task,and compile succeed.

    So i have an idea if  assembly fuction have to use in CLA background task:1.Remove "backgound" statement of background task. 2.Diable interrupt before  assembly fuction call,turn it back when  assembly fuction finished.

    Does this solution will make some error in code execute(except response time of other CLA task)?

     

  • Hi SH Feng,

    Regarding your suggestion, if you are not using Task 8 as background task , then in that case, no need to have the interrupt disable/enable. CLA tasks (except background task) cannot be interrupted and will always run to completion. Background task is the only CLA task that can be interrupt by another task and will be kept pending till that other task completes. 

    Thanks,
    Ashwini

  • Hello Ashwini Athalye,

    I still use a task as background task,just don't have the "background" statement,this task have  assembly fuction call(runPI_L1,before this call disable interrupt,enable interrupt when call complete).I tried this method and compile succeed.

    If this background task is running,is it interruptble?If interruptable,does some mistake will happen in background task or other task?

     

  • Hi SH Feng,

    The background keyword is required to make task as background task. See section 10.2.2 of the C2000 Optimizing C/C++ Compiler Guide

    https://www.ti.com/lit/ug/spru514r/spru514r.pdf

    Thanks,

    Ashwini