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.
I was wondering if there is a way to exclude the floating point libraries using calls to printf while I am using fixed point math and have no need for floating point math?
"FPkill"
just copy the FP .h file and make all functions 'live' { while(1): }
when a function exist the library is not called
Erik
Thanks for the quick response. Where is the FP.h file? I have an older version of the compiler (8.12) so it might be a different file name? Or do I have to have the full version of the Keil tools?
The whole point of a Library is that, if you don't use a function, it is not included in the build.
FP functions won't be included unless you actually use them.
http://www.keil.com/support/man/docs/c51/c51_lib_files.htm
FP functions won't be included unless you actually use them. is that so? does the library function 'know' if calls to printf use fp or not? I would think that in the printf code, somewhere there will be if (){ fp_something();
which will cause the fp libraty to be included
I have to agree with Mr. Malund on this one as my listing clearly shows that the floating point functions are built and part of the code space. At risk of repeating myself, I don't use any floating point math anywhere in my code and the libraries are now included since I started using the printf to format my output to my terminal interface.
Where is the FP.h file? nowhere, fp.h represent whatever the .h file for the fp functions is named, I am (waiting for IT dept) w/o a uVision for a day or so.
http://www.keil.com/support/man/docs/c51/c51_lib_files.htm seems to be where you need to go
I'd try nodefaultlibrary and include the one w/o fp that match the model you use, my guess would be it has dummies for the fp functions (otherwise printf would not work with the eval, and I have not heard it don't)
Yes - that's why you can do this in the Free Eval:
printf( "Hello, world %d", 10 );
But not this:
printf( "Hello, world %f", 10 );
Anyhow, the Map file shoul show where any FP is getting used...?
This is how you begin to appreciate the way it's done by IAR: they provide several versions of printf and scanf with varying functionality and size.
well. the choice wont be made like that. the thing that links the fp to printf is likely a float parameter.
else the code
could be circumfented by sumthing like
. . char buf[64]; char *dummy; strcpy(buf,"Hello, world %f"); dofrig(buf); . . void dofrig ( const char * dummy ) { printf( dummy, 10 ); }
point is compiler puts necesary info into obj for linker to make intelagint decision. the librery function knows squat didley.
Always yo're freind.
Zeusti
(wondering what fellow expert will wine about code layout and acurecy and miss the point?)
In the thread http://www.keil.com/forum/2741/ Jon states that there are two different versions of the printf routine, but does not describe how to choose which one gets called. It's an old thread. Is it still the case that there are two versions?