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.

Linker section order results in different behavior

I'm currently working with a system that uses a C6713 and text based LCD.  There's recently been some code restructuring resulting in the default .text section being split into a .externalCode section and .rtsCode section.  The external code is the custom firmware for the device and the rtsCode is the rts6700 libary.  This change resulted in the device no longer initializing properly with the screen displaying gibberish instead of the splash screen that is stored as a large array in SDRAM.  After a great deal of debugging, I noticed that placing the rtsCode section before the externalCode section instead of the other way around fixes this problem.  My current suspicion is that we are redefining an RTS function that is now taking precedence over the definition in the RTSLib, but my search through the map files have yet to find any such redeclaration.  Are there any other possibilities that might be causing this issue?  Alternatively, does TI have any linker or map analysis tools that I could use instead of searching through the code manually?

  • Hi Keith,

    Thanks for your post.

    In my opinion, searching through the map files would be the right approach to find any redeclaration in your case.

    To know, how the code sections are placed in SECTION directive & allocated in the MEMORY direction, please refer Example 8-5 & 8-3 in the below c6000 assembly language tools user guide as below:

    http://www.ti.com/lit/ug/spru186x/spru186x.pdf

    In the above doc, please refer section 8.5.4.2 for section allocation and placement & section 8.5.5 for placing a section at different load and run addresses.

    Thanks & regards,

    Sivaraj K

     -------------------------------------------------------------------------------------------------------
    Please click the Verify Answer button on this post if it answers your question.
    -------------------------------------------------------------------------------------------------------

     

  • Keith,

    The linking process will use the order of libraries and object files to determine which functions are pulled into the linking operation. And this step is done before the linker is ready to allocate the linked result to the memory map. Since your sections are being placed in a different order for the memory map allocation of the linked result, their order will not affect the function precedence that you are questioning. At least is how it would seem to behave in my understanding.

    A more likely issue would be the distance between the function calls between the two sections or between these and other code sections. Trampolines should solve this issue, but it is possible that trampolines are not enabled for some of the object files. Check if trampolines are enabled. You can learn more about them in the Compiler User Guide or the Assembly Language Tools Reference Guide.

    You may be using an older version of the compiler and tools. In that case, it would help to know exactly what tools you are using, and also the differences you find between your two linker .cmd files and your two linker .map files.

    Regards,
    RandyP

  • See SPRU186V, section 7.4.25, Scan All Libraries for Duplicate Symbol Definitions (--scan_libraries).

    The linker already knows how to do what you are trying to do manually ...