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

Variables that overlap in the same memory space possible?

Currently I have a set of structures represented as variables such as:

MYTYPE xdata A;
MYTYPE xdata B;
MYTYPE xdata C;
MYTYPE xdata D;
MYTYPE xdata E;
MYTYPE xdata F;
MYTYPE xdata G;
MYTYPE xdata H;


unfortunately E and G happen to not be used in this version of the software. Is it possible to force E and G to exist in the same space as F (for example)? Abusing the _at_ keyword seemed an exercise in futility (of COURSE it gives an error because you need a constant location that's an int for the compiler).

Any suggestions?
To answer WHY (which I'm sure was asked instantly) it's a matter of only having 1K of xdata space. This of course doesn't solve the issue if one needs to have ALL the variables. I'm just seeing what I can do without making a worse mess.

Thanks for listening (gritting teeth maybe?)

Stephen

Parents
  • unfortunately E and G happen to not be used in this version of the software. Is it possible to force E and G to exist in the same space as F (for example)? Abusing the _at_ keyword seemed an exercise in futility (of COURSE it gives an error because you need a constant location that's an int for the compiler).

    the simnple solution

    MYTYPE xdata A;
    MYTYPE xdata B;
    MYTYPE xdata C;
    MYTYPE xdata D;
    //MYTYPE xdata E;
    MYTYPE xdata F;
    //MYTYPE xdata G;
    MYTYPE xdata H;
    

    another solution

    MYTYPE xdata A;
    MYTYPE xdata B;
    MYTYPE xdata C;
    MYTYPE xdata D;
    #define E D
    MYTYPE xdata F;
    #define G F
    MYTYPE xdata H;

    what I would do

    MYTYPE xdata A;
    MYTYPE xdata B;
    MYTYPE xdata C;
    MYTYPE xdata D;
    #ifndef ABBREVIATE
    MYTYPE xdata E;
    #endif
    MYTYPE xdata F;
    #ifndef ABBREVIATE
    MYTYPE xdata G;
    #endif
    MYTYPE xdata H;
    

    Erik

Reply
  • unfortunately E and G happen to not be used in this version of the software. Is it possible to force E and G to exist in the same space as F (for example)? Abusing the _at_ keyword seemed an exercise in futility (of COURSE it gives an error because you need a constant location that's an int for the compiler).

    the simnple solution

    MYTYPE xdata A;
    MYTYPE xdata B;
    MYTYPE xdata C;
    MYTYPE xdata D;
    //MYTYPE xdata E;
    MYTYPE xdata F;
    //MYTYPE xdata G;
    MYTYPE xdata H;
    

    another solution

    MYTYPE xdata A;
    MYTYPE xdata B;
    MYTYPE xdata C;
    MYTYPE xdata D;
    #define E D
    MYTYPE xdata F;
    #define G F
    MYTYPE xdata H;

    what I would do

    MYTYPE xdata A;
    MYTYPE xdata B;
    MYTYPE xdata C;
    MYTYPE xdata D;
    #ifndef ABBREVIATE
    MYTYPE xdata E;
    #endif
    MYTYPE xdata F;
    #ifndef ABBREVIATE
    MYTYPE xdata G;
    #endif
    MYTYPE xdata H;
    

    Erik

Children
No data