[ABANDONED] alignement is ignored by linker

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [ABANDONED] alignement is ignored by linker

    Hello,

    I use SES 4.52a and SEGGER Linker in my project.

    I use MemoryMap.xml file to define Memory Segment :

    Source Code

    1. <MemorySegment name="APP_Code_region_ROM" start="0x08010000" size="0x70000" alignment="16" access="ReadOnly" />
    2. <MemorySegment name="APP_region_RAM1" start="0x20001000" size="0x1F000" access="Read/Write" />
    3. <MemorySegment name="APP_region_RAM2" start="0x20020000" size="0x8000" access="Read/Write" />
    And I use .icf file to define section.

    Source Code

    1. define block vectors with alignment=512 { section .vectors };
    2. place at start of FLASH { block vectors }; // Vector table section

    In this exemple, if I build, the alignement=512 instruction is ignored by the linker. The real size of vectors is 404 bytes and the linker place the code directly after the vector and not after the the alignement instruction.
    vector : 0x0801000 to 0x08010193 instead of 0x0801000 to 0x08010200.

    If I use the keep instruction, she is also ignored by the linker.

    Source Code

    1. keep { block vectors };

    The .map file shows an alignment of 2 or 4 but never beyond.

    This problem is found in the following case too.

    Source Code

    1. place in FLASH with fixed order, alignment=16 { section .init, section .init.*, // Init code section
    2. section .init_rodata, section .init_rodata.*, // Init read-only section
    3. section .text, section .text.*, // Code section
    4. section .rodata, section .rodata.*, // Read-only data section
    5. section .segger.*, // Auto-generated initialization
    6. block exidx, // ARM exception unwinding block
    7. block ctors, // Constructors block
    8. block dtors // Destructors block
    9. };


    Have you ever encountered this problem ?

    Thank you for you reply
    Hardware and Software Developer.
  • Hello,

    Thank you for your inquiry,
    The alignment option will only check if the start address of a section is aligned to that value. It will not affect the size of the section.
    If you want to set a specific size you can do as follows:

    Source Code

    1. define block vectors with size = 1024, alignment = 512 { section .vectors };
    This will set the vectors block to a fixed size of 1024 bytes and check for alignment of the start address to be aligned to 512 bytes.
    Does that work for you?

    Could you elaborate what you mean to achieve with the keep attribute? Is this also related to setting a fixed size of the vectors area or is it related to something else?

    Best regards,
    Nino
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.