Disabling Unhandled exception

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

nikhilvr
Posts: 10
Joined: Wed Oct 22, 2014 5:18 am

Disabling Unhandled exception

Post 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.?
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Disabling Unhandled exception

Post 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
nikhilvr
Posts: 10
Joined: Wed Oct 22, 2014 5:18 am

Re: Disabling Unhandled exception

Post 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.
nikhilvr
Posts: 10
Joined: Wed Oct 22, 2014 5:18 am

Re: Disabling Unhandled exception

Post 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?
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Disabling Unhandled exception

Post by Giovanni »

Hi,

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

Giovanni
nikhilvr
Posts: 10
Joined: Wed Oct 22, 2014 5:18 am

Re: Disabling Unhandled exception

Post by nikhilvr »

It was there.But I commented everything.Still the same result.
nikhilvr
Posts: 10
Joined: Wed Oct 22, 2014 5:18 am

Re: Disabling Unhandled exception

Post 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
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Disabling Unhandled exception

Post by Giovanni »

Which function is giving you the #SV4? you should be able to tell from the stack trace after it stops.

Giovanni
nikhilvr
Posts: 10
Joined: Wed Oct 22, 2014 5:18 am

Re: Disabling Unhandled exception

Post by nikhilvr »

Actually Im getting SV#10 not SV#4
Is there any document explaining how to trace stack?
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Disabling Unhandled exception

Post 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
Post Reply