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.

Compiler/MSP430F67691: Linker: unable to put .cinit into output section of a group

Part Number: MSP430F67691

Tool/software: TI C/C++ Compiler

My linker command file (in part) is

    GROUP > FLASH:
    {
        first_section
        {
            -lxxx.lib(.text, .const, .cinit) {}
        }
        second_section
        {
            *(.text)
            *(.const)
        }
    } crc_table(mdu_crc_table, algorithm=CRC16_CCITT)
    .cinit        : {} crc_table(mdu_crc_table, algorithm=CRC16_CCITT) > FLASH

This seems to work.  It creates a crc_table with three entries for first, second and .cinit sections.  I want to reduce this to two entries. I've tried to move ".cinit" into "second_section" using several different syntax, but all fail in some way.  For example

    GROUP > FLASH:
    {
       first_section
        {
            -lxxx.lib(.text, .const, .cinit) {}
        }
        second_section
        {
            *(.text)
            *(.const)
            *(.cinit)
        }
    } crc_table(mdu_crc_table, algorithm=CRC16_CCITT)

generates a #10068-D no matching section warning for *(.cinit) and doesn't applocate.cinit correctly.  Any suggestions?

  • For one thing, .cinit must be a contiguous section; you can't have two different output sections containing .cinit input sections.
  • Thanks for the suggestion. Are you referring to the .cinit in first_section? That may also be a problem, but when I remove .cinit from the first section I still get "no matching section."

    GROUP > FLASH:
    {
    first_section
    {
    -lxxx.lib(.text, .const) {} /* removed .cinit from here */
    }
    second_section
    {
    *(.text)
    *(.const)
    *(.cinit)
    }
    } crc_table(mdu_crc_table, algorithm=CRC16_CCITT)
  • While I'm not certain, I'm pretty sure the .cinit input sections must be collected together into an output section also named .cinit.  They cannot be combined with other input sections into some output section of a different name.  I'll check on that and get back to you.

    Thanks and regards,

    -George

  • My last answer is partly correct, and partly wrong.

    Please see the section titled Variable Initialization in the MSP430 Embedded Application Binary Interface.  You'll learn that there must a distinct output section for the purpose of variable initialization.  The section name is not strictly part of the specification, but by violating the near universal convention of naming this section .cinit, you are likely to create more problems than you solve.  The .cinit output section cannot contain anything from yet other input sections.  The section type is SHT_TI_INITINFO, and no other output section can be this type.

    Thanks and regards,

    -George