Assigning absolute location for a variable in PSoC 3's Keil compiler

Version 1
    Question: How do I locate a variable at an absolute location in PSoC 3 KEIL Compiler?



    Variables may be located at absolute memory locations in your C program source modules using the _at_ keyword. The usage for this feature is:

                                  <type> <memory_type> <variable_name> _at_ <constant>;


    type                 Is the variable type.
    memory_type    Is the memory type or memory area for the variable.
    variable_name   Is the variable name.
    constant           Is the address where the variable is located.

    Following example places integer variable at location 0x1000 in xdata space.

                              int xdata myVariable  _at_ 0x1000;

    The following restrictions apply to absolute variable location using the _at_ keyword:

    •   Absolute variables cannot be initialized.
    •   Bit variables may not be located at an absolute address.

    Note: To access XDATA peripheral registers using variables declared with the _at_ keyword, use the volatile keyword to ensure that the C compiler does not optimize out necessary memory accesses.

    Refer to KEIL compiler documentation for more details.