Instruction decode error under MPLAB SIM

kg4ysn wrote on Monday, September 15, 2008:

Hey all,

We are starting to build a system around FreeRTOS, and I wanted to verify my dev environment before really getting into the nitty gritty coding.  I wrote a simple program that was supposed to only have an Idle task:

#include <plib.h>
#include "FreeRTOS.h"
#include "task.h"

int main(void)
{
     vTaskStartScheduler();
     return 0;
}

void vApplicationStackOverflowHook(void)
{
     /* Run for the hills */
}

I loaded this up in MPLAB IDE v8.10 and got it to compile fine using C32 v1.0.3.  When I loaded the MPLAB SIM debugger and run the program, I get the following errors:

CORE-W0018: Instruction at 0x9fc0120c decoded as Reserved (NOP)
CORE-W0018: Instruction at 0x9fc01210 decoded as Reserved (NOP)
CORE-W0018: Instruction at 0x9fc01214 decoded as Reserved (NOP)

MAXIMUM number of warnings/errors exceeded 200, program execution halted.

I tried to step through the code and have deduced that vTaskStartScheduler() fires off properly and the Idle task runs for awhile.  Somewhere around the time a context switch takes place (in the ISR_Support.h file), these errors begin to pop up.

Any ideas?

Thanks,
Chris

kg4ysn wrote on Tuesday, September 16, 2008:

It turns out that MPLAB SIM has a maximum limit of 215 instructions.  (Thanks to Matt Coyler’s blog at http://matt.colyer.name/projects/round-robin-scheduler/ for that little trivial piece of information.)

So it looks like it’s not really possible to simulate FreeRTOS inside MPLAB’s IDE.  Talk about hard to debug!

Hope this helps someone else save hours of frustration!
Chris