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.

strange C2000 builder and code checking

Other Parts Discussed in Thread: TMS320F28335

Hello,

I'm writing a c code for the TMS320F28335 with CCS v4.2.4. I found something strange (for me) on my development system. The thing is:

- I declare a function in a header file:  void Set_Pwm_Duty(int Branch, float Value);

- My function in a c file is:

 void Set_Pwm_Freq(int Branch, int Value)
{
Period_PWM = (75e3 / Value);
...
}

I know this is a mistake but the builder (cl2000 compiler and linker) build all my project, and programs my chip without any error or warning (with Strict ANSI). but when I try my code it doesn't work. During debugging, I saw the parameters values are not correctly pass to the function. When I correct float in int in my declaration, my soft is working great, which is completely normal (I think).

The thing is, why the compiler say nothing about this mistake  even with the Strict ANSI??

Someone can help me to configure correctly my compiler, linker or this is normal that kind of mistake is not checked during building (I hope not)?

Thank you

Olivier Nasrallah

  • Olivier Nasrallah said:

    - I declare a function in a header file:  void Set_Pwm_Duty(int Branch, float Value);

    - My function in a c file is:

     void Set_Pwm_Freq(int Branch, int Value)
    {
    Period_PWM = (75e3 / Value);
    ...
    }

    I assume that you meant  Set_Pwm_Freq() to be the name of the function declared in the header file.

    I suggest including the header file not only in files where a declared function is used but also in the file where it is defined. Then, the compiler will complain about inconsistent definition and declaration.

    Regards, Johannes

  • Hi

    I enabled once (see image) the 'issue remarks' in my project and get some usefull warnings. Perhaps this option can help you?

    Regards Matt