Go to Post If you promote not only the growth of your own team but of other teams at other schools you are successful. - Koko Ed [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 29-01-2008, 19:22
govvijay govvijay is offline
Registered User
FRC #0540
 
Join Date: Jan 2008
Location: VA
Posts: 5
govvijay is an unknown quantity at this point
MPLAB SIM : Stack Overflow Error

I saw a thread where one person got this error in MPLAB Sim:

CORE-E0001: Stack over flow error occurred from instruction at 0x003d3a

The reply was that you have to use the simulator macro in the build options under the C18. How do you do that? Also, what is the stack over flow error? Why does the "watch" window of the simulator not show the variables used in the program?

Thanks for your help.
  #2   Spotlight this post!  
Unread 29-01-2008, 20:20
kevin.li.rit's Avatar
kevin.li.rit kevin.li.rit is offline
Imaginary Friend
AKA: Kevin Li
FRC #0596 (SciClones)
Team Role: Student
 
Join Date: Jan 2003
Rookie Year: 2001
Location: Hopkinton, Massachusetts
Posts: 936
kevin.li.rit has a reputation beyond reputekevin.li.rit has a reputation beyond reputekevin.li.rit has a reputation beyond reputekevin.li.rit has a reputation beyond reputekevin.li.rit has a reputation beyond reputekevin.li.rit has a reputation beyond reputekevin.li.rit has a reputation beyond reputekevin.li.rit has a reputation beyond reputekevin.li.rit has a reputation beyond reputekevin.li.rit has a reputation beyond reputekevin.li.rit has a reputation beyond repute
Send a message via Yahoo to kevin.li.rit
Re: MPLAB SIM : Stack Overflow Error

A stack is basically memory where you store data temporarily. When you call a function in C, it pushes the data on the stack, after the function returns, it pops it off. The stack is only a certain size and it is possible to push more data onto it than there is memory. I guess that's when an overflow occurs, I don't know what's making it overflow from what you've posted.

The two actions relate to the stack are push and pop.
__________________
Kevin Li

596 - Sciclones
1405 - Finney Falcons
2262 - Holliston Panthers
  #3   Spotlight this post!  
Unread 30-01-2008, 08:38
charrisTTI charrisTTI is offline
Ramblin' Wreck
AKA: Charles Harris
FRC #0623
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2003
Location: Vienna, VA
Posts: 106
charrisTTI has a spectacular aura aboutcharrisTTI has a spectacular aura about
Send a message via AIM to charrisTTI
Re: MPLAB SIM : Stack Overflow Error

The stack is used in C whenever a function is called. The compiler can use it for passing parameters, storing the address at which execution will resume when the function returns, and temporary storage for local variables (those declared within a function). The stack is a limited resource. Stack overflow can occur if your function call depth is too great. Function A calls B, B calls C, C calls ...., you get the idea. At some point you will run out of stack space.
A recursive function (one which calls itself) can generate a stack overflow if it has an error which causes an infinite loop or simply is called recursively so many times that all space is used (as described above).

Post some code if you would like further analysis.
__________________
FRC 623 2003,2004,2005,2006,2007,2008, 2009, 2010, 2011
FRC 1900 2007
FVC 60 and 193 2006
FVC 3271 2007
FTC 226 and 369 2008, 2009, 2010, 2011
FTC 3806 2010
  #4   Spotlight this post!  
Unread 30-01-2008, 09:46
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,567
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: MPLAB SIM : Stack Overflow Error

The 2004 Programming Reference Guide addresses how to get the simulator running. You can download it from this page: http://ifirobotics.com/rc.shtml

I don't know if the simulator works with Kevin's new code, but it does with the IFI code when you follow those instructions.
  #5   Spotlight this post!  
Unread 30-01-2008, 10:38
ayeckley's Avatar
ayeckley ayeckley is offline
Registered User
AKA: Alex Yeckley
FRC #2252 (Mavericks)
Team Role: Mentor
 
Join Date: Apr 2007
Rookie Year: 2007
Location: Sandusky, OH
Posts: 268
ayeckley has a reputation beyond reputeayeckley has a reputation beyond reputeayeckley has a reputation beyond reputeayeckley has a reputation beyond reputeayeckley has a reputation beyond reputeayeckley has a reputation beyond reputeayeckley has a reputation beyond reputeayeckley has a reputation beyond reputeayeckley has a reputation beyond reputeayeckley has a reputation beyond reputeayeckley has a reputation beyond repute
Re: MPLAB SIM : Stack Overflow Error

In my recent experience, MPLAB SIM is not compatible with Kevin's new library. It seems to get hung up waiting for an interrupt during the FRC initialization which never occurs (a timer interrupt, perhaps?). The result is a stack overflow before any of the user code is executed. Stepping over it doesn't seem to have any net-positive effect. At this point, even if it were working it's a bit too late in the game to be useful. We wound up using our 2007 bot as a testbed instead.
__________________

  #6   Spotlight this post!  
Unread 30-01-2008, 16:46
govvijay govvijay is offline
Registered User
FRC #0540
 
Join Date: Jan 2008
Location: VA
Posts: 5
govvijay is an unknown quantity at this point
Re: MPLAB SIM : Stack Overflow Error

Could be the new code - we are basing our code off Kevin's gyro code.
  #7   Spotlight this post!  
Unread 10-02-2008, 16:39
robofan robofan is offline
Registered User
FRC #0540
 
Join Date: Feb 2008
Rookie Year: 2004
Location: Virginia
Posts: 2
robofan is an unknown quantity at this point
Re: MPLAB SIM : Stack Overflow Error

I solved stack overflow issue by adding the following code to ifi_frc.h:

#ifdef _SIMULATOR
#define RESET_VECTOR 0x000
#define HIGH_INT_VECTOR 0x008
#define LOW_INT_VECTOR 0x018
#else
#define RESET_VECTOR 0x800
#define HIGH_INT_VECTOR 0x808
#define LOW_INT_VECTOR 0x818
#endif

Also, you need to remove or comment out the following lines in ifi_frc.h:

//#define RESET_VECTOR 0x800
//#define HIGH_INT_VECTOR 0x808
//#define LOW_INT_VECTOR 0x818
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using MPLAB SIM koenig3456 Programming 5 11-02-2008 14:39
stupid Array error: Error [1300] stack frame too l Validius Programming 7 27-01-2006 10:53
MPLAB SIM debugger Questions Chris_Elston Programming 2 16-01-2005 11:28
MPlab error ryan_f Programming 9 24-05-2004 07:30
using the MPLAB IDE MPLAB SIM simulator WizardOfAz Programming 1 03-11-2003 01:24


All times are GMT -5. The time now is 23:48.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi