Search code examples
linkertexas-instrumentslinker-scriptscode-composerlinker-flags

How do I set the alignment for the whole project in CCSv5?


I need to set the linker alignment for a whole project in TI Code Composer Studio 5.5 (TI ARM compiler 5.1.1).

This is my linker .cmd file:

MEMORY
{
    BOOTROM:  o = 0x40020000  l = 0x0000C000  /* 48kB public boot ROM */
    SRAM:     o = 0x402F0400  l = 0x0000FC00  /* 64kB internal SRAM */
    L3OCMC0:  o = 0x40300000  l = 0x00010000  /* 64kB L3 OCMC SRAM */
    M3SHUMEM: o = 0x44D00000  l = 0x00004000  /* 16kB M3 Shared Unified Code Space */
    M3SHDMEM: o = 0x44D80000  l = 0x00002000  /* 8kB M3 Shared Data Memory */
    DDR0:     o = 0x80000000  l = 0x10000000  /* 256MB external DDR Bank 0 */    
}

SECTIONS
{
    .align            8

    .text          >  DDR0
    .stack         >  DDR0
                      RUN_START(stack_start)
                      RUN_END(stack_end)
    .bss           >  DDR0
                      RUN_START(bss_start)
                      RUN_END(bss_end)
    .cio           >  DDR0
    .const         >  DDR0
    .data          >  DDR0
    .switch        >  DDR0
    .sysmem        >  DDR0
    .far           >  DDR0
    .args          >  DDR0
    .ppinfo        >  DDR0
    .ppdata        >  DDR0

    /* TI-ABI or COFF sections */
    .pinit         >  DDR0
    .cinit         >  DDR0

    /* EABI sections */
    .binit         >  DDR0
    .init_array    >  DDR0
    .neardata      >  DDR0
    .fardata       >  DDR0
    .rodata        >  DDR0
    .c6xabi.exidx  >  DDR0
    .c6xabi.extab  >  DDR0    
}

The .align 8 did not do the job. In my resulting map file, I can see lots of symbols with addresses ending on 4 or C. If all the symbols were aligned to multiples of 8, I should get addresses that only end on 0 or 8.

What is the correct command to set the linker alignment to 64 bit?


Solution

  • Problem solved, courtesy of Mr George Mock, TI.

    He wrote the following example on e2e.ti.com:

    .text          >  DDR0 ALIGN(8)
    .stack         >  DDR0
                      RUN_START(stack_start)
                      RUN_END(stack_end)
                      ALIGN(8)
    /* ... and so on */