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

differences of absolute locations

I want an instance of a structure to be put at a specific address in xdata. What is the difference between these declarations:

#define tSetupPacket (* (tDEVICE_REQUEST xdata *)0xFF00)

tDEVICE_REQUEST xdata tSetupPacket _at_ 0xFF00;
It seems that the second behaves incorrectly.
There is also an opportunity to declare a structure at absolute locaiton by #pragma memory segments (supported by non-Keil C or Keil linker).
What is the best choice?

Parents Reply Children
  • All the fields of the setup packed defined by the second declaration are zeroes, while they are not.

    There is 1 more reason to love the first declaration style. These declarations can be used in H file. This means no extern import is required in C modules. Unfortunately I've faced a problem. I cannot declire an array using this style, i.e. the following does not compile:
    #define InEndpoints (* (tEDB[3] xdata *)0xFF48)
    where tEDB is a structure.
    Can you help me?