arm link scatter file

Hello guys,

I'm struggling with.a problem related to a scatter file, or at least I think it comes from there.So, I have a scatter file like follows:

MAIN_LOAD_REG 0x00000000 0x10000
{
    exec.bin +0 0x1500
    {
        Init.o (reset,+First)
        anon$$obj.o
        *(+RO)
    
    }
    
    ram_reloc 0x300000 0x1500
    {
        obj1.o
        obj2.o
        
    }
    
    ram_other_reloc 0x3001500 0x500
    {
        obj3.o
    }
    
    //RW,ZI sections....
    
    //ARM stack LIB .....

}

The use case is to let the linker to link the obj1,obj2,obj3 to those addresses and during the startup the code will be relocated.

To be able to relocate the code, I make use of Region$$Table$$Base which gives me the details of the sections. So each section has an entry like follows :

SRC->DEST->SIZE->UNKNOWN_PADDING

The issue is that UNKNOWN_PADDING (sometimes it is present, sometimes not).

What is the logic behind ?

Why is the entry aligned to 16 bytes ? I would like be aligned to 12 bytes.

  • I doubt that you can align to anything else then power of two.
    What size is the padding? I guess it aligns the section to a full multiple of 4.

  • Well, indeed I would like to be aligned to another size but how can I achieve this? I do not set explicitly the align size.

    The strange thing comes from another project in which this padding is not present. Does this padding have something in common with the size of the objects in that section ? I mean, the table is put right at the end of the first execution section. 

    The padding size is one word (4 bytes). The value of the padding is different when I add more objects in the section. In fact I do not care about the padding value, I just want to remove the padding for each entry in the table to be aligned to 12 bytes ( SRC(4bytes) + DEST(4bytes) + SIZE(4bytes)).