Replies: 4 comments 1 reply
-
Nope, there is not. F() macro is an Arduino thing. There's no compiler directive because it's outside the realm of the compiler. GCC does not understand the multiple address spaces very well. I mean just look at the assembly listings. You see locations in program space listed as offsets from landmarks in the data space and vise versa. I would suggest regex find There is no way I could maintain these cores withoutextensive use of regexes. Regex's are IMO one of the most useful "languages" to know, because of these extreme versatility. Processing data to reformat it? Regex. Making .hex files more human readable? Regexes. Making mass changes to source code? regex. |
Beta Was this translation helpful? Give feedback.
-
Frankly, F() already Is a workaround. You don't wanna know what the non-arduino way to stuff strings into flash is. |
Beta Was this translation helpful? Give feedback.
-
Thank you Spence. I appreciate your advice and expertise. I used to have some rudimentary knowledge of regular expressions when I did a couple of small projects in Perl, about 8 years ago. I still have "Mastering Regular Expressions" on the bookshelf right above my desk. Sounds like it's time to do some new learning and re-learning. thanks, Paul |
Beta Was this translation helpful? Give feedback.
-
Terrific! Thanks Spence! |
Beta Was this translation helpful? Give feedback.
-
I like to use printf statements (in spite of the shortcomings). I used a lot of them for a project (help files). Of course I was reminded that strings, although compiled to flash, do get put into ram, chewing up a lot of ram. So I wrapped all those essentially constant strings in F(" ") and that solved the ram use problem.
Serial.printf(F("there are %d sides to a square\n"), 4);
But I wonder if there's some sort of global compiler directive that will cause all strings (those that are essentially constants, determined at compile time) to only be in flash and not get copied for ram? I mean the F(" ") works with Serial.printf, but I'd rather not include F(" ") in every printf statement, if it can be avoided.
Any suggestions or guidance as to a possible work-around?
Beta Was this translation helpful? Give feedback.
All reactions