标签:assign inter res ted 访问内存 变量 出现 read_only his
Global Variable Address Modifier (@address)
You can assign global variables to specific addresses with the global variable address modifier. These variables are called ‘absolute variables‘. They are useful for accessing memory mapped I/O ports and have the following syntax:
Declaration = [@|@""]
[= ];
is the type specifier, e.g., int, char
is the identifier of the global object, e.g., i, glob
is the absolute address of the object, e.g., 0xff04, 0x00+8
is the value to which the global variable is initialized.
A segment is created for each global object specified with an absolute address. This address must not be inside any address range in the SECTIONS entries of the link parameter file. Otherwise, there would be a linker error (overlapping segments). If the specified ad