A custom section needs added to the linker script file with the fixed address that you want to use.
Quickly hacked example of far from complete linker section for GCC from linker script I had at hand:
MEMORY
{
...
MYTABLE = 0x7FFC;
...
}
.mtb : /* Micro Trace Buffer (MTB) memory buffer address as defined by the hardware */
{
. = ALIGN(4);
_mtb_start = .;
. = 1K; /* Allocate 1K of space for MYTABLE */
KEEP(*(.mtb_buf)) /* Need to KEEP MBT as not referenced by application */
. = ALIGN(4);
_mtb_end = .;
} > MYTABLE;
How do define it in C:
#define SA_MTB_ALIGNEMENT (64U) /* Alignment of the MTB buffer */
uint8_t __attribute__((section (".mtb_buf"))) mtb_buf[__SA_MTB_SIZE] __attribute__ ((aligned (SA_MTB_ALIGNEMENT)));
Make sure to align the table to a 4, 8, or 64 byte boundary as needed using the ALIGN directive to prevent bus faults on some parts.
BTW 0x7FFC seems like an unlikely address to use for all but the smallest of parts, it will collide with code in the .text section.