Page 1 of 2

Disabling Unhandled exception

Posted: Wed Oct 22, 2014 5:31 am
by nikhilvr
hi,

I have a doubt regarding unhandled exception.My code works perfectly for around 13 hours.After that unhandled exception is triggered.As a fix for this I disable the unhandled exception.If exception comes code goes to nvicEnableVector() function in nvic.c and all my code gets freezed.How can i bring back the code to work.?

Re: Disabling Unhandled exception

Posted: Wed Oct 22, 2014 8:10 am
by Giovanni
Hi,

I recommend running you application with debug options enabled and see if something is caught by the assertions or the state checker.

Giovanni

Re: Disabling Unhandled exception

Posted: Wed Oct 22, 2014 11:51 am
by nikhilvr
hi,

Thanks for your reply.I enabled all debug options and I'm getting SV#4, misplaced chSysLock().I didnt find an answer why this error is happening because im using only chThdYield() function call in four threads.Im not using chSysLock() anywhere in my application.

Re: Disabling Unhandled exception

Posted: Wed Oct 22, 2014 12:19 pm
by nikhilvr
int main()
{
static WORKING_AREA(Task1, 2624);

Thread_Id = chThdCreateStatic(Task1, sizeof(Task1), NORMALPRIO, Thread, NULL);
while(1);
}

msg_t Thread(void *arg)
{
while (TRUE) {
chThdYield();
}
}

This piece of code is giving error as misplaced I-class function.
What could be the reason?

Re: Disabling Unhandled exception

Posted: Wed Oct 22, 2014 12:43 pm
by Giovanni
Hi,

That code should not cause this, do you have also ISRs or callbacks in the application?

Giovanni

Re: Disabling Unhandled exception

Posted: Wed Oct 22, 2014 12:54 pm
by nikhilvr
It was there.But I commented everything.Still the same result.

Re: Disabling Unhandled exception

Posted: Wed Oct 22, 2014 12:59 pm
by nikhilvr
int main(void) {
Initialize_OS(); //Initialze ChibiOS related functions
Initialize_Threads(); //Initializing thread

while (1) {

}
}

void Initialize_Threads(void) {

static WORKING_AREA(Task1, 2624);
Thread_Id = chThdCreateStatic(Task1, sizeof(Task1), NORMALPRIO, Thread, NULL);
}

msg_t AP_GCS_Thread(void *arg)
{

while (TRUE) {

chThdYield();
}
}

rest everything is commented in my code

Re: Disabling Unhandled exception

Posted: Wed Oct 22, 2014 1:07 pm
by Giovanni
Which function is giving you the #SV4? you should be able to tell from the stack trace after it stops.

Giovanni

Re: Disabling Unhandled exception

Posted: Wed Oct 22, 2014 1:23 pm
by nikhilvr
Actually Im getting SV#10 not SV#4
Is there any document explaining how to trace stack?

Re: Disabling Unhandled exception

Posted: Wed Oct 22, 2014 1:33 pm
by Giovanni
nikhilvr wrote:Actually Im getting SV#10 not SV#4
Is there any document explaining how to trace stack?


It is a feature of the debugger not of the OS, which debugger are you using? you should have a stack trace window or something similar.

That #SV10 means "I-class function outside a critical zone", strange because your code does not contain any, this is why I asked if there are ISRs or callbacks.

Giovanni