OK, I've read the documentation on the F() function and using the PROGMEM modifier. I have some questions now (which I'm sure have been previously answered but I did not find them readily via searches here).
- Are string literals in code stored in SRAM or referenced from flash?
Example:
if(a == "STRING LITERAL")
Is "STRING LITERAL" in SRAM or program space? I have tried if(a == F("STRING LITERAL")) and get compile errors because the result of F("STRING LITERAL") is obviously not char*.
-
What is the correct way for testing equality of a string against a string stored with F()?
-
What happens to the memory used by pulling a value with pgm_read_word (etc)? Are the return values of these functions newly allocated memory in SRAM? Are they register variables that go away on their own? Will using this technique result in memory leaks over time?
With so little RAM available I want to make sure I understand the ramifications of each of these things.