_general_exception_handler erasing flash

roujesky wrote on Thursday, June 09, 2011:

I am using FreeRTOS on a custom PIC32 based board that looks a lot like an Explorer 16 board.  Anyway, when I erase the 3rd  page of flash I am getting a _general_exception_handler.   I cannot extract from the volumes of microchip data what the cause is.   How do I interpret what the ulCause and ulStatus mean?   It might be helpful……
Also, how is _general_exception_handler registered as the exception handler?   I searched for _general_exception_handler all thru the code and it only appears in main.c.   Is _general_exception_handler some kind of compiler/linker reserved function for microchip?   Just curious about that part……


rtel wrote on Thursday, June 09, 2011:

The CAUSE register is described in the manual for the MIPS M4K core, not in the PIC32 manual (at least that was the case when I wrote the port).  You can download the M4K technical documentation from MIPS directly.


roujesky wrote on Thursday, June 09, 2011:

after re-reading, it is not clear what i am doing :(   I downloaded the “HID Bootloader…” example from microchip.  It appears to work.   In my code, I have a loop:
       for( temp = 0; temp < (MaxPageToErase); temp++ )
                //pFlashTemp = 0x1d000000;
                pFlashTemp = pFlash + (temp*FLASH_PAGE_SIZE);
        NVMErasePage((void*) pFlashTemp );
USBDeviceTasks(); //Call USBDriverService() periodically to prevent falling off the bus if any SETUP packets should happen to arrive.

the 3rd time thru the loop I get a _general_exception_handler.   I wonder if the call to NVMErasePage causes a _general_exception_handler in some kind of asynchronous way so it just so happens the exception occurs, but i continue stepping???