Every time I use the F() macro like this
Serial.print(F("some text"));
I get this warning
Functions.ino:476: warning: only initialized variables can be placed into program memory area
Why is this?
Every time I use the F() macro like this
Serial.print(F("some text"));
I get this warning
Functions.ino:476: warning: only initialized variables can be placed into program memory area
Why is this?
What IDE version are you using? I'm using 1.0.5-r2 and I don't get that warning message.
With 1.5.7, I get this:
Sketch uses 1,854 bytes (5%) of program storage space. Maximum is 32,256 bytes.
Global variables use 188 bytes (9%) of dynamic memory, leaving 1,860 bytes for local variables. Maximum is 2,048 bytes.
el_supremo:
This thread might help: http://arduino.cc/forum/index.php/topic,102182.0.htmlPete
Thanks Pete, but it did not help. Now I get errors
/Applications/Arduino/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/Print.cpp: In member function 'size_t Print::print(const __FlashStringHelper*)':
/Applications/Arduino/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/Print.cpp:44: error: section attribute cannot be specified for local variables
/Applications/Arduino/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/Print.cpp:44: warning: 'section' attribute does not apply to types
I am using IDE 1.0.5 compiling for a Uno
I got that result too. However if you open up Print.cpp (where the error is) and change the following it will go away.
Change:
size_t Print::print(const __FlashStringHelper *ifsh)
{
const char PROGMEM *p = (const char PROGMEM *)ifsh;
to:
size_t Print::print(const __FlashStringHelper *ifsh)
{
const char *p = (const char *)ifsh;
The error message was about putting an attribute on a local variable (in this case "p"). Removing the attribute appears to fix it.
Great, Nick!
This worked