Using CH_DBG_ENABLE_STACK_CHECK and CH_DBG_FILL_THREADS

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

Moderator: RoccoMarco

Post Reply
Thomas_B
Posts: 1
Joined: Fri Jan 23, 2015 7:09 pm

Using CH_DBG_ENABLE_STACK_CHECK and CH_DBG_FILL_THREADS

Post 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!
Attachments
2015-01-24.png
2015-01-24.png (221 KiB) Viewed 1642 times
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Using CH_DBG_ENABLE_STACK_CHECK and CH_DBG_FILL_THREADS

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