Skip to content

ISR caused stack overflow? #144

Answered by feilipu
marshfolx asked this question in Q&A
Discussion options

You must be logged in to vote

As for AVR devices, I suspect ISR just use the stack of the task interrupted by the ISR, and randomly cause stack overflow.

Yes. The stack used during a context switch is the active Task stack. This is why every Task stack must be large enough to support all of the stack used by the Task itself, plus enough free space to enable a context switch to be stored.

This means that if your Task doesn't reuse dynamic storage properly then sooner or later there will be a crash due to stack overflow. If there is a stack overflow happening, that points to something arising in the Task code itself.

Usually a Task will be allocated memory by a static allocation solution such as heap_1.c or heap_2.c. …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by marshfolx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants