Hallo everybody, can anybody help me. I want to save Constants on the XRAM. How does this works?
I want to save Constants on the XRAM. What exactly do you want to accomplish ? Putting constants in XRAM does not make much sense except in fairly exotic circumstances (for example: All code memory is used and you want to store a table in XDATA that is generated by an algorithm at bootup). XDATA, on most devices, is volatile and will lose its contents during a power cycle. That aside, there is nothing that stops you from declaring a constant in XDATA
const char xdata myconst = 0xA5;
const char code myconst = 0xA5;
"Putting constants in XRAM does not make much sense except in fairly exotic circumstances (for example: All code memory is used and you want to store a table in XDATA that is generated by an algorithm at bootup)."
Another example would be where you have non-volatile memory in XDATA space.
If part of your ROM is mapped into XDATA space, that's where the XCROM directive comes in...
It'd help if you said what you're actually trying to achieve - then people could make informed suggestions!
View all questions in Keil forum