You copied the Doc URL to your clipboard.

Creating root execution regions

To specify a region as a root region in a scatter file you can:

  • Specify ABSOLUTE as the attribute for the execution region, either explicitly or by permitting it to default, and use the same address for the first execution region and the enclosing load region. To make the execution region address the same as the load region address, either:

    • Specify the same numeric value for both the base address for the execution region and the base address for the load region.

    • Specify a +0 offset for the first execution region in the load region.

      If an offset of zero (+0) is specified for all subsequent execution regions in the load region, then all execution regions not following an execution region containing ZI are also root regions.

    The following example shows an implicitly defined root region:

    LR_1 0x040000          ; load region starts at 0x40000   
    {                      ; start of execution region descriptions	      
        ER_RO 0x040000     ; load address = execution address
        {
            * (+RO)        ; all RO sections (must include section with 
                           ; initial entry point)
        }
        ...                ; rest of scatter-loading description
    }
    

  • Use the FIXED execution region attribute to ensure that the load address and execution address of a specific region are the same.

    You can use the FIXED attribute to place any execution region at a specific address in ROM.

    For example, the following memory map shows fixed execution regions:

    Figure 8. Memory map for fixed execution regions

    Figure 8. Memory map for fixed execution regions

    The following example shows the corresponding scatter-loading description:

    LR_1 0x040000              ; load region starts at 0x40000   
    {                          ; start of execution region descriptions	      
        ER_RO 0x040000         ; load address = execution address
        {
            * (+RO)            ; RO sections other than those in init.o
        }
        ER_INIT 0x080000 FIXED ; load address and execution address of this
                               ; execution region are fixed at 0x80000
        {
            init.o(+RO)        ; all RO sections from init.o
        }
        ...                    ; rest of scatter-loading description
    }
    

Examples of misusing the FIXED attribute

The following example shows common cases where the FIXED execution region attribute is misused:

LR1 0x8000
{
    ER_LOW +0 0x1000
    {
        *(+RO)
    }
; At this point the next available Load and Execution address is 0x8000 + size of
; contents of ER_LOW. The maximum size is limited to 0x1000 so the next available Load
; and Execution address is at most 0x9000
    ER_HIGH 0xF0000000 FIXED
    {
        *(+RW+ZI)
    }
; The required execution address and load address is 0xF0000000. The linker inserts
; 0xF0000000 - (0x8000 + size of(ER_LOW)) bytes of padding so that load address matches
; execution address
}

; The other common misuse of FIXED is to give a lower execution address than the next
; available load address.

LR_HIGH 0x100000000
{
    ER_LOW 0x1000 FIXED
    {
        *(+RO)
    }
; The next available load address in LR_HIGH is 0x10000000. The required Execution
; address is 0x1000. Because the next available load address in LR_HIGH must increase
; monotonically the linker cannot give ER_LOW a Load Address lower than 0x10000000
}

Was this page helpful? Yes No