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.

problems linking a multi-file project with CCS 6.1.1

Other Parts Discussed in Thread: MSP430F5529

I'm using CCS6.1.1 to attempt to link a multi-file project.  When I proceed with the link, one of the files gives a "warning #10068-D: no matching section" when trying to link the .text segment.  Using ofd430, it shows that the object file has a valid .text segment, but still the linker fails to recognize it.

  • You might have a situation similar to the one discussed in this forum thread.  If not, then I need to see your linker command file, and I need to know which lines gets the diagnostic.

    Thanks and regards,

    -George

  • When I try to link to the thread, I get an "access denied" error.
  • One thing, when I initially started this project, I was using the unmodified lnk_msp430f5529.cmd file. The Linker would link some files, and completely ignore others. Adding in specific commands to include all the files that were required, provides me the error, although the object files exist, and appear to be ok.
  • I'm including a screenshot of a portion of the CCS screen

  • David Dudley said:
    When I try to link to the thread, I get an "access denied" error.

    Oops!  Sorry about that.  I fixed it in the original post.  Or, you can find it here.

    Thanks and regards,

    -George

  • I am unable to reproduce the no matching section error message.  But I can make some comments regarding the overall situation.

    David Dudley said:
    The Linker would link some files, and completely ignore others.

    We should determine why.  Is it possible that none of the functions in those files are ever called?

    David Dudley said:
    Adding in specific commands to include all the files that were required, provides me the error

    You shouldn't have to do that.  But if you do, this is the syntax to use ...

    .text
    {
       file1.obj(.text)
       file2.obj(.text)
       /* repeat as needed */
    
       /* Must include this line last.  It means all other input */
       /* sections named .text                                   */
       *(.text)
    } >> FLASH

    For more background on linker command file code, please see this wiki article.

    Thanks and regards,

    -George

  • If I include the filename inside a .text section, does a function still have to be called within that file in order to include the file? These files fall from one to another, in a specific order, and may or may not have a function in them that gets directly called. When the program begins, it steps through the files in sequence, and generates links to the proper pieces (actually, the names of the functions are all in a specific section, and they just have to be adjacent to each other.
  • OK, I have verified that in order to get the linker to link in a specific object, I have to reference something in that file from another file that is being linked.

    Seems that I can't give a specific list of files, and the order that the files should be in. That's kind of a limitation to me. Several files I need to include are basically embedded text and string files, and they may or may not be referenced by anything else (for instance, an embedded copyright block ). Now, I have to reference a dummy label inside that file, but I can't insure that it's first in the output block
  • Background ... The linker initially includes all sections from all the object files (something.obj) seen on the command line, plus any object files brought in from libraries.  Then, it creates a tree of references starting with main.  Any function main calls, or data it uses, is included in the tree.  Then those functions are examined the same way.  This continues until you include the functions that call nothing.  Any sections not touched by this tree of references are removed.  

    You can force the tools to include functions or data not part of the tree of references rooted at main.  You do that with #pragma RETAIN.  Please read about that pragma in the MSP430 compiler manual.

    Thanks and regards,

    -George

  • That's fine for something written in a high-level language.  This code is all straight MSP430 assembler, which I've gotta say, I like.  Kinda messed up on addressing over 64k, but I can work with it.

    2 questions:

    1. What's the equivalent of #pragma RETAIN in assembler?

    2. Will (or how do I force) the linker link files in the order I specify them in the link command file?

    Thanks-

    David

  • David Dudley said:
    1. What's the equivalent of #pragma RETAIN in assembler?

    There is a --retain assembler option, and a .retain directive.  Read about them both in the MSP430 assembly tools manual.

    David Dudley said:
    2. Will (or how do I force) the linker link files in the order I specify them in the link command file?

    For my explanation to make sense, you need this general background information on linker command files.

    There are two different stages at which such ordering matters.  One, when multiple input sections are included in an output section, what order is used?  Two, when multiple output sections are allocated to the same memory range, what order is used?  I think you are only concerned about the first one.

    When you construct an output section like this ...

    output_section_name {
       file1.obj(.text)
       file2.obj(.text)
       file3.obj(.text)
       *(.text)  /* all remaining .text sections */
    } > FRAM

    The linker puts the .text input section from those first three files, in that order, before all the other .text input sections.

    Thanks and regards,

    -George

  • Actually, if I had studied the manual a little closer, I would have found the "--unused_section_elimination" switch for the linker. That fixed the problem I was having.

    One thing remains. I actually have three segments I need to place in a specific order (.stringinfo, .worddefs, .text ). I need them in that specific order when things get linked. The linker seems to try to put the .text segment first, and the others after it. That's OK, but I'd like them in the specific order I've been requested to provide.
  • One thing:
    I have an initial file that needs to be first, and an file that needs to be last in the sequence.

    The intermediate order I'm not that specific on.
    Can I say
    output_section_name {
    initialfile.obj(.text)
    *(.text)
    trailingfile.obj(.text)
    } > FLASH

    by any chance, or will that just confuse things?
  • David Dudley said:
    I actually have three segments I need to place in a specific order (.stringinfo, .worddefs, .text ). I need them in that specific order

    I presume these are output sections, and not input sections.  You need to use the GROUP directive.  The details are included in this general discussion of ordering sections.

    Thanks and regards,

    -George

  • David Dudley said:
    Can I say
    output_section_name {
    initialfile.obj(.text)
    *(.text)
    trailingfile.obj(.text)
    } > FLASH

    Yes.  That will do what you expect.

    Thanks and regards,

    -George

  • Unfortunately, that does not work (at least, not as I had it).

    The initialfile.obj(.text)  statement worked fine.

    The *(.text) statement grabbed all the remaining object files, including trailingfile.obj(.text), and placed them randomly.  The last statement produced an error (or was it a warning???).

  • David Dudley said:
    Unfortunately, that does not work (at least, not as I had it).

    My mistake.  It turns out the MSP430 compiler puts the code for every function in a separate section named .text:name_of_function.  So you have to write it this way ...

        output_section_name {
          first.obj(.text:first_function)
          *(.text)
          last.obj(.text:last_function)
        } > FLASH

    Thanks and regards,

    -George

  • Afraid I don't quite understand this answer.

    By "last_function" do you mean the name of the file, or the name of a function in the file?

    My last object file is named Reset.  The name of one of the functions in that module is is initialize

    So in the link file I have

    section_name {

    ....

    Reset.obj(.text)

    }

    So do I replace this with:

    Reset.obj(.text:Reset), or Reset.obj(.text:initialize)

    Later-

    David

  • David Dudley said:
    By "last_function" do you mean the name of the file, or the name of a function in the file?

    The name of the function.

    David Dudley said:

    So do I replace this with:

    Reset.obj(.text:Reset), or Reset.obj(.text:initialize)

    Reset.obj(.text:initialize)

    Thanks and regards,

    -George