alirezasafdari:
@krupski I am not really familiar with IDE manipulations and most stuff in that regard which you mentioned. I think the method you proposed has a lot of over head in run time.
I'm confused. You are "not really familiar" with how all this works, yet you assert that using the compiler properly creates a "lot of overhead in run time".
Now, I know that a lot of people feel that enabling floating point support uses a lot of extra flash memory. And, indeed it does use more flash, but not THAT much. I have yet to come anywhere close to filling all the flash.
Another thing which most people don't realize is that "floating point support" entails TWO DIFFERENT pieces of code that are linked into the program at compile time.
They are:
libprintf_flt.a
- ```
[b]libscanf_flt.a[/b]
The first one supports all of the printf related functions. The second one supports scanf, sscanf, etc... (functions that are rarely used).
Both of these utilize extra flash (and a bit of ram as well) space. The second one (scanf) uses the bulk of resources and is rarely if ever used.
The printf one, however, uses very little memory and therefore there is NO REASON to not use it. You can freely enable one, the other or both - doesn't matter.
If you want to try it without hacking anything, do this:
Go to your "[b]arduino_dir/hardware/tools/avr/avr/lib/[/b]
" directory.
Rename the file "[b]libprintf_min.a[/b]
" to "[b]libprintf_min.a.backup[/b]
".
Copy the file "[b]libprintf_flt.a[/b]
" to "[b]libprintf_min.a[/b]
"
Now, write a small sketch like this:
void setup (void)
{
char buffer [64];
double value = 123.45678;
Serial.begin (9600); // or whatever baud rate you want
sprintf (buffer, "You should see a number here --> %7.3f\r\n", value);
Serial.print (buffer);
}
void loop (void)
{
/* nothing */
}
Do you see what we did here?
We replaced the "minimum" printf code with the "floating point" printf code. Since you won't have printf enabled, you can test it by using sprintf to a buffer, then printing the buffer.
If it works, you should see this: "[b]You should see a number here --> 123.457[/b]
"
It not, you will get this: "[b]You should see a number here --> ?[/b]
"
To un-do the "hack", just rename those two files above back to what they were.
In fact, FIRST try the sketch above before doing the mod and see how much ram and flash is used, then do the mod and compare resource usage. You will see that it's a trivial amount.
Good luck