??? 03/04/08 13:47 Read: times |
#151872 - Use the extended keywords Responding to: ???'s previous message |
Andy Neil said:
So how do you get a something to be read-only, but not in CODE space? I would say by using the proper extended keyword, e.g. code. SDCC is one such compiler that moves const variables to code memory by default. But if you explicitly put it in xdata that is used instead. Andy Neil said:
Nothing came immediately to mind when I wrote that, which was why I didn't give any examples!
But, having thought about it, there are several possibilities: An XDATA memory-mapped read-only port; Allthough possible I doubt you meant this port to be const. As referenced by Tsuneo the const keyword is to help optimizations. The compiler could choose to read this port on startup and cache it in data memory. Andy Neil said:
ROM mapped into XDATA space;
If you needd a fast lookup table, where CODE space was too slow (obvisouly, only a small table). These I think are good examples of const in non-code space. Maarten |