Using Code Composer Studio for a MSP430 design, the compiler is giving me warnings recommending that I not use floating point math because it's processor intensive (or something to that effect). Sorry - I don't have the exact warning.
I am confused because the compiler seems to think that I want to use floating point math during run time, and I certainly do not. However, I do have some #defines that use some intermediate floating point values that eventually will be type cast into integer values for use at run time - or at least that is the plan. Here are the defines.
#define XTAL_FREQ 10000000UL
#define CORE_RESET_TIME (float)(0.000050)
#define MCLK_DIV 8UL
#define SMCLK_DIV 8UL
#define ACLK_DIV 256UL
#define MCLK_FREQ (XTAL_FREQ / MCLK_DIV)
#define SMCLK_FREQ (XTAL_FREQ / SMCLK_DIV)
#define ACLK_FREQ (XTAL_FREQ / ACLK_DIV)
#define ACLK_PERIOD ( (float)1/(float)ACLK_FREQ )
#define SMCLK_PERIOD ( (float)1/(float)SMCLK_FREQ )
#define TIMB1_CORE_RESET_CCR0 (unsigned short)(round(CORE_RESET_TIME / SMCLK_PERIOD))
Ultimately, the only value that is of any interest to me at run time is TIMB1_CORE_RESET_CCR0. This should calculate out to a value of 63 for use at run time. The floating point values are never referenced anywhere else in the code. How can I force the compiler to understand that this is not a run time calculation using floating point, but is instead a parametric way of calculating an integer constant for run time use ?