Page 1 of 1

CH_DBG_FILL_THREADS should fill the main stack  Topic is solved

Posted: Fri Dec 13, 2019 12:32 pm
by wurstnase
Hi,

currently only CH_DBG_ENABLE_STACK_CHECK will fill the main-stack.
Also

Code: Select all

static inline stkalign_t *chThdGetWorkingAreaX(thread_t *tp)
should be available with CH_DBG_FILL_THREADS.

Re: CH_DBG_FILL_THREADS should fill the main stack

Posted: Fri Dec 13, 2019 1:37 pm
by Giovanni
Hi,

The main stack is not defined in the RTOS code, it is part of the normal C runtime because it is already in use upon main() function entry and before chSysInit() is called (you cannot clear a stack you are running on), the allocation is statically done in the linker file.

The fill options for system stacks are available in the startup file crt0xx.S:
- CRT0_STACKS_FILL_PATTERN
- CRT0_INIT_STACKS

Giovanni