From 241ecad44e9803167b3890ce627a7855d2af64d1 Mon Sep 17 00:00:00 2001 From: Stephen Casner Date: Thu, 19 Oct 2017 23:47:24 -0700 Subject: [PATCH] Return stack size and usage in task status array These values are in place of the stack base pointer that was not being set. --- components/freertos/tasks.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/components/freertos/tasks.c b/components/freertos/tasks.c index 980221252..8d98d068d 100644 --- a/components/freertos/tasks.c +++ b/components/freertos/tasks.c @@ -87,6 +87,7 @@ task.h is included from an application file. */ #include "StackMacros.h" #include "portmacro.h" #include "semphr.h" +#include "heap_regions_debug.h" /* Lint e961 and e750 are suppressed as a MISRA exception justified because the MPU ports require MPU_WRAPPERS_INCLUDED_FROM_API_FILE to be defined for the @@ -3660,6 +3661,10 @@ BaseType_t xTaskGetAffinity( TaskHandle_t xTask ) pxTaskStatusArray[ uxTask ].xTaskNumber = pxNextTCB->uxTCBNumber; pxTaskStatusArray[ uxTask ].eCurrentState = eState; pxTaskStatusArray[ uxTask ].uxCurrentPriority = pxNextTCB->uxPriority; + os_block_t* stackblk = (os_block_t*)(pxNextTCB->pxStack - sizeof(os_block_t)); + uint32_t stackinfo = (stackblk->size - sizeof(debug_block_t) - sizeof(block_tail_t)) << 16; + stackinfo |= pxNextTCB->pxTopOfStack - pxNextTCB->pxStack; + pxTaskStatusArray[ uxTask ].pxStackBase = (StackType_t*)stackinfo; #if ( INCLUDE_vTaskSuspend == 1 ) {