Exercise the new vPortGetHeapStats() function from the Win32 demo projects.

This commit is contained in:
Richard Barry 2019-07-05 20:21:59 +00:00
parent fa404422b9
commit 4d6570b009
7 changed files with 113 additions and 9 deletions

View file

@ -62,7 +62,8 @@
#define configUSE_ALTERNATIVE_API 0
#define configUSE_QUEUE_SETS 1
#define configUSE_TASK_NOTIFICATIONS 1
#define configSUPPORT_STATIC_ALLOCATION 1
#define configSUPPORT_STATIC_ALLOCATION 0
#define configSUPPORT_DYNAMIC_ALLOCATION 1
/* Software timer related configuration options. */
#define configUSE_TIMERS 1

View file

@ -81,6 +81,7 @@
<ClCompile Include="..\..\Source\event_groups.c" />
<ClCompile Include="..\..\Source\portable\MemMang\heap_5.c" />
<ClCompile Include="..\..\Source\stream_buffer.c" />
<ClCompile Include="..\..\Source\task_pool.c" />
<ClCompile Include="..\..\Source\timers.c" />
<ClCompile Include="..\Common\Minimal\AbortDelay.c" />
<ClCompile Include="..\Common\Minimal\BlockQ.c" />

View file

@ -160,6 +160,9 @@
<ClCompile Include="..\Common\Minimal\MessageBufferAMP.c">
<Filter>Demo App Source\Full_Demo\Common Demo Tasks</Filter>
</ClCompile>
<ClCompile Include="..\..\Source\task_pool.c">
<Filter>FreeRTOS Source\Source</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="FreeRTOSConfig.h">

View file

@ -245,6 +245,7 @@ static void prvCheckTask( void *pvParameters )
{
TickType_t xNextWakeTime;
const TickType_t xCycleFrequency = pdMS_TO_TICKS( 4000UL );
HeapStats_t xHeapStats;
/* Just to remove compiler warning. */
( void ) pvParameters;
@ -370,10 +371,17 @@ const TickType_t xCycleFrequency = pdMS_TO_TICKS( 4000UL );
/* This is the only task that uses stdout so its ok to call printf()
directly. */
printf( "%s - tick count %zu - free heap %zu - min free heap %zu\r\n", pcStatusMessage,
xTaskGetTickCount(),
xPortGetFreeHeapSize(),
xPortGetMinimumEverFreeHeapSize() );
vPortGetHeapStats( &xHeapStats );
configASSERT( xHeapStats.xAvailableHeapSpaceInBytes == xPortGetFreeHeapSize() );
configASSERT( xHeapStats.xMinimumEverFreeBytesRemaining == xPortGetMinimumEverFreeHeapSize() );
printf( "%s - tick count %zu - free heap %zu - min free heap %zu - largest free block %zu \r\n",
pcStatusMessage,
xTaskGetTickCount(),
xHeapStats.xAvailableHeapSpaceInBytes,
xHeapStats.xMinimumEverFreeBytesRemaining,
xHeapStats.xSizeOfLargestFreeBlockInBytes );
}
}
/*-----------------------------------------------------------*/