• 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 » Embedded Software » BIOS » BIOS forum » placing a group of functions to some section using .cfg file
Share
BIOS
  • Forum
  • Announcements
Options
  • Subscribe via RSS

Forums

placing a group of functions to some section using .cfg file

This question is answered
tarun goel
Posted by tarun goel
on Apr 16 2012 05:11 AM
Prodigy100 points

Hi

We are using a keystone multicore device.

Is there a way to place a group of functions (.text section) in some other section like #pragma CODE_SECTION does using .cfg file?

i know this can be done using linker.cmd file but can this be done using .cfg file?

Actually I want to place the code at some fixed address say 0x92000000 and the make the section write protected.

Tarun

linker text code_section .cfg
Report Abuse
  • Reply
You have posted to a forum that requires a moderator to approve posts before they are publicly available.
All Replies
  • BrandyJ
    Posted by BrandyJ
    on Apr 16 2012 07:18 AM
    Genius4370 points

    Here is my post about how to place the memory at a certian address.

    http://e2e.ti.com/support/dsp/c6000_multi-core_dsps/f/639/t/177186.aspx

    I think if you create the section in the .cfg and then place a #pragma in your code around the function, it will be the same.

    However, to make it read only - you will need to create a special platform in CCS (Using Tools->RTSC Tools->Platform->New) and create a memory section such as DDR3_RO or something and set the permissions, length and acceptable information type (code, data or both).  (Be sure to import the C66x default platform first, makes a good starting point.) Then in your config, you will reference your program section to this new memory section.

    For example here I created a special platform for my program that had MSMCRAM_NDK where I placed all the buffers for NDk in seperate section of MSMCRAM.  You could do this for DDR3 starting at 0x92000000.

    Program.sectMap[".myLocalMemory"] = "L2SRAM";

    Program.sectMap[".myHeapSection"] = "DDR3";

    Program.sectMap[".resmgr_memregion"] = {loadSegment: "L2SRAM", loadAlign:128}; /* QMSS descriptors region */

    Program.sectMap[".resmgr_handles"] = {loadSegment: "L2SRAM", loadAlign:16}; /* CPPI/QMSS/PA Handles */

    Program.sectMap[".resmgr_pa"] = {loadSegment: "L2SRAM", loadAlign:8}; /* PA Memory */

    Program.sectMap[".far:NDK_OBJMEM"] = {loadSegment: "MSMCSRAM_NDK", loadAlign: 8};

    Program.sectMap[".far:NDK_PACKETMEM"] = {loadSegment: "MSMCSRAM_NDK", loadAlign: 128};

    Also, lesson learned from created a special platform.  When you uncheck the "customize memory" box you will need to also add the length of your L1D andL1P memory sections otherwise it won't link.  Not sure why the default one will work without the length but a customized one needs the lenghth.

    Anyhow, TI please correct if I have misspoken.

    Good luck!

    Brandy

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • tarun goel
    Posted by tarun goel
    on Apr 16 2012 22:28 PM
    Prodigy100 points

    Thanks Brandy for the useful cues.

    Please take a look at this post that describes how to put a group of functions into a section without having to put #pragma CODE_SECTION before each function. But the approach described works only for the linker command file (correct me if I am wrong).

    http://e2e.ti.com/support/development_tools/compiler/f/343/t/41618.aspx

    I want to put functions into a section without having to put #pragma before each function.

     

    Tarun

     

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Sasha Slijepcevic
    Posted by Sasha Slijepcevic
    on Apr 17 2012 12:10 PM
    Genius15070 points

    Tarun,
    can you post the linker directives that you would use in the linker command file, and I'll check if they can be replicated in the CFG script?

    If my reply answers your question please mark the thread as answered.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • tarun goel
    Posted by tarun goel
    on Apr 17 2012 22:56 PM
    Prodigy100 points

    Thanks Sasha

    Here are the directives I use in my linker command file

     

    SECTIONS
    {
        .mytext :
        {
            file1.obj(.text)      /* Link .text section from f1.obj */
            file2.obj(.text)      /* Link .text from f4.obj */
        }
    }

    One more thing, I made some memory sections in .cfg file using Program.sectMap() but these sections are not visible in my linker command file Is there a way I could access those section in my linker command file?

    I mean could I do this in my .cfg file-

    Program.sectMap[".mytext"] = new prog.SectionSpec();

    Program.sectMap[".mytext"].loadSegment = 'DDR3'

     

    Then in my linker command file I want to do this

    SECTIONS
    {
        .mytext :
        {
            file1.obj(.text)      /* Link .text section from f1.obj */
            file2.obj(.text)      /* Link .text from f4.obj */
        }
    }

    Is this possible?

    Tarun

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Sasha Slijepcevic
    Posted by Sasha Slijepcevic
    on Apr 18 2012 13:31 PM
    Verified Answer
    Verified by tarun goel
    Genius15070 points

    Tarun,
    combining input sections is not supported by Program.sectMap. What you can do, short of writing your own complete linker command file, is to use Program.sectionsTemplate property to insert your own section allocations.This config parameter specifies a template that replaces the automatically generated directive SECTIONS with your own content:
    Program.sectionsTemplate = "../mySections.xdt";

    If you start the path to the template file with "../", then you can keep the template in the same directory with your config script.
    Then, you need to create the template file "mySections.xdt". It uses XDCtools-specific template syntax, but your goal is simple enough that it requires only a couple of lines of code:

    .mytext 
        {
            file1.obj(.text)      /* Link .text section from f1.obj */
            file2.obj(.text)      /* Link .text from f4.obj */
        } > DDR3
    `$args[1]`

    The first line is your addition, and the second line adds the allocation for the rest of the sections. Check the linked docs for Program.sectionsTemplate for more detailed explanation how it works.

    If my reply answers your question please mark the thread as answered.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • tarun goel
    Posted by tarun goel
    on Apr 19 2012 04:43 AM
    Prodigy100 points

    Thanks Sasha  for all the help.

    Making a template worked although I had to give it an absolute path but am trying to figure out what went wrong with relative path.

     

    Thanks

    Tarun

     

     

    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