Keil Logo

The _at_ Keyword

The _at_ keyword allows specifying an address for uninitialized variables. Use the keyword in definitions only. The examples demonstrate the use of the keyword for different variable types.

struct link  {
  struct link idata *next;
  char        code  *test;
};

struct link idata list _at_ 0x40;     /* list at idata 0x40 */
char xdata text[256]   _at_ 0xE000;   /* array at xdata 0xE000 */
int xdata i1           _at_ 0x8000;   /* int at xdata 0x8000 */
char far ftext[256]    _at_ 0x02E000; /* array at xdata 0x03E000 */

void main ( void ) {
  link.next = (void *) 0;
  i1        = 0x1234;
  text [0]  = 'a';
  ftext[0]  = 'f';
}

Refer to Absolute Variable Location for more information about the _at_ keyword.

Note

  • With Dallas Contiguous Mode it is impossible to locate arrays above 0x7F0000.
  • If you use the _at_ keyword to declare a variable that accesses an XDATA peripheral, you may require the volatile keyword to ensure that the C compiler does not optimize out necessary memory accesses.
  • When the _at_ keyword is used to locate far variables, the most significant byte of the specified address is converted into a memory type byte to determine the location of the object.
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.