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

assign an absolute memory location

I am kind of confused about using the _at_ keyword to assign a specific address to a variable.

so for example :

extern xdata char variable _at_ 0x000f;

it fills 3 bytes in xram . can any one explain how is the compiler handling these sequence. Thank you !

Parents
  • I stand corrected re verbiage

    Thank goodness for that.

    however the reason I stated for the problem (extern combined with _at_) was correct and the OP changed accordingly and now states "it works".

    Well actually, the problem reported was this:

    it fills 3 bytes in xram

    And you replied:

    it fills 3 bytes in xram is definitely wrong, but not the issue

    Yet you are now claiming it was intended as a fix for the issue. Can you explain?

Reply
  • I stand corrected re verbiage

    Thank goodness for that.

    however the reason I stated for the problem (extern combined with _at_) was correct and the OP changed accordingly and now states "it works".

    Well actually, the problem reported was this:

    it fills 3 bytes in xram

    And you replied:

    it fills 3 bytes in xram is definitely wrong, but not the issue

    Yet you are now claiming it was intended as a fix for the issue. Can you explain?

Children
  • when the mistake is glaring, I usually provide a hint rather than a solution (I know that a hint will lead to better understanding if the asker work on the hint), then when both the OP and you gave up I posted

    the _at_ must be ... not in an extern

    and, amazing to you, I am sure, the 3 byte issue disappeared

    Erik

  • Jack, Erik,
    I need to apologize to you. My posted test above was wrong in the sense that when using the RealView compiler, one should make the declaration like this:

    extern int variable __attribute__((at(0x8000))) ;
    

    and not like the original version, which was

    extern int variable __attribute__((__at(0x8000))) ;
    

    when the first one is used - no warning is generated!