I found this header file for PIC microcontrollers by the name of pic1250.h and I\'m unable to get the hang of some syntax used in it.
The source for the file is:
It's a compiler extension.
From PIC MPLAB XC8 compiler documentation (emphasis mine):
5.5.4 Absolute Variables
Most variables can be located at an absolute address by following its declaration with the construct @ address, where address is the location in memory where the variable is to be positioned. Such a variables is known as an absolute variables.
5.5.4.1 ABSOLUTE VARIABLES IN DATA MEMORY
Absolute variables are primarily intended for equating the address of a C identifier with a special function register, but can be used to place ordinary variables at an absolute address in data memory.
For example:
volatile unsigned char Portvar @ 0x06;
will declare a variable called Portvar located at 06h in the data memory. The compiler will reserve storage for this object (if the address falls into general-purpose RAM) and will equate the variable’s identifier to that address.
Note that MPLAB XC8 is not the only compiler to have the same @ construct to place an object in the specific memory location.
Another well known compiler is Freescale CodeWarrior (at least for HCS08).
Another one is IAR C Compiler (at least for MSP430 and AVR).
In addition to what has already been said, please note that the non-standard @ operator is a superfluous feature. You can achieve exactly the same behavior with standard C:
#define RTCC (*(volatile uint8_t*)0x0001u)
Since the variables in this case are hardware registers, you don't need to worry about allocation, they are already present in the hardware. If you want to allocate a variable at a custom address, there should be a linker file of some kind to fix that (since the @ operator only solves specific allocation for variables, not for code).
The main reason why many embedded compilers come up with some non-standard operator like @ is because they can't think outside the box when designing the debugger. They expect some sort of variable to be present in the object file which is fed to the debugger, but if you use #define, no such "debug information object" is allocated.
If the debugger looked at the source code instead, or better yet, had MCU awareness built-in, then non-standard code like this wouldn't be necessary. High quality tools from companies that focus solely on debuggers always come with built-in support for viewing register maps.
A short extension:
This is no longer working since xc8 2.0 and up. You now had to write:
unsigned char a __at(0x025);
to put a variable (a) at an absolute address (0x025).
With XC8 2.0 it is possible to compile your old code using the @ syntax if you set the compiler settings to use "C90" format. The setting looks like this, it is under "XC8 Global Options" and is called "C standard".
It's an extension in the PIC compiler, to place a variable at a specific memory position. No other compiler I know have that extension.