| |||
| Home > Formal syntax of the scatter file > Scatter files containing relative base address load regions and a ZI execution region | |||
You might want to place Zero Initialized (ZI) data in load region LR1, and use a relative base address for the next load region LR2, for example:
LR1 0x8000
{
er_progbits +0
{
*(+RO,+RW) ; Takes space in the Load Region
}
er_zi +0
{
*(+ZI) ; Takes no space in the Load Region
}
}
LR2 +0 ; Load Region follows immediately from LR1
{
er_moreprogbits +0
{
file1.o(+RO) ; Takes space in the Load Region
}
}
Because the linker does not adjust the base address of LR2
to account for ZI data, the execution region er_zi overlaps
the execution region er_moreprogbits. This generates
an error when linking.
To correct this, use the ImageLimit() function
with the name of the ZI execution region to calculate the base address
of LR2. For example:
LR1 0x8000
{
er_progbits +0
{
*(+RO,+RW) ; Takes space in the Load Region
}
er_zi +0
{
*(+ZI) ; Takes no space in the Load Region
}
}
LR2 ImageLimit(er_zi) ; Set the address of LR2 to limit of er_zi
{
er_moreprogbits +0
{
file1.o(+RO) ; Takes space in the Load Region
}
}