MPLAB PIC32MX reserved instruction?

ulmus71 wrote on Wednesday, January 04, 2012:

Hi! I try to run freeRTOS for the first time, i have main.c as simple as possible:

int main( void )
/* Finally start the scheduler. */

/* Will only reach here if there is insufficient heap available to start
the scheduler. */
return 0;

void vApplicationStackOverflowHook( void )
/* Look at pxCurrentTCB to see which task overflowed its stack. */
for( ;; );

but i get exception titled:
EXCEP_RI, // reserved instruction

dissamble looks like:

2120:                static void prvCheckTasksWaitingTermination( void )
2121:                {
9D002138  27BDFFF8   addiu       sp,sp,-8
9D00213C  AFBE0000   sw          s8,0(sp)      <-- exception address points here
9D002140  03A0F021   addu        s8,sp,zero
9D002144  03C0E821   addu        sp,s8,zero
9D002148  8FBE0000   lw          s8,0(sp)
9D00214C  27BD0008   addiu       sp,sp,8
9D002150  03E00008   jr          ra

Thanx for any advice, i can’t start freeRTOS and dont know why.

ulmus71 wrote on Wednesday, January 04, 2012:

I think i got answer:
in main() you have to call
hmm, i googled it but i have also ‘Using the freertos’ pic32 edition book and in examples from the book there is no call for that function… :frowning:

rtel wrote on Wednesday, January 04, 2012:

It sounds like you just haven’t set up the CPU, which you would have to do for any application you were writing (although the actual setup required depends on the application).

I suggest starting with an existing FreeRTOS demo application.  Several are provided with the book, and there is a more complex example in the main FreeRTOS zip file download.  Once you have an existing example compiling, you can leave in any configuration and setup necessary in main (the #pragmas at the top of main, and normally a function called prvSetupHardware()), and edit away the rest and replace it with your code.


ulmus71 wrote on Wednesday, January 04, 2012:

Thanx, only enable vectored interrupt i was missing:) now all works fine. I have a big application with lots of hardware and now i want to transalte it into freeRTOS app :slight_smile:
Cross your fingers:)