c - General Exception Handler in PIC32 in MPLAB -X , How does software know when to throw this? -


void _general_exception_handler (unsigned caused, unsigned status)     {        rcon = rcon_exception;         // point of no return.        kernel_reset();     } 

my code seems getting in trap , have few questions figure out why here calling valid functions in code or better question keeps bothering me how processor know there has been violation.

1) when in watch window in debugger, cause shows me address 0xa0007ec0 , value 0x10800c1c , status shows me address 0xa0007ec4 , value 0x00100003. how can i, these address , value information figure out cause , status of exception? 2) how processor know there has been exception fault?

snapshots of memory

here handler use in pic32 project:

//  exception handler:  static enum {  excep_irq = 0,          // interrupt  excep_adel = 4,         // address error exception (load or ifetch)  excep_ades,             // address error exception (store)  excep_ibe,              // bus error (ifetch)  excep_dbe,              // bus error (load/store)  excep_sys,              // syscall  excep_bp,               // breakpoint  excep_ri,               // reserved instruction  excep_cpu,              // coprocessor unusable  excep_overflow,         // arithmetic overflow  excep_trap,             // trap (possible divide zero)  excep_is1 = 16,         // implementation specfic 1  excep_ceu,              // corextend unuseable  excep_c2e               // coprocessor 2    } _excep_code;     static unsigned int _epc_code;    static unsigned int _excep_addr;     // function overrides normal _weak_ generic handler    void _general_exception_handler(void)    {       asm volatile("mfc0 %0,$13" : "=r" (_excep_code));      asm volatile("mfc0 %0,$14" : "=r" (_excep_addr));       _excep_code = (_excep_code & 0x0000007c) >> 2;          while (1) {         // examine _excep_code identify type of exception         // examine _excep_addr find address caused      exception      nop();      nop();      nop();     }  }// end of exception handler   

Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -