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
  • Before WW3 erupts again, I decided to see what it gives with the ARM's RealView compiler.

    Inserting this declaration,

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

    Generated this warning:

    main.c(315): warning:  #1207-D: attribute "__at" ignored
    

    (variable is defined somewhere else).
    So, Jack, this is so much according to the standard, how come the compiler generates a warning?

Reply
  • Before WW3 erupts again, I decided to see what it gives with the ARM's RealView compiler.

    Inserting this declaration,

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

    Generated this warning:

    main.c(315): warning:  #1207-D: attribute "__at" ignored
    

    (variable is defined somewhere else).
    So, Jack, this is so much according to the standard, how come the compiler generates a warning?

Children
  • The extern keyword is part of the standard.

    The __at keyword is not.

    So when you combine the two, the combination will not be part of the standard. In this, I agree with Erik. People should not push their luck too much.

    Another important thing is that embedded compilers (besides regularly adding non-standard features to better map to the processor and embedded use) are notorious for being less standards-compliant than "PC compilers". This comes for the much smaller customer base. Less people to catch bugs and design oops. But also often less resources to maintain the compiler.

    M$ has a way larger budget to keep their compilers updated. And their track record still shows how hard they have had with standards compliance.