5.27 Location Pragma

Use this pragma directive to specify:
  • The location—the absolute address—of the global or static variable whose declaration follows the pragma directive. The variables must be declared __no_init.
  • An identifier specifying a register. The variable defined after the pragma directive is placed in the register. The variable must be declared as __no_init and have file scope.
Note: There is no support in XC32 to set value to specific register.

Suggested Replacement

__attribute__((section, address))

Caveats

None.

Examples

Consider migrating IAR code such as:
#pragma location=0xFFFF0400 __no_init volatile char PORT1; 
to MPLAB XC codes similar to:
int foo __attrribute__((section("mysection"), address(0xA0001000)))

Further Information

None.