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: CLA Implementation trouble

Part Number: TMS320F28379D
Other Parts Discussed in Thread: C2000WARE, POWERSUITE

Hello everybody,

I have trouble to implement CLA in my program, this is the situation :

-> My project is working correctly on flash in standalone mode with all periphericals which I need (ADC, PWM, CAN, GPIO, Timer, Interrupts etc) but I need to increase sample rate and my butterworth filters are too heavy for time calculation... so I want to put all filters on CLA.

-> I have modified compilation options with cla2 = on, predifined symbol 'CLA_C' and I have added CLA_MyPurpose.c,CLA_MyPurpose.cla and CLA_MyPurpose.h

-> Instead of "2837xD_FLASH_ink_cpu1.cmd" I have put "2837xD_FLASH_CLA_ink_cpu1.cmd"

-> I have used examples to make template with empty claTasks, empty claISR and configuration

My big trouble concern project build, first "__TMS320C28XX_CLA__" seems to not be defined by compiler (despite the presence of .cla file) so I have stdarg.h message error. Then I saw somewhere (I can't remember where) that if "__TMS320C28XX_CLA__" is defined, can.h can't be included => does it mean that CAN bus can't run if CLA is activated ?

I have also "cla1IsrX is undefined" for all 8 ISR despite the prototype declaration in .h (it's ok for claTaskX).

I f I am adding "__TMS320C28XX_CLA__" in predefined symbol I haven't this troubles but I have at least 100 errors with UintX undefined types ...

 

I also precise that compilation time is about 5min against 30sec for the same project without CLA config.

Could you help me please I am stuck.

Thank you very much and have a nice day,

Best regards,

Jérémy Bargas

  • LH: edit - corrected statement - <stdint.h> should be included to enable C99 types 

    Hi Jérémy,

    Jeremy Bargas said:
    I have modified compilation options with cla2 = on

    I believe this is what you have done, but to clarify in case not, the option should be --cla_support = cla2

    Jeremy Bargas said:
    My big trouble concern project build, first "__TMS320C28XX_CLA__" seems to not be defined by compiler (despite the presence of .cla file) so I have stdarg.h message error. Then I saw somewhere (I can't remember where) that if "__TMS320C28XX_CLA__" is defined, can.h can't be included => does it mean that CAN bus can't run if CLA is activated ?

    "__TMS320C28XX_CLA__" will only be defined by the compiler within CLA source code.  (i.e. in your case, within the file with the extension .cla).  Refer to the Predefined Macro Names section in TMS320C28x Optimizing C/C++ Compiler User's Guide (http://www.ti.com/lit/spru514).

    Jeremy Bargas said:
    I have also "cla1IsrX is undefined" for all 8 ISR despite the prototype declaration in .h (it's ok for claTaskX).

    These ISRs are for the C28x.  When a CLA task completes an interrupt is sent to the C28x and if enabled the C28x will take the ISR.  Refer to the .c file in the examples C:\ti\c2000\C2000Ware_<version>\driverlib\f2837xd\examples\cpu1\cla

    Jeremy Bargas said:
    I have at least 100 errors with UintX undefined types ...

    Standard C99 types are recommended.  (i.e. uint16_t, uint32_t etc).  These are defined in the standard <stdint.h> file.

    Jeremy Bargas said:
    I also precise that compilation time is about 5min against 30sec for the same project without CLA config.

    That is a very long time.  I suspect it is due to all of the error messages being printed. 

     

    Click here for more CLA FAQs and resources.

    If this resolves your issue, please click on the green "verified answer" button. Thank you!

  • Hi Lori, Thank you for you reply.

    -> Yes, it was a shorcut, I have indeed --cla_support = cla2 option.

    -> The problem is that the compiler seems to not automatically define the __TMS320C28XX_CLA__, even if there is .cla in my files.

    -> Yes I know about cla isr, for the moment I am not using it (they are empty functions) but also here the coplier didn't see them even their declaration.

    -> Ok, I will use c99 standard but stdfile.h is not found I will fix it. Moreover in lots of .h TI file, this is not C99 used, what is the better to do ?

    -> Ok.

    For information I am using Ti v18.12.2.LTS compiler and I have included f28xxx_project.h (where the message about stdarg is set).

    I am totally stuck, from where can I start ? does the memory copy (from flash to ram for CLA) is important for compilation ? I haven't put it for the moment but I don't think this is forbid the code compilation.

    Could you also say me if the CANbus is compatible with the CLA please ?


    Thank you very much and have a nice day.

    Best regards,
    Jérémy Bargas
  • Jeremy Bargas said:
    -> The problem is that the compiler seems to not automatically define the __TMS320C28XX_CLA__, even if there is .cla in my files.

    It doesn't depend on the presence of the file.  It depends on which file the macro is in.  The macro has file scope, not project scope.

    • Within a .c file the macro will not be defined.  A .c file is C28x C source code, therefore the macro is evaluated to not defined.
    • Within a .cla file the macro will be defined.   A .cla file is CLA C source code, therefore the macro is evaluated to defined.

    Refer to http://www.ti.com/lit/spru514 Predefined Macro Names.

    Jeremy Bargas said:
    -> Yes I know about cla isr, for the moment I am not using it (they are empty functions) but also here the coplier didn't see them even their declaration.

    If the linker reports "unresolved symbols remain" then check that the .c source is a part of your project.  A real quick check that I often use is to add some garbage text to the file and see if the compiler complains.  If it doesn't complain then the file is not part of the project.

    Jeremy Bargas said:
    -> Ok, I will use c99 standard but stdfile.h is not found I will fix it. Moreover in lots of .h TI file, this is not C99 used, what is the better to do ?

    The TI code has been moving to C99 data types.  The driverlib code uses stdint.h.

    <stdint.h> is the file that needs to be included.

    Jeremy Bargas said:
    I am totally stuck, from where can I start ? does the memory copy (from flash to ram for CLA) is important for compilation ? I haven't put it for the moment but I don't think this is forbid the code compilation.

    I suggest starting from the resources listed in the FAQ.  In particular the hands-on workshop and the example code. 


    The C28x has to initialize the CLA program RAM.  Without this the CLA tasks will not execute.  

    Jeremy Bargas said:
    Could you also say me if the CANbus is compatible with the CLA please ?

    Is the question can the CLA access the CAN bus?  Please refer to this FAQ: https://e2e.ti.com/support/microcontrollers/c2000/f/171/t/787665

    Regards

    Lori

     

  • Hi Jeremy,

    I haven’t heard from you for about a week, so I’m assuming you were able to resolve your issue. If this isn’t the case, please click the "This did NOT resolve my issue" button and reply to this thread with more information. If this thread locks, please click the "Ask a related question" button and in the new thread describe the current status of your issue and any additional details you may have to assist us in helping to solve your issues.

    Best Regards,
    Lori
  • Hi Lori,

    I am sorry for my delayed reply but it's not my only task in the company.

    I will work on this now, I think my big trouble is due to my inaccurate sources include way. I am using sources from c2000 ware, control suite, powersuite with redundancies which is not very clean.

    First I will try to handly include necessary files without CLA then I will try to add cla compile.

    Just to answer about CAN bus : no I don't want that the CAN access to CLA anymore, but I saw this on f2837xD_device.h from line 299:

    //

    // byte_peripheral attribute is only supported on the C28

    //

    #ifndef __TMS320C28XX_CLA__

    #if __TI_COMPILER_VERSION__ >= 16006000

    #include "F2837xD_can.h"

    #endif

    #endif

    Does it mean that if CLA is enabled, you can't add CAN sources ?

    Thank you very much I will come back soon.

    Best regards,

    Jérémy

  • Jeremy Bargas said:
    I will work on this now, I think my big trouble is due to my inaccurate sources include way. I am using sources from c2000 ware, control suite, powersuite with redundancies which is not very clean.

    Please do let me know if any content that is causing confusion or is not consistent so i can follow-up and get it corrected.

    Jeremy Bargas said:

    Just to answer about CAN bus : no I don't want that the CAN access to CLA anymore, but I saw this on f2837xD_device.h from line 299:

    //

    // byte_peripheral attribute is only supported on the C28

    //

    #ifndef __TMS320C28XX_CLA__

    Correct.  The byte_peripheral attribute is not supported currently for the CLA.  

    Jeremy Bargas said:
    Does it mean that if CLA is enabled, you can't add CAN sources ?

    It means that the content of this file does not apply to the CLA.  As I mentioned, the __TMS320C28XX_CLA__ macro has file scope. 

    • in a .cla (i.e. CLA source code) file __TMS320C28XX_CLA__ will evaluate to be true
    • in a .c file (i.e. C28x source code) __TMS320C28XX_CLA__ will evaluate to be false

    Regards

    Lori

  • Hi Jeremy,

    Is it ok if I close this thread? If you find that you have a follow-on question you can click the "ask a related question" or "ask a new question".

    Regards
    Lori