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.

CCS/TMS320F28374D: CLA & C28x variables in L2 : compiler issue , wrong data passing --> quite likely data pager issue

Part Number: TMS320F28374D

Tool/software: Code Composer Studio

HI everybody , 

I m on F28374D , using CCS8.1  and compiler 18.x  LTS . 

basically  I  use an area in L2  memory , CLA  writes  data  and  C28x  reads  the same variables  (  read and write properties are fixed  ) . 

now if I declare   CLA  variables  in  .cla  file   ,  issue is clear   : C28x  gets  wrong values  .

if I declare  CLA variable ISSUE in Strcture in L2 exchanging data from CLA.docx in a separate  file .c  like globalvariables.c   , C28x  reads data correctly.

in attach you get screenshots and more details .

could you confirm me  what I found  and proper way to declare Struct used in L2   by CLA ( write ) and C28x (read )

regards

Carlo

  • Hi,

    This is likely because of the difference in the sizes of data types between CLA and C28x. ints are different sizes.

    Please use the stdint.h types. This should fix your issue.

    sal
  • HI Sal ,
    I checked but it is not , Typedef is correct on both sides .
    I m sending you code offline .
    please coudl you kindly double check when using .cla or .c as my previous email , if it is causing same issue on your side ?
    thank you
    best regards
    Carlo
  • Carlo,

    I need more information. You should be able to debug this yourself with my tips/questions below.

    What are the locations the CLA is writing to?

    What are the locations the C28x is writing to?

    Where are these global variables mapped in the linker and .map files?

    The variables need to be declared in one place and externed in another. Every time I have used shared variables I have always declared them on the C28x side in a .c file and externed them for the CLA (.cla file).

    I am not sure, but this may be a requirement by the compiler. You should declare your globals in a .c C28x source file.

    sal
  • Please see Section 10 of the compiler guide: www.ti.com/.../spru514p.pdf

    10.2.2 C Language Restrictions
    There are several restrictions to the C language for CLA.
    Defining and initializing global/static data is not supported.
    Since the CLA code is executed in an interrupt driven environment, there is no C system boot
    sequence. As a result, global/static data initialization must be done during program execution, either by
    the C28x driver code or within a CLA function.
    Variables defined as const can be initialized globally. The compiler creates initialized data sections
    named .const_cla to hold these variables.

    sal
  • Hi Sal ,
    I need an official confirmation :
    this means we cannot instanciated global variables in .cla files , but ONLY in .c file ? yes or not ?
    sorry for pressure but customer for quality reasons needs an official reply on this
    Thank you
    regards
    Carlo
  • Hi Carlo,

    I confirmed with Code Gen Team. You need to declare and initialize global data which is shared on the C28x side, so in the .c files.

    sal
  • Hi Sal ,
    great !
    thank you very much for your great support
    best regards
    Carlo