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/TMS320F280049M: Warning for using HRPWM in F280049 CLA while using LTS16.9.3

Part Number: TMS320F280049M
Other Parts Discussed in Thread: TMS320F280049

Tool/software: TI C/C++ Compiler

Hi Team,

  My customer reported an warning while using TMS320F280049 CLA for using HRPWM: Using "#Define" to define a variable in constant address, and while using “=”  operation to give the variable a value, and reported an warning "#173-D invalid type conversion".  Tried the float32 and int32 variable type, the warning still exist. The source code in in xx.cla file.

  Below figure shown the detailed information,  could you kindly give comments how to remove this warning? Expect for your reply, thanks.

Best Regards

Benjamin

  • On CLA the type of the constant 0x4052 is 32-bits (same as int) and the type of a pointer is 16-bits.  So a narrowing conversion occurs, and the compiler warns you about it.  You can avoid the warning by changing the #define to this ...

    #include <stdint.h>  // for uintptr_t
    #define DBFEDHRM1 (*(volatile unsigned long *) ((uintptr_t)0x4052))
    

    The type uintptr_t, from stdin.h, is the unsigned integer type that is the same width as a pointer.  On CLA, that is unsigned short.

    Thanks and regards,

    -George