• 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 » Exclude sections in .bin file
Share
TI C/C++ Compiler
  • Forum
Options
  • Subscribe via RSS

Exclude sections in .bin file

Exclude sections in .bin file

This question is answered
Andy8086940
Posted by Andy8086940
on May 02 2012 17:14 PM
Intellectual530 points

Is there a way to exclude specific sections when generating a .bin file from a .out file?  I can use the tiobj2bin to generate the bin file with all sections included just fine.  I tried adding --exclude "fltext" to the %hexcmd% argument list in tiobj2bin.bat to try to exclude the fltext section, but it still includes it.  I have played around with it a bit and it looks like the --exclude "fltext" switch only seems to work for me when I'm not using the --image switch.  But I need an image, just an image without the fltext section.

My map is something like this.  The fltext section is not valid memory and is only used as an indicator that it's that particular section during bootloading.  I can create the proper binary by declaring the fltext section as type = NOLOAD and running the default tiobj2bin command, but I don't want to have to generate two separate out files just to get a bin file with fltext removed.

0x00000000 .text
0x20000000 .bss
0x70000000 .fltext 

Any suggestions?

Thanks,

Andy

.bin .out exclude sections tiobj2bin
Report Abuse
  • Reply
You have posted to a forum that requires a moderator to approve posts before they are publicly available.
All Replies
  • George Mock
    Posted by George Mock
    on May 03 2012 16:13 PM
    Guru51290 points

    The fltext section should get excluded.  But, when you are using the -image switch, the entire range of memory, as indicated by the ROMS directive in the auto-generated hex utility command file, is output to the binary file.  For any memory range that does not correspond to a section in the .out file, a fill value of 0 is used.  With regard to the fltext section, the corresponding memory range should be filled with 0.  Are you seeing something else?

    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.
  • Andy8086940
    Posted by Andy8086940
    on May 03 2012 17:19 PM
    Intellectual530 points

    George,

    My ROMS directive does include all memory (all_mem: o = 0x0, l = 0x700003dc) and the fltext section is filled with 0 in the final binary.  I suppose you could consider the fltext section excluded in that case, but that's not really what I want.  This still generates a 1.8GB bin file (mostly filled with 0).

    I can generate the 256 KB bin file that I'm looking for by not linking in the fltext section in the first place, but my goal is to generate these 3 files using only one linker command script:
    app.out with or without fltext
    app.srec with fltext
    app.bin without fltext

    I didn't see a way to generate the srec file without linking in fltext, so I linked it in.  But I want to also be able to generate app.bin as if app.out did NOT have fltext linked in.

    I can see that the ROMS directive is generated by mkhex4bin, but there don't seem to be any command line options available that would let me exclude the fltext section from the ROMS range.  I think being able to do that would solve my problem.

    Thanks for your help.

    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 04 2012 13:21 PM
    Guru51290 points

    I see an issue you may not have considered.  If the flext section is both skipped and not filled in the .bin file, then you have a hole in the output.  How should such a hole be represented?  How will the consumer of app.bin handle such a hole?  

    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.
  • Andy8086940
    Posted by Andy8086940
    on May 04 2012 16:42 PM
    Intellectual530 points

    The only real ROM sections are between 0x00000 and 0x3FFFF, with fltext being the only thing placed beyond 0x3FFFF.  If fltext is removed, it should be possible to shring the image to only what's left.

    It turns out I can get the desired image using the gcc arm-elf-objcopy as follows:

    arm-elf-objcopy.exe -O binary -R .fltext app.out app.bin

    If the TI toolchain can do the same, that would be great.

    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 07 2012 13:27 PM
    Verified Answer
    Verified by Andy8086940
    Guru51290 points

    Andy8086940
    The only real ROM sections are between 0x00000 and 0x3FFFF, with fltext being the only thing placed beyond 0x3FFFF.  If fltext is removed, it should be possible to shring the image to only what's left.

    Ah, I didn't think of that.  Even though you are skipping a section, you don't end up with a hole in the output.  That's because the skipped section is, in address order, at the end.

    Andy8086940
     It turns out I can get the desired image using the gcc arm-elf-objcopy as follows:

    arm-elf-objcopy.exe -O binary -R .fltext app.out app.bin

    Well, one of the advantages of ELF object file format is that it enables use of non-TI tools just like this.

    Andy8086940
    If the TI toolchain can do the same, that would be great.

    I'm pretty sure I could get hex470 to do the same thing, but not as clean as that.  I think you should stick with the GCC solution.

    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.
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