You copied the Doc URL to your clipboard.

Explicit placement of a named section with scatter-loading

The following example shows how to place a named section explicitly using scatter-loading:

LR1 0x0 0x10000
{
    ER1 0x0 0x2000                   ; Root Region, containing init code
    {
        init.o (INIT, +FIRST)        ; place init code at exactly 0x0
        *(+RO)                       ; rest of code and read-only data  
    }
    RAM_RW 0x400000 (0x1FF00-0x2000) ; RW & ZI data to be placed at 0x400000
    {
        *(+RW)
    }
    RAM_ZI +0
    {
        *(+ZI)
    }
    DATABLOCK 0x1FF00 0xFF           ; execution region at 0x1FF00
    {                                ; maximum space available for table is 0xFF
        data.o(+RO-DATA)             ; place RO data between 0x1FF00 and 0x1FFFF
    }
}

In this example, the scatter-loading description places:

  • The initialization code is placed in the INIT section in the init.o file. This example shows that the code from the INIT section is placed first, at address 0x0, followed by the remainder of the RO code and all of the RO data except for the RO data in the object data.o.

  • All global RW variables in RAM at 0x400000.

  • A table of RO-DATA from data.o at address 0x1FF00.

Was this page helpful? Yes No