configMINIMAL_STACK_SIZE size

Hi I have a question about the configMINIMALSTACKSIZE. In the demo on which my application was based the value for configMINIMALSTACKSIZE was set to 140 words (Renesas RX63N). And the documentation tells me that this value should generally not be reduced. But where does this value of 140 come from? Because I’ve never seen the IDLE task use more than 25 words, and when I do reduce configMINIMALSTACKSIZE to only 40 everything still works fine. So it feels like I’m wasting 115 * 4 = 460 bytes, only for the Idle task. And if I keep such margin for all my tasks, this rapidly adds up to a few kilo bytes. So I really want to understand this value so I can reduce it without risking stack overflows.

configMINIMAL_STACK_SIZE size

It might have come from a demo that used an idle hook function (added application code into the idle function) that required some more stack. If you are sure reducing the value is ok for your application, then by all means do so. Viewing stack high watermarks in kernel aware debuggers, using stack overflow detection (https://www.freertos.org/Stacks-and-stack-overflow-checking.html), and using utility functions such as uxTaskGetStackHighWaterMark() (https://www.freertos.org/uxTaskGetStackHighWaterMark.html) all help determine how much stack the task is using.