11.2 Locating Objects at a Specific Address

In this example, the C language array buf1 is located at an absolute address in data memory. The address of buf1 can be confirmed by executing the program in the simulator, or by examining the link map.
#include <stdio.h>
int __attribute__((address(0xa0000200))) buf1[128];
The equivalent array definition in assembly language appears below. The .align directive is optional and represents the default alignment in data memory. Use of * as a section name causes the assembler to generate a unique name based on the source file name.
       .globl buf1
	.section .bss.buf1, address(0xa0000200), bss
       .align 2
	.type buf1, @object
	.size buf1, 512
buf1:
	.space 512

Note that if another object is manually allocated to a section used for an absolute object (for example, using the section attribute), then only one of those objects will be found at the specified section link address. Consider a structure if there are multiple objects to be positioned and their order is important.