Log in

View Full Version : Using MPLAB SIM


koenig3456
23-03-2006, 09:05
I tried using the MPLAB SIM debugger to debug a program that uses WPILib. I get a Stack over flow error before the main() function is reached. Is there any way to use the MPLAB SIM debugger to debug a program that uses WPILib?

Greg Ross
23-03-2006, 10:27
I tried using the MPLAB SIM debugger to debug a program that uses WPILib. I get a Stack over flow error before the main() function is reached. Is there any way to use the MPLAB SIM debugger to debug a program that uses WPILib?
I don't know about WPILib, but the stack overflow error is the same that I get when I accidentally run a program compiled without the _SIMULATOR symbol defined. Set it on the MPLAB C18 tab of your project's "Build Options" dialog.

b0b0b0b
11-05-2006, 13:57
Thanks, this solved my problem.

sfs
23-01-2008, 22:33
Thanks, this solved my problem.

I am getting the exact same error, even when the _SIMULATOR macro is defined in the MPLAB C18 tab. Is anyone able to use MPLAB SIM with the most recent WPILib (WPILib2k6.lib) on the FRC? I get this error message when trying:

CORE-E0001: Stack overflow error occurred from instruction at 0x0030b2

robofan
10-02-2008, 16:40
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

sfs
11-02-2008, 14:39
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

That might work if you are using Kevin Watson's ifi_frc base code, but what about those using WPILib where no source code is available?