This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

string constants in XDATA

Hi,
In an attempt to free some code space, I'm looking at a couple of options;

a) preventing the compiler from automatically placing all string constants in the common code area (regardless of in which banks the strings are used) or

b) locating all string constants in XDATA. I gather I'll need to use OMF2 and STRING and maybe XCROM directives (and LX51). I'm missing something obvious with this option though, since the initialisation strings for these constants will have to be somewhere within the code, so where does the saving occur?

Has anyone experience or recommedations with either of these approaches?

Thanks,

David

Parents
  • "the initialisation strings for these constants will have to be somewhere within the code, so where does the saving occur?"

    It relies upon your target hardware having some non-volatile storage mapped into XDATA space.
    eg, the Triscend E5 has a linear external address space, and the 8051's CODE and DATA are mapped into this linear space.
    Thus, you can map 64K of the external ROM into CODE space, and a few K of the external ROM (containing your strings) into XDATA space.

    You can do this with all your const items - not just strings.

    You need to make sure that you have the updated OHX51 without this bug:
    http://www.keil.com/forum/docs/thread2074.asp

Reply
  • "the initialisation strings for these constants will have to be somewhere within the code, so where does the saving occur?"

    It relies upon your target hardware having some non-volatile storage mapped into XDATA space.
    eg, the Triscend E5 has a linear external address space, and the 8051's CODE and DATA are mapped into this linear space.
    Thus, you can map 64K of the external ROM into CODE space, and a few K of the external ROM (containing your strings) into XDATA space.

    You can do this with all your const items - not just strings.

    You need to make sure that you have the updated OHX51 without this bug:
    http://www.keil.com/forum/docs/thread2074.asp

Children
No data