Page 1 of 1

Using CH_DBG_ENABLE_STACK_CHECK and CH_DBG_FILL_THREADS

Posted: Sun Jan 25, 2015 9:48 am
by Thomas_B
Hi!
I'm using ChibiOS 3.0.0 on a STM32f407 mikrocontroller.
Here I was trying to find the correct stack size for the different threads I’m using as it is explained in the tutorials. The problem I have is that there is a thread „Player_Thread()“ (I suppose, see attached picture) which causes a stack overflow although if I look at the memory address of the corresponding working area there is enough space (0x55's) to the top of the stack. Increasing the working area didn't change anything.
Is there probably a maximum limit for the working area? The thread needs about 20kB.
I would like to know in which way this stack check is done in order to find the root cause.

Thanks in advance!

Re: Using CH_DBG_ENABLE_STACK_CHECK and CH_DBG_FILL_THREADS

Posted: Sun Jan 25, 2015 11:03 am
by Giovanni
Hi,

The stack overflow is detected on context switching when the system tries to push into the stack an "intctx" structure (very large), probably there is not enough space for the whole structure even if there is some space left.

Giovanni