• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Development Tools » TI C/C++ Compiler » TI C/C++ Compiler - Forum » Include linker command file in 3.3 project imported to CCS5
Share
TI C/C++ Compiler
  • Forum
Options
  • Subscribe via RSS

Include linker command file in 3.3 project imported to CCS5

Include linker command file in 3.3 project imported to CCS5

This question is answered
rrlagic
Posted by rrlagic
on May 02 2012 03:46 AM
Expert1440 points

Hello,

I am finding my way with CCS5.1 and got some trouble configuring new tools.

I have a legacy v3.3 project. I have imported it to CCS 5.1.1 using import legacy project wizard.

In my previous project I have custom linker file. At the beginning of memory image we define 3 custom sections for primary bootloader, secondary boot and program image descriptor. To do that we used command file with following commands:

custom.cmd:
SECTIONS { .init_booting: {} > primary_boot .booting: {} > main_boot .info: {} > prg_info }

Source file for bootloader contains

#pragma CODE_SECTION (primary_loader, ".init_booting");
#pragma CODE_SECTION (boot_main, ".booting");

and info section contents is defined elsewhere. We used to mentioned above custom.cmd as linker input and it worked fine. Now with ccs 5.1 it does not work. I have specified that linked command file in Project\Properties\General\Linker command file. But assembled image is wrong. Here is excerpt from the map file:

MEMORY CONFIGURATION name origin length used unused attr fill 
---------------------- -------- --------- -------- -------- ---- --------
primary_boot 00000000 00000100 00000000 00000100 RWIX
main_boot 00000100 00000200 00000000 00000200 RWIX
prg_info 00000300 00000010 00000010 00000000 RWIX
IRAM 00000320 0007fce0 00076454 0000988c RWIX
IHRAM 00080000 00080000 00080000 00000000 RWIX

So as one can see, primary_boot and main_boot sections are just empty. Moreover, there is unintended .vers section created and 0x0 and space from 0x0 to 0x320 is occupied by wrong code.

SECTION ALLOCATION MAP output attributes/ section page origin length input sections 
-------- ---- ---------- ---------- ----------------
.vers 0 00000000 00000038 COPY SECTION
00000000 00000038 myprj_cfg.obj (.vers)
$BRID 0 00000000 000005a8 COPY SECTION
00000000 00000014 csl6416.lib : csl.obj ($BRID)
00000014 000000e4 : csl_edma.obj ($BRID)
000000f8 00000064 : csl_gpio.obj ($BRID)
0000015c 000002c0 : csl_tcp.obj ($BRID)
0000041c 00000064 : csl_timer.obj ($BRID)
00000480 000000b0 : csl_vcp.obj ($BRID)
00000530 00000078 : csl_irq.obj ($BRID)
.info 0 00000300 00000010 00000300 00000010 info.obj (.info)

I am sure booting.c was compiled and I see booting.obj in the output directory. It just was not linked properly. Please advise, how to resolve.

linker
Report Abuse
  • Reply
You have posted to a forum that requires a moderator to approve posts before they are publicly available.
All Replies
  • AartiG
    Posted by AartiG
    on May 02 2012 08:58 AM
    Guru68965 points

    I would start by comparing the build commands for CCS 3.3 and 5.1.1 specifically the link step. I suspect that in 5.1.1, it may be picking up another linker command file in addition (or in place of) your custom linker command file, or there are multiple files and somehow the link order is affecting the section placement. In CCS 3.3, the link command will be in the file Debug.lkf. In CCS 5.1.1 you can see it in the CCS build console. Try comparing these and see if you can spot a difference.

    If you are unable to isolate the reason for the difference, please copy the full output of the CCSv5 build console on to a text file and attach it here. Also attach the link map file generated in CCSv5.

     


    If a post answers your question please mark it with the "Verify Answer" button

    Search the wikis for common questions: CGT, BIOS,  CCSv3, CCSv4
    Track a known bug with SDOWP. Enter the bug id in the "Find Record ID" box

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • rrlagic
    Posted by rrlagic
    on May 10 2012 21:40 PM
    Expert1440 points
    files.zip

    I had a trouble posting on the forum for a week, not it get fixed.

    I made a big mistake and updated CGT for my CCS v3.3 and get it broken.So I removed source which was crashing compiler and got some output from 6.0.8 CGT. Linker command line in build option is

    -q -c -m"myproject.map" -o"myproject.out" -x -i"%BIOS_INSTALL_DIR%/packages/ti/rtdx/lib/C6000" -l"csl6416.lib"

    Excerpt from map file is attached as v6.0.08.map. As one can see, .init_booting, .booting and .info sections contain data in them and allocation is as expected. Also boot_main function, which is expected to be linked in main_boot section is found in symbols list with expected address 0x100.

    Now let's see v5.1 output. In attached out7.3.5.txt there is excerpt of output console.Command line follows prescribed pattern

    cl6x--run_linker{--rom_model | --ram_model}filenames [options] [--output_file= name.out] --library=library [lnk.cmd]

    I see my custom link file is specified as last argument. However, there is -l"myprojectcfg.cmd" option specified before input object files. As I understand, it defines DSP/BIOS stuff linking. If we look inside generated map file (v7.3.5.map), only .prg_info section has correct data, others seems to be unused. Moreover, in the section allocation map we see, that at 0x0 there is unexpected there

    .vers      0    00000000    00000038     COPY SECTION.

    I know where it comes from. In the above mentioned -l"myprojectcfg.cmd" there is a command

    /* MODULE GBL */

    SECTIONS {
       .vers (COPY): {} /* version information */
    }

    So, my trouble is that cmd file of DSP/BIOS is get linked before my custom command file. In the same time, my command file is not processed properly. Function boot_main does not go to expected 0x100, it is not even mentioned in symbols list.

    I noticed that this behaviour happen first time when I switched from 6.0.x CGT to 6.1.x. Could you guess, what I missed in my linker command file?

    Thanks in advance.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • AartiG
    Posted by AartiG
    on May 14 2012 11:50 AM
    Guru68965 points

    rrlagic
    So, my trouble is that cmd file of DSP/BIOS is get linked before my custom command file. In the same time, my command file is not processed properly. Function boot_main does not go to expected 0x100, it is not even mentioned in symbols list.

    Did you compare the build command line from CCS 5.1 with the one from CCS 3.3? I see that you attached the output build console for CCS 5.1 but not the one from CCS 3.3. The key things to check are whether the same set of files (.obj + .lib) are being passed to the linker and the order of linker command files(if there is more than one).

    Another test to perform might be use CGT 6.0.8 with CCSv5.1 and confirm if the map file is as expected. This could help determine if the issue is in the way the project was migrated to CCSv5 (which is what I suspect) or is in the CGT 7.3.x itself. The steps to use a different version of CGT with CCSv5 is documented here.

    I have seen in a couple of cases where a CCS 3.3 project migrated to CCSv5 may require the link order of files to be re-specified in order to achieve the desired link result. In CCSv5, you can specify the order in which files are to be linked by going into Project Properties->CCS Build->Link Order tab. Depending on the complexity of the project and the way it was originally set up, the import tool in CCSv5 sometimes does not do a perfect job in the migration, thereby requiring some additional custom modifications to get an equivalent project.


    If a post answers your question please mark it with the "Verify Answer" button

    Search the wikis for common questions: CGT, BIOS,  CCSv3, CCSv4
    Track a known bug with SDOWP. Enter the bug id in the "Find Record ID" box

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • rrlagic
    Posted by rrlagic
    on May 14 2012 21:15 PM
    Expert1440 points
    Debug.lkf.zip

    Hello,

    Thank you for response. I attach .lkf file of my 3.3 project, there is a command line to linker.

    As to 5.1, already I tried 6.0.x CGT. No surprise, with that version of CGT my project is linked correctly. But trouble is that with 6.0.x CGT the RTA does not work. With 7.3.5 I get RTA working, but boot code is missing due to linker issue.

    In my 3.3 project I do specify linking order and put my custom linker command file before generated one. I do the same in 5.1, but it does not help. Again, if I try CGT of 6.1.x and above on 3.3, then linking is wrong. So I suspect there was some linker behaviour change between 6.0.x and 6.1.x, which I missed and noticed only on 7.3.5.

    Can you suggest, where to look more?

    Thanks

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • AartiG
    Posted by AartiG
    on May 15 2012 12:41 PM
    Guru68965 points

    Can you attach the 2 linker command files (your custom one and the BIOS generated one) as well as the link map files generated with CGT 6.0.x and 7.3.x? That may give us more clues.


    If a post answers your question please mark it with the "Verify Answer" button

    Search the wikis for common questions: CGT, BIOS,  CCSv3, CCSv4
    Track a known bug with SDOWP. Enter the bug id in the "Find Record ID" box

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • rrlagic
    Posted by rrlagic
    on May 15 2012 19:13 PM
    Expert1440 points
    mapncmd.zip

    Hello,

    I attach two map files, linker command files and makefile found in debug folder of v5.1 project.

    Thanks you for assistance.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • AartiG
    Posted by AartiG
    on May 16 2012 09:45 AM
    Guru68965 points

    According to the 6.0.29 map file, the object file booting.obj should have sections .init_booting and .booting. Can you check that those sections exist in the booting.obj file generated with 7.3.x? To do this, you can run ofd6x on the .obj file and check if the output file has these sections. Open a command prompt and run the following:

    ofd6x -g booting.obj > booting_ofd.txt

    You may need to specify the paths to ofd6x (which is in the \bin folder within the compiler tools directory) and booting.obj. Then open the booting_ofd.txt and check if those sections are present.

    If they are, the next thing to try is to add boot.cmd directly to the project instead of lte.cmd which in turn adds boot.cmd, and see if that makes a difference.

    Ultimately, it might be easier for us to analyze further if we had the complete project along with all source/object files. Are you able to share the complete project so we can build it at our end?


    If a post answers your question please mark it with the "Verify Answer" button

    Search the wikis for common questions: CGT, BIOS,  CCSv3, CCSv4
    Track a known bug with SDOWP. Enter the bug id in the "Find Record ID" box

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • George Mock
    Posted by George Mock
    on May 16 2012 15:56 PM
    Guru51360 points

    Try adding these options to the link ...

    -u _primary_loader
    -u _boot_main

    I suspect the linker sees that there are no references to these symbols.  Even though those symbols are defined in sections from the file booting.obj, because there are no references, the linker leaves those sections out.  Using -u forces the linker to refer to those symbols, and thus keep those sections.  

    At this point, I'm not sure why the linker is acting this way.  I think this will fix it.  Then we can figure out why.

    Thanks and regards,

    -George


    TI C/C++ Compiler Forum Moderator
    Please click Verify Answer on the best reply to your question.
    The Compiler Wiki answers most common questions.
    Track an issue with SDOWP. Enter your bug id in the "Find Record ID" box.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • rrlagic
    Posted by rrlagic
    on May 17 2012 03:49 AM
    Expert1440 points
    v7.3.5map-u.zip

    First of all, thank you for keep helping me with this issue.

    I've tried to verify required sections presence in the object file. They are present.

     Section Information                                                    
                                                                            
        id name                      load addr  run addr    size align alloc
        -- ----                      ---------  --------    ---- ----- -----
         1 $build.attributes         0x00000000 0x00000000  0x2a     1   N  
         2 .text                     0x00000000 0x00000000   0x0     1   Y  
         3 .data                     0x00000000 0x00000000   0x0     1   Y  
         4 .bss                      0x00000000 0x00000000   0x0     1   Y  
         5 .debug_info               0x00000000 0x00000000 0xa73     1   N  
         6 .booting                  0x00000000 0x00000000  0x80    32   Y  
         7 .init_booting             0x00000000 0x00000000  0x80    32   Y  
         8 .debug_frame              0x00000000 0x00000000 0x27b     1   N  
         9 .debug_line               0x00000000 0x00000000  0xc9     1   N  
        10 .debug_abbrev             0x00000000 0x00000000  0xc4     1   N  

    Then I tried to add -u option to the linker. I attach archive with map file. Better, but not perfect. I don't understand the output clearly, but seems that there is some overlap 0x00. I am doing this with CGT 7.3.5 on CCS5.1. Unfortunately, I cannot compare with CCS3.3 and CGT 6.1.x because of another issue.

    As to complete project, I would refrain from publishing it on the web, but I will try to create stripped test project just to illustrate the phenomenon. If we can proceed without it, it would save me some time.

    And again, thank you for support.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • AartiG
    Posted by AartiG
    on May 17 2012 11:15 AM
    Guru68965 points

    rrlagic
    Then I tried to add -u option to the linker. I attach archive with map file. Better, but not perfect. I don't understand the output clearly, but seems that there is some overlap 0x00

    OK, so now you do get the .init_booting and .booting sections in the map file. Thanks to George for suggesting the -u option.

    The overlap is fine because the .vers and $BRID are marked as COPY sections. A COPY section is not actually loaded to the target memory, so it won't really overlay anything.  More info on COPY sections and other special sections is here: http://processors.wiki.ti.com/index.php/Linker_Special_Section_Types

     


    If a post answers your question please mark it with the "Verify Answer" button

    Search the wikis for common questions: CGT, BIOS,  CCSv3, CCSv4
    Track a known bug with SDOWP. Enter the bug id in the "Find Record ID" box

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • rrlagic
    Posted by rrlagic
    on May 19 2012 06:11 AM
    Expert1440 points

    AartiG, 

    You think the issue is resolved? I am using out file to make hex, then bin, burned to the flash. Will check it next week.

    And if possible I'd like to find the root cause,why linker was omitting those section. Is -u the only way to get it fixed?

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • AartiG
    Posted by AartiG
    on May 23 2012 10:00 AM
    Guru68965 points

    rrlagic

    You think the issue is resolved? I am using out file to make hex, then bin, burned to the flash. Will check it next week.

    And if possible I'd like to find the root cause,why linker was omitting those section. Is -u the only way to get it fixed?

    Please let us know when you've had a chance to test out the binary.

    Regarding why the linker was removing those sections, we would really need a test case to analyze it further. If you're concerned about posting the complete project here on the forums, you can share it with us privately. Alternately if you can create a stripped down version that demonstrates the problem, that would also work. Please let us know if you'd like to move ahead with either of these options.


    If a post answers your question please mark it with the "Verify Answer" button

    Search the wikis for common questions: CGT, BIOS,  CCSv3, CCSv4
    Track a known bug with SDOWP. Enter the bug id in the "Find Record ID" box

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • rrlagic
    Posted by rrlagic
    on May 24 2012 01:24 AM
    Expert1440 points

    Hello AartiG,

    I cannot prove binary right now as my unit has hardware problem and now passed to hardware engineer for repair, but definitely I will try and report here.

    Definitely, I'd like to find the root cause of linker behaviour and willing to provide required info. As to test case, I'd like to share stripped version but still privately. Please let me know how should I do that.

    Thank you for support.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • AartiG
    Posted by AartiG
    on May 24 2012 09:30 AM
    Guru68965 points

    rrlagic
    As to test case, I'd like to share stripped version but still privately. Please let me know how should I do that.

    I sent you a friend request. When you accept you can start a private conversation with me and attach a zip file with the complete project. Please also include any specific directions/instructions that may be required to reproduce the issue.


    If a post answers your question please mark it with the "Verify Answer" button

    Search the wikis for common questions: CGT, BIOS,  CCSv3, CCSv4
    Track a known bug with SDOWP. Enter the bug id in the "Find Record ID" box

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • rrlagic
    Posted by rrlagic
    on May 25 2012 05:52 AM
    Verified Answer
    Verified by AartiG
    Expert1440 points

    I got spare unit and tested binary. Works for me. Thus, -u option helped to keep boot sections, and there is no trouble with COPY section overlap.

    Nevertheless, I'd like to continue study of the case until root cause or recommended practice would be found.

    For now thanks to participants for your efforts.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
12
TI E2E™ Community
  • Support Forums
  • Blogs
  • Videos
  • Groups
  • Site Support & Feedback
  • Settings
TI E2E™ Community Groups
  • TI University Program
  • Make the Switch
  • Microcontroller Projects
  • Motor Drive & Control
Other Communities
  • Deyisupport
  • Designsomething.org
  • beagleboard.org
  • TI on Element 14
  • TI on TechXchangeSM
Other Technical & Support Resources
  • WEBENCH® Design Center
  • Product Information Centers
  • Technical Documents
  • TI Design Network
  • TI Technical Articles
  • TI Training

All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
embedded processors, along with software, tools and the industry’s largest sales/support staff.

© Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy Policy | Terms of Use