location
Syntax
#pragma location={address|register|NAME}
Parameters
| The absolute address of the global or static variable or function for which you want an absolute location. |
| An identifier that corresponds to one of the Arm core registers |
| A user-defined section name—cannot be a section name predefined for use by the compiler and linker. |
Description
Use this pragma directive to specify:
The location—the absolute address—of the global or static variable whose declaration follows the pragma directive.
An identifier specifying a register. The variable defined after the pragma directive is placed in the register. The variable must be declared as
__no_initand have file scope.
A string specifying a section for placing either a variable or function whose declaration follows the pragma directive.Do not place variables that would normally be in different sections—for example, variables declared as __no_init and variables declared as const—in the same named section.
Example
#pragma location=0xFFFF0400
__no_init volatile char PORT1; /* PORT1 is located at address
0xFFFF0400 */
#pragma location=R8
__no_init int TASK; /* TASK is placed in R8 */
#pragma location="FLASH"
char PORT2; /* PORT2 is located in section FLASH */
/* A better way is to use a corresponding mechanism */
#define FLASH _Pragma("location=\"FLASH\"")
/* ... */
FLASH int i; /* i is placed in the FLASH section */See also
Controlling data and function placement in memory and Declare and place your own sections.