• 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 » Internal error: space required for local variables exceeds maximum in main
Share
TI C/C++ Compiler
  • Forum
Options
  • Subscribe via RSS

Internal error: space required for local variables exceeds maximum in main

Internal error: space required for local variables exceeds maximum in main

This question is answered
sandeep vankineni
Posted by sandeep vankineni
on Dec 28 2010 02:45 AM
Prodigy60 points

Hi,

     I am doing an image processing application. I need to load the data into the stack memory. so the default size is fixed as 0x400. I increased the size of the stack memory yet the error comes as Internal error: space required for local variables exceeds maximum in  _main. Help me out.

 

Thanks,

sandeep

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 Dec 28 2010 10:42 AM
    Guru70775 points

    Sandeep,

    Which tool is generating this error, is it one of the code generation tools or CCS? Are you trying to load data from a file using probe points? Could you provide more information on how you are loading this data into memory - that might give us a better idea of why this message is appearing.


    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.
  • Archaeologist
    Posted by Archaeologist
    on Dec 28 2010 13:43 PM
    Verified Answer
    Verified by sandeep vankineni
    Mastermind41565 points

    The actual error message is "INTERNAL ERROR: Space required for local variables exceeds maximum in _main".  (Capitalization matters here; when reporting an error, please be sure to cut and paste the exact error message instead of re-typing it.)

    This comes from the compiler when a function's frame (the space for local variables in one function) is too big.  Only C2000, C5500, and MSP430 have this error message, and since the name of the function starts with an underscore, it is not coming from MSP430.  The limit for C2000 is 0xffff 16-bit words, and the limit for C5500 is 0x7ffff 16-bit words.

    The only solution is to reduce the number or size of variables on the stack, probably by moving them to static scope (global variables) or by using dynamic allocation (malloc).

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • sandeep vankineni
    Posted by sandeep vankineni
    on Dec 28 2010 23:58 PM
    Prodigy60 points

    Hi Aarti,

                I am using TMS320F28335 ans simulating on CCS3.3. In code i used around three 2-D arrays of size 160*120. while compiling the code itself it popped the error. so i dint yet loaded any data into memory. It gives a stack space error as it has no memory to provide space to local variables. The local variables has to be stored on stack as it specified, but stack has a memory of 0x400 only. so, now how can i use external memory as stack.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Archaeologist
    Posted by Archaeologist
    on Dec 29 2010 09:11 AM
    Mastermind41565 points

    You will not be able to solve the problem just by increasing the total size of the stack, because the 0xffff limit is for one stack frame.

    Each function instance gets its own stack frame every time it is called.  Stack frames are allocated (in LIFO fashion) in the memory area called the stack. See http://en.wikipedia.org/wiki/Call_stack

    When you adjust the total size of the stack, you are adjusting the size of the memory area.  That option does not affect how large an individual function stack frame can be.

    One of those arrays is 160 * 120 = 19200 words (0x4b00 in hex).  Therefore, you will never be able to have more than two of those arrays as local variables.  Change one of them to be "static".

    I'm not very familiar with C2000, but I suspect you may need to consider using a large memory model.  Still, the maximum size of a stack frame is the same in large model.

    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