| |||
| Home > Using Scatter-loading Description Files > Examples of specifying region and section addresses > Creating root execution regions | |||
If you specify an initial entry point for an image, or if
the linker creates an initial entry point because you have used
only one ENTRY directive, you must ensure that the
entry point is located in a root region. A root region is a region
having the same load and execution address. If the initial entry
point is not in a root region, the link fails and the linker gives
an error message such as:
Entry point (0x00000000) lies within non-root region ER_ROM
To specify that a region is a root region in a scatter-loading description file you can either:
Specify ABSOLUTE,
either explicitly or by permitting it to default, as the attribute for
the execution region 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 designator (address) for the execution region and the base designator (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 execution regions, then they will all be root regions.
See Example 5.2.
Use the FIXED execution region
attribute to ensure that the load address and execution address
of a specific region are the same. See Example 5.3 and Figure 5.9.
You
can use the FIXED attribute to place any execution
region at a specific address in ROM. See Placing regions at fixed addresses for more information.
Example 5.2. Specifying the same load and execution address
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 description...
}
Example 5.3. Using the FIXED attribute
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 description...
}