for a project with a CY8Y5856 with a display I need to store lots of text to be displayed.
How can I put the text into the program memory so that it does not waste RAM?
The text should be stored in a struct or at least in an array.
there will be about 400 "strings" of 20 bytes each (several languages on the display).
It seems that the "const" keyword does the job for PSoC5LP.
Re the ARM compilers -
I would have liked to see a different solution like a "flash" qualifier, but GCC developers have choosen a different solution. Now the "const" qualifier has two different meanings depending on the context it appears.
Used in a parameter-list the consequences are: the parameter will not be modified by a direct assignment.
Used in a variable declaration and followed by an initialization the variable will be put into the code area which will be flash memory in all embeddeds.
This improvement is not ARM specific but works in GCC generally.
http://www.keil.com/support/docs/2829.htm Abs variable location Keil and ARM GCC
Actually its not really something gcc invented. The different meanings of const are defined in the C / C++ standards. Its merely an optimization gcc can do that const strings / fields can be put to flash memory.
Like I said, the C/C++ standard addresses the different semantics of const (namely that the affected variable / field is not to be modified, and depending on context is either a requirement or a guarantee).
GCC (when compiling for embedded environments) uses this information to handle variable placement in flash or volatile memory. So in that sense GCC has added an additional meaning to const, but it still has the other one as before.
Excerpt from AN89610 www.cypress.com/