Placing data at an address

If you wish to place data (for example a buffer used by a peripheral) at a known address, you can use the following technique.

__attribute__ ((section(".myBuffer"))) unsigned char myBuffer[1024] ;

MEMORY
{
  /* Define each memory region */
  MFlash32 (rx) : ORIGIN = 0x0, LENGTH = 0x8000 /* 32k */
  RamLoc8 (rwx) : ORIGIN = 0x10000000, LENGTH = 0x2000 /* 8k */
  MyBufferRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x2000
}

    .myBuffer (NOLOAD):
    {
        *(.myBuffer)
    } > MyBufferRAM

Aligning data

Data can be aligned by using the following attribute:

__attribute__((aligned(32))) unsigned char my_data[1234] ;

PlacingData (last edited 2013-11-18 13:46:19 by DerekMorris)