We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi,
My problem is that I have integer constants coded as compile-time constant floating equations to avoid having to use the floating point library... let me explain...
Take some code that does not use floating point operations - say:
void main(void) { unsigned int i = 1000; for (; i; i--) ; }
Under Projects / Options / C/C++ / Misc Controls: add the directive:
--fpu=none
since we don't need FPU support.
Like this, the program will compile.
Now, ask the compiler to do some compile-time floating-point calculation that results in an integer - insert at head of file:
unsigned int j = (unsigned int)(1.0*3.0);
The RealView compiler refuses to compile the line, even though we don't need FP support at run-time.
Is there a way round this?
I like Hans-Bernhard's suggestion, but also you could just remove the "--fpu=none" statement.
All the statement does is cause an error when you try and use a floating-point type. It does not actually make your code any smaller. (At least it does not for mine). It is fully a "compile time" option and not a "run time" or "Code Generation" option.
... just remove the "--fpu=none" statement.
Interesting... without this, I get inclusion of the libraries and the FP library is initialised.
Thanks for the suggestions, guys - I will try both.
Sorry if your target includes floating point libraries behind the scenes. If I do not use floating point calulations at run time, no support is added in my builds (and therefore also not initialized). (My target is STR71X). It would be interesting to know why it is including floating point libraries AND initializing them if you are not using them. Maybe your map file would give a hint as to why they were being included. Maybe not.