17.2.2 Address Function Attribute
The address(addr) attribute
specifies an absolute physical address at which the attributed routine will
be placed in memory. It can be used with C and C++ functions.
address attribute specifies an absolute virtual address for
the function. Be sure to specify the address attribute
using an appropriate virtual address for the target device. For
example:__attribute__((address(0x460000))) void bar (void);The compiler performs no error checking on the address. The section containing the function will be located at the specified address regardless of the memory-regions specified in the linker script or the actual memory ranges on the target device. The application code must ensure that the address is valid for the target device.
Sections used to hold functions placed at an absolute address will use a name
.address.N.decl,
where N is the address and
decl is the name of the
declaration.
To make effective use of absolute sections and the new best-fit allocator,
standard program-memory and data-memory sections should not be mapped in the
linker script. The built-in linker script does not map most standard
sections such as the .text, .data,
.bss, or .ramfunc sections. By not
mapping these sections in the linker script, we allow these sections to be
allocated using the best-fit allocator rather than the sequential allocator.
Sections that are unmapped in the linker script can flow around absolute
sections, whereas sections that are linker-script mapped are grouped
together and allocated sequentially, potentially causing conflicts with
absolute sections.
