Stack usage win32 simulator VS2017

leslieyang0509 wrote on Wednesday, October 24, 2018:

Hi FreeRTOS team,

I’m study FreeRTOS via \FreeRTOSv10.0.1\FreeRTOS\Demo\WIN32-MSVC-Static-Allocation-Only project, the IDE is Visual Studio 2017 community.
In order to measure stack usage, configSUPPORT_STATIC_ALLOCATION is set 1(one) in FreeRTOSConfig.h.
Every tasks is create and run without any problem.

In my understanding, the vTaskGetInfo() function will get the related task information.

TaskStatus_t TaskStatus;
vTaskGetInfo(pTaskHandle, &TaskStatus, pdTRUE, eRunning);

The TaskStatus.pcTaskName is correct for every task, but TaskStatus.usStackHighWaterMark value is always 2.
Even declaration a large local variable in a sub-routines and memset all zero, TaskStatus.usStackHighWaterMark still 2.

Is it because the FreeRTOS on win32 simulator, the local variables are locate in win32 process virtual memory instead of the xTaskCreateStatic 6th argument?
Is there any configuration setting that I forget?

Leslie Yang

rtel wrote on Wednesday, October 24, 2018:

The Windows port does not use the stack in the same way the other ports
do so the stack checking functions will not work. As I recall there is
only one item ever stored on the stack created when the task is created,
hence the value you get will be the same for every task.

leslieyang0509 wrote on Thursday, November 01, 2018:

Hi Richard,

Thanks for your reply.

Leslie