I’ve run into an issue on a project where prvTaskCheckFreeStackSpace() will show an increase in free space over time for a task, which shouldn’t be theoretically possible. I tracked this down to the fact that pxPortInitialiseStack for my device leaves many of the register values uninitialized. This means the registers are loaded with tskSTACK_FILL_BYTE when the task first runs, then untouched registers when pushed to the stack can make used stack areas look untouched, too. Has anyone else run into this issue? Is this worth addressing to make the stack usage checking more reliable? I worked around this issue by linking from pxPortInitialiseStack in the port to my own implementation that initializes all the register locations explicitly to non-tskSTACK_FILL_BYTE values.
Which port are you talking about?
I first noticed this in the Xilinx Microblaze port in FreeRTOS V9.0.1. In another project using the IAR ARM_CM4F port I see a similar vulnerability in the stack initialization.
Would you like to raise a PR or would you like us to?
I’ll put a PR together for this.