Documentation issue on function uxTaskGetStackHighWaterMark2()


The official documentation for the uxTaskGetStackHighWaterMark2() functions says (for kernel V10.4.3)":

“INCLUDE_uxTaskGetStackHighWaterMark must be defined as 1 for these functions to be available. See the RTOS Configuration documentation for more information.”

However that isn’t true anymore (I guess that was true some time ago). In the kernel file task.h you can read:

/** (Line 1514)
 * task.h
 * <PRE>configSTACK_DEPTH_TYPE uxTaskGetStackHighWaterMark2( TaskHandle_t xTask );</PRE>
 * INCLUDE_uxTaskGetStackHighWaterMark2 must be set to 1 in FreeRTOSConfig.h for
 * this function to be available.
 * Returns the high water mark of the stack associated with xTask.  That is, ...

I was getting some undefined references from my compiler when in my FreeRTOSConfig.h file I had:

#define INCLUDE_uxTaskGetStackHighWaterMark 1

And now my project compiles as it should when I have:

#define INCLUDE_uxTaskGetStackHighWaterMark2    1
#define configSTACK_DEPTH_TYPE                  uint16_t

(I’m using an 8 bit microcontroller, so I needed to set the configSTACK_DEPTH_TYPE constant.)


Thanks for taking the time to report this. To make sure I understand - you are saying the website docs are incorrect - right?

Hi Richard,

Yes, the official documentation is incorrect (“incomplete” also works). It should point out that the constant INCLUDE_uxTaskGetStackHighWaterMark2 must be set to 1 for when using the function uxTaskGetStackHighWaterMark2().

Right now the documentation mentions that INCLUDE_uxTaskGetStackHighWaterMark() is used to enable both functions, uxTaskGetStackHighWaterMark() and uxTaskGetStackHighWaterMark2().


Thanks for pointing this out @Xavier! You’re right that this is an issue. I’m working to get this updated.

1 Like