Stack size and overflows
Moderators: RoccoMarco, lbednarz, tfAteba
Re: Stack size and overflows
After clicking around a bit (thanks for the Eclipse setup docs) I got the stack dump with the ChibiOS plugin.
I attached it as a screenshot as I don't know how to get it out as text:
Anyway, to me it looks like there's plenty of free stack available for threads still..? (EDIT: well, I'm not sure how to read those..)
I attached it as a screenshot as I don't know how to get it out as text:
Anyway, to me it looks like there's plenty of free stack available for threads still..? (EDIT: well, I'm not sure how to read those..)
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: Stack size and overflows
StkUnused is the available stack size in the moment you refreshed the view, apparently there is enough stack size. Note that the stack overflow check is done during context switching only so there could be instances of stack overflows not caught by the OS, for example calling a library function the does not perform any context switching inside.
Just a question, do you have the state checker enabled? Analyzing the trace buffer could also give an hint about the sequence of operations that brought to the overflow.
Without looking at the actual code and performing debug there is not much else I can do. BTW, is that a smart card related application?
Giovanni
Just a question, do you have the state checker enabled? Analyzing the trace buffer could also give an hint about the sequence of operations that brought to the overflow.
Without looking at the actual code and performing debug there is not much else I can do. BTW, is that a smart card related application?
Giovanni
Re: Stack size and overflows
I debugged this a bit further and started to write what actually happens when I realized that I'm calling chBSemWaitS(&sem) to lock a semaphore but I was calling chBSemSignal(&sem) to unlock it, instead of chBSemSignalI(&sem).
No "overflows" after fixing that.
Again just a stupid user error. But as always, thanks for your prompt replies.
No "overflows" after fixing that.
Again just a stupid user error. But as always, thanks for your prompt replies.
Re: Stack size and overflows
But this would have been coughed by the state checker if you had enabled debugging, wouldn't it? 
Re: Stack size and overflows
At least I have this defined:
I'm assuming that enables the state checker?
Code: Select all
#define CH_DBG_ENABLE_STACK_CHECK TRUEI'm assuming that enables the state checker?
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: Stack size and overflows
Nope, that is the stack check, it is CH_DBG_SYSTEM_STATE_CHECK. Regardless, during development all debug options should be enabled, the system is designed to catch a lot of errors if you allow it to do so.
Giovanni
Giovanni
Re: Stack size and overflows
Well, I must be blind. I did double check that I have all the defines set that are there in the debug wiki page. But I guess I can't distinguish stack from state :/
Re: Stack size and overflows
Thank you for the state checker. My locking stuff was a mess but now it's mostly fixed. Still something (hopefully small) remaining.