I've using freertos for a while now and specially the uxTaskGetStackHighWaterMark to empirically scale the stack for my tasks.
My problem now is that when I call this function for one of my active tasks, it does not return a fixed or decreasing value( as it's supposed to be) but instead it increases and decreases randomly each time i call this function.
I tried to call uxTaskGetStackHighWaterMark within the task, outside of it and from a software timer, but in all cases presents the same behavior.
In the task there is never an overflow, nor is it suspended or deleted and re-created. It is simply a task waiting for a semaphore to be executed, which is freed on an interrupt of an ADC. Also, I've checked that the variable I use to store and log this stack usage is not accessed by in other point of the code, no even by some incorrectly used pointer.
This behavior doesn't not cause ( apparently ) any trouble with the normal execution of the application, but I need to be sure that it's not cause by a hidden bug tat causes my application to crash in the future.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.