This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F280039C: Difference of ALIGN(4) and ALIGN(8) in the linker command file

Part Number: TMS320F280039C
Other Parts Discussed in Thread: C2000-GANG, UNIFLASH, C2000WARE

Dear Champs,

I am asking this for our customer.

In the past we saw the example .cmd files usually use ALIGN(4) for codes including C28 and CLA codes, and the user has used ALIGN(4) for more than one year and it works well. They have even make some of them into production.

Now, we notice newer examples are "usually" with ALIGN (8) rather than ALIGN (4).

   .cinit           : > FLASH_BANK0_SEC1, ALIGN(4)
   .text            : >>FLASH_BANK0_SEC2 | FLASH_BANK0_SEC3 | FLASH_BANK0_SEC4 | FLASH_BANK0_SEC5 | FLASH_BANK0_SEC6 | FLASH_BANK0_SEC7 | FLASH_BANK0_SEC8 | FLASH_BANK0_SEC9 | FLASH_BANK0_SEC10 | FLASH_BANK0_SEC11 | FLASH_BANK0_SEC12 | FLASH_BANK0_SEC13 | FLASH_BANK0_SEC14 | FLASH_BANK0_SEC15, ALIGN(4)
   codestart        : > BEGIN, ALIGN(4)

   .stack           : > RAMM0_1
   .switch          : > FLASH_BANK0_SEC1, ALIGN(4)

   .init_array      : > FLASH_BANK0_SEC1,       ALIGN(4)
...
   .const           : > FLASH_BANK0_SEC4       ALIGN(4)


...
   .reset           : > RESET,          TYPE = DSECT /* not used, */

   dclfuncs         : > FLASH_BANK0_SEC1,     ALIGN(4)

   .TI.ramfunc      : LOAD = FLASH_BANK0_SEC1|FLASH_BANK0_SEC2 | FLASH_BANK0_SEC3 | FLASH_BANK0_SEC4 | FLASH_BANK0_SEC5 | FLASH_BANK0_SEC6 | FLASH_BANK0_SEC7 | FLASH_BANK0_SEC8,
                      RUN = RAMGS0_1_2_3 | RAMLS0_1_2_3_4_5,
                      LOAD_START(RamfuncsLoadStart),
                      LOAD_SIZE(RamfuncsLoadSize),
                      LOAD_END(RamfuncsLoadEnd),
                      RUN_START(RamfuncsRunStart),
                      RUN_SIZE(RamfuncsRunSize),
                      RUN_END(RamfuncsRunEnd),
                      ALIGN(4)

    // CLA specific sections
    Cla1Prog        : LOAD = FLASH_BANK0_SEC2 | FLASH_BANK0_SEC3 | FLASH_BANK0_SEC4,
                      RUN = RAMLS6,
                      LOAD_START(Cla1ProgLoadStart),
                      RUN_START(Cla1ProgRunStart),
                      LOAD_SIZE(Cla1ProgLoadSize),
                      ALIGN(4)

...

   .const_cla      :  LOAD = FLASH_BANK0_SEC2 | FLASH_BANK0_SEC3 | FLASH_BANK0_SEC4,
                      RUN = RAMLS7,
                      RUN_START(Cla1ConstRunStart),
                      LOAD_START(Cla1ConstLoadStart),
                      LOAD_SIZE(Cla1ConstLoadSize),
                      ALIGN(4)


                         /* crc/checksum section configured as COPY section to avoid including in executable */
   .TI.memcrc          : type = COPY

Questions:

1. In theory, ALIGN(4) should mean 4x 16 bit = 64-bit aligned, which is the minimum alignment for flash API usage. In this way, ALIGN(4) should be enough for better code size efficiency than ALIGN(8). Is my understanding correct?

2. In my understanding, ALIGN(8) is only better for some 3rd party flash programming tools, which may use 128-bit alignment as minimum data reading/programming. Do you think so too? Or do you have different comment?

3. Does C2000-GANG support ALIGN(4)? Or any concern here? The use will use only C2000-GANG and XDS110+Uniflash. If so, do they need to change to ALIGN(8)?

4. The user wants better code size efficiency in this case. This is why they want to use ALIGN(4) if there is no concern. Do you have any concern or agree to this?

  • Dear Champs,

    Any update?

  • Flash needs 128 bit alignment. hence we use ALIGN(8)

    Regards,

    Veena

  • Dear Veena,

    Is there any doc describing flash needs 128 bit alignment?

    From 

    C:\ti\c2000\C2000Ware_4_03_00_00\libraries\flash_api\f28003x\docs

    It seems 64-bit alignment (ALIGN 4) is required, but 128bit alignment (ALIGN 8) is optional and suggested with 3rd party tools.

    But the user is asking if they only use TI tool (XDS110+Uniflash, C2000-GANG), shouldn't they use ALIGN 4 for better code size efficiency?

  • Wayne,

    It will be best if Vamsi answers this. He is currently OOO, but I have brought this thread to his attention.

    Appreciate your patience.

    Thanks,

    Sira

  • Wayne,

    If customer uses only CCS flash plugin and Uniflash, then ALIGN(4) is fine.  This will save some memory for them when there are too many sections in their linker command file.  If the number of sections are not too many, then ALIGN(8) is better - in future, if the customer wants to move to any other 3rd party tool for any reason, ALIGN(8) will help.  This will also help to migrate to future devices that may restrict to ALIGN(8).

    However, for C2000-GANG (this is a 3rd party tool from Elprotronic), I suggest to go for ALIGN(8).

    I see your note that the customer already went for production using ALIGN(4):  As long as customer verified that the image programmed with the 3rd party tool and CCS is same, there should not be any issue.

    Thanks and regards,
    Vamsi