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;
What is the difference between these declarations: #define tSetupPacket (* (tDEVICE_REQUEST xdata *)0xFF00) tDEVICE_REQUEST xdata tSetupPacket _at_ 0xFF00; Well, the first is not a declaration. It is a macro. There is no symbolic information generated for it and it cannot be referenced by name in a debugger. There is no memory space reserved for the object, so the link could actually place other objects at address 0xFF00. The second is an absolute declaration. The object is not initialized (and is filled with 0's according to ANSI specification). Space for the object is reserved and a symbolic name is generated. This variable can be viewed or watched by name in a debugger. Jon
Thanks. All you agree that the second form is a valid one. Nevertheless, it is always zero, i.e. writing to the structure's fields does not modify it. So, something is still wrong.
View all questions in Keil forum