• 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 » Microcontrollers » C2000™ Microcontrollers » C2000 32-bit Microcontrollers Forum » putting .lib functions into RAM
Share
C2000™ Microcontrollers
  • Forums
  • Announcements
  • E2E Wiki
Options
  • Subscribe via RSS
C2000 Resources
  • Product Folder
  • C2000 Training Portal
  • C2000 Technical Training Catalog
  • C2000 Datasheets, App Notes, User Guides
  • C2000 Hardware Design Kits
  • controlSUITE for C2000 Software Library


  • InstaSPIN Resources
  • What is InstaSPIN?
  • Videos and Support


  • InstaSPIN-FOC and InstaSPIN-MOTION Resources
  • What is InstaSPIN-FOC?
  • What is InstaSPIN-MOTION?
  • Product Folder: F28069F, F28068F, F28062F, F28068M, F28069M
  • User’s Guide
  • Technical User’s Manual
  • Tools
  • putting .lib functions into RAM

    putting .lib functions into RAM

    This question has suggested answer(s)
    WillCode4Beer
    Posted by WillCode4Beer
    on Jun 27 2012 14:13 PM
    Prodigy145 points

    I’m working with a 28335 FPU processor and CCS5.  I have some intense computations to perform in a brief period of time, so I want to get the math functions and tables into RAM to maximize throughput.

    I am utilizing rts2800_fpu32.lib and rts2800_fpu32_fast_supplement.lib.  The latter is loaded first; this is verified in the .map file.

    My problem is that I don’t know how to get these .lib functions (_acos, _atan, _isqrt) into RAM.  I have found scant and scattered information about how to use/modify .cmd files.

    In sprca75 is verbiage about the FPUmathTables, telling you what to do if you “do not wish to load a copy of these tables into the device” (unclear if that means Flash or RAM) but it says nothing about getting them into RAM.  I tried some experiments with the FPUmathTables directives in the F28335_nonBIOS_flash.cmd file.  This line already existed there in the MEMORY area:

        FPUTABLES      (R) : origin = 0x3FEBDC, length = 0x0006A0     /* Part of Boot ROM */

    I added this line to the SECTIONS area:

        FPUmathTables    : > FPUTABLES, PAGE = 0, TYPE = NOLOAD

    After building, the map file informed me that all the utilized library functions were mapped to Flash.  The associated tables were also mapped to Flash.

    I changed the line in SECTIONS, removing the TYPE = NOLOAD part.

        FPUmathTables    : > FPUTABLES, PAGE = 0

    After building, the map file informed me that nothing had changed.  Everything was the same as when the TYPE = NOLOAD part was included.

    Finally, I removed the line in the SECTIONS area and built.  I got a warning that said

    #10247-D creating output section “FPUmathTables” without a SECTIONS

    Now all the tables were mapped to RAM (!) .  The utilized library functions remained in Flash.

    SO: 

    1. How do I amend the .cmd file to properly put the utilized library functions in RAM? 
    2. How do I amend the .cmd file to properly put the trig tables in RAM?  (granted, I achieved this, but only by not including it in the .cmd file.  Surely there’s a better, more assertive and correct way.)
    3. Where will I find better documentation about using and changing .cmd files?

     Thanks in advance.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    All Replies
    • BrandonAzbell
      Posted by BrandonAzbell
      on Jul 01 2012 09:56 AM
      Guru54790 points

      My suggestion below is more of an initial, interim test since the FPUmathTables are a part of the library file.  Let's forget for the moment that the FPUmathTables are actually in ROM already (ie. pretend the ROM doesn't exist).  You would need to have these loaded into Flash, but then you desire to move them into RAM for performance reasons.  This is available through the following construct in the linker command file.  It also requires some code in your application code during initialization to perform the copy.

      in linker command file
         FPUmathTables       : LOAD = FLASHH,
                            RUN = RAML0,
                            LOAD_START(_FPUmathTablesLoadStart),
                            LOAD_END(_FPUmathTablesLoadEnd),
                            RUN_START(_FPUmathTablesRunStart),
                            PAGE = 0

      in initialization code
         MemCopy(&FPUmathTablesLoadStart, &FPUmathTablesLoadEnd, &FPUmathTablesRunStart);

       

      Again, this will load the FPUmathTables into Flash and then copy to RAM which is where you ultimately want them for your performance needs.

      I certainly acknowledge that this "wastes" non-volatile memory on the FPUmathTables since when we stop ignoring the fact they are in ROM already.  The next step after you verify the above is to figure out how to copy the tables from ROM to RAM.  I want to first make sure we have a path for you in the interim.

      Brandon

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Frank Bormann
      Posted by Frank Bormann
      on Jul 02 2012 02:41 AM
      Genius5225 points

      Brandon,

      I think the solution is simple. Since we speak about BOOT-ROM locations, all addresses (table start, length) are fixed and documented in the boot-ROM user guide. All we need to copy these tables from ROM into RAM is a function call of the memcpy - function with the correct parameters in the initial part of main. The destination address could be any RAM-section, where the customer want's to place the table.

       

       

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • BrandonAzbell
      Posted by BrandonAzbell
      on Jul 11 2012 10:28 AM
      Guru54790 points

      WillCode4Beer,

      Did the above suggestion provide you a path to implement what you wanted for the interim?

      Brandon

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • WillCode4Beer
      Posted by WillCode4Beer
      on Aug 14 2012 15:06 PM
      Prodigy145 points

      Brandon,

      Sorry I’ve been away from this post for so long.  We made a change to the design that, for the time being, alleviated the need to deal with maximizing throughput.  This freed me up to pursue other project needs, so I have not yet attempted what you’ve suggested.  But this may very well change back, so I will eventually be looking at this again as time allows.

      I have a couple questions: 

      1. You mentioned twice that the tables are in ROM, leaving me with the impression that perhaps that should be sufficient.  My understanding is that in order to achieve zero wait states (maximize throughput), things need to be in RAM.  Am I mistaken about that in this case?  Will moving the tables to RAM improve throughput?
      2. I was also seeking guidance on how to move library functions to RAM for the same reason: achieve zero wait states to maximize throughput.  Is there a way to get library function calls such as _isqrt into RAM, and will that improve throughput?

      WillCode4Beer

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • BrandonAzbell
      Posted by BrandonAzbell
      on Aug 17 2012 18:49 PM
      Suggested Answer
      Guru54790 points

      WillCode4Beer

      You mentioned twice that the tables are in ROM, leaving me with the impression that perhaps that should be sufficient.  My understanding is that in order to achieve zero wait states (maximize throughput), things need to be in RAM.  Am I mistaken about that in this case?  Will moving the tables to RAM improve throughput?

      You are correct, that having the routines in RAM has the potential of operating with 0-wait states.  I say "has the potential" because depending which SRAM block you use, you may observe wait states for program fetches versus data fetches.  Details of this is provided in the TMS320F28335 datasheet in Table 3-5.

      ROM accesses are at 1-wait state.

       

      WillCode4Beer

      I was also seeking guidance on how to move library functions to RAM for the same reason: achieve zero wait states to maximize throughput.  Is there a way to get library function calls such as _isqrt into RAM, and will that improve throughput?

      There are ways to manipulate where sections are allocated, whether code (ie. .text) or data sections.  This is performed by the use of the linker command file, potential declaration of user defined named sections, etc.  An small example of this for user defined code sections are actually a part of the code examples for the TMS320F28335.  However, it place code which is found in libraries, you would use similar principles but the specifics may be slightly different.

      The C28x Assembly Language Tools User's Guide is a good resource for providing some descriptions on the concept.  For any modifications you may need to perform in C source files, such as creation of named sections via C #pragma directives, the C28x C/C++ Optimizing Compiler User's Guide is the resource to use.

      Brandon

      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