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.

Compiler/TMS320F28335: MISRA and C28x fastRTS sincos

Part Number: TMS320F28335

Tool/software: TI C/C++ Compiler

I'm using the fastRTS Library in my project to call the sincos function as follows:

     float sinVal = 0.0;
     float cosVal= 0.0;
     float thetaVal = 3.1415;
     sincos(thetaVal, &sinVal, &cosVal);

The code compiles and works fine but I get the following warning when doing a MISRA check:

#1394-D (MISRA-C:2004 10.2/R) The value of an expression of floating type shall not be implicitly converted to a different type if the expression is a function argument

What's the correct way to call this function to avoid this warning?

  • Hi Arturo,

    The function protype is void sincos(float32 X, float32* PtrSin, float32* PtrCos); can you make the arguements match the prototype of the function and see if the MISRA violation goes away ? 

    thanks

    Aravindhan

  • If I open the declaration of sincos I find the function prototype as well as the typedef for a float32:

    #ifndef DSP28_DATA_TYPES
    #define DSP28_DATA_TYPES
    typedef int                 int16;
    typedef long                int32;
    typedef long long           int64;
    typedef unsigned int        Uint16;
    typedef unsigned long       Uint32;
    typedef unsigned long long  Uint64;
    typedef float               float32;
    typedef long double         float64;
    #endif
    
    void sincos(float32 radian, float32* PtrSin, float32* PtrCos);

    So for this processor I would think a float is the same as a float32. In any case, I changed the function and still get the same MISRA violation:

      float32 PtrSin    = 0.0;
      float32 PtrCos    = 0.0;
      float32 radian  = 3.1415;
      sincos(radian, &PtrSin, &PtrCos);

     

  • Hi Arturo,

    I read through the rule 10.2 and I am not able to understand why this line is throwing error for MISRA. I asked you to make the types same so the MISRA checker can easily check the type match. Which tool are you using to run MISRA ? and also which version of TI compiler you are using. Let me know.

    Thanks
    Arav
  • I'm using CCS v7.3.0.00019 and running the built in check under CCS Build > C2000 Compiler > Advanced Options > MISRA-C:2004.The compiler version I was running is TI v16.9.4.LTS

    I was able to replicate the issue in a new project with the settings mentioned above. The warning went away when I changed the compiler version to TI v18.1.2.LTS. Was the MISRA checker updated with the new compiler version?