I DID FREERTOS CHANGES for memory tracer

Hi all. Hi Richard. I did some little changes in task.c and queue.c, for adding the possibility for user to call an hook function when a task or queue is created, passing some parameters, to trace memory usage information and to save pointer for each task tcb for custom monitoring of stack grow. It could be possible do similar changes in function TaskDelete and QueueDelete. My actual version of freertos is 470 Below there are my changes (all changes have comment "piero" before). Any comments will be appreciate Bye, Piero ****************************** FOR TASK.C: ****************************** …. Changes since V4.3.1:     + Added xTaskGetSchedulerState() function.     + Added prvIsTaskSuspended() to take into account the Occurrence of       vTaskResume() or vTaskResumeFromISR() being called passing in the       handle of a task that appears in the Suspended list only because it       is blocked on an event without a timeout being specified.     + Updated xTaskCheckForTimeout() to take into account that tasks blocked       using the Suspended list should never time out. // —————————————————————————-…. -——————————- //        piero Changes:   + Added hook funtion in TaskCrete for user memory usage check // ———————————————————————————————————— */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include "FreeRTOS.h" #include "task.h" /* * Macro to define the amount of stack available to the idle task. */ #define tskIDLE_STACK_SIZE    configMINIMAL_STACK_SIZE // ———————————————————————————————————— //        piero // Additionale default definition #ifndef configUSE_TASKCREATE_HOOK   #define configUSE_TASKCREATE_HOOK 0 #endif // ———————————————————————————————————— …. ….         #if portSTACK_GROWTH < 0         {             pxTopOfStack = pxNewTCB->pxStack + ( usStackDepth – 1 );         }         #else         {             pxTopOfStack = pxNewTCB->pxStack;            }         #endif // ———————————————————————————————————— //        piero     #if (configUSE_TASKCREATE_HOOK == 1)         {             extern void vApplicationTaskCreateHook( tskTCB * pxCurrentTCB, unsigned portSHORT usCurrentStackDepth );             /* Call the user defined function from within the create task function.              This allows the application designer to add memory usage check.             NOTE: vApplicationTaskCreateHook(..) MUST NOT, UNDER ANY CIRCUMSTANCES,             CALL A FUNCTION THAT MIGHT BLOCK. */                vApplicationTaskCreateHook( pxNewTCB, usStackDepth );         }     #endif // ————————————————————————————————————         /* Initialize the TCB stack to look as if the task was already running,         but had been interrupted by the scheduler.  The return address is set         to the start of the task function. Once the stack has been initialised         the    top of stack variable is updated. */         pxNewTCB->pxTopOfStack = pxPortInitialiseStack( pxTopOfStack, pvTaskCode, pvParameters ); …. ****************************** FOR QUEUE.C: ****************************** …. /* // ———————————————————————————————————— //        piero Changes:   + Added hook funtion in QueueCreate for user memory usage check // ———————————————————————————————————— */ #include <stdlib.h> #include <string.h> #include "FreeRTOS.h" #include "task.h" #include "croutine.h" // ———————————————————————————————————— //        piero // Additionale default definition #ifndef configUSE_QUEUECREATE_HOOK   #define configUSE_QUEUECREATE_HOOK 0 #endif // ———————————————————————————————————— /*———————————————————– * PUBLIC LIST API documented in list.h *———————————————————-*/ …. ….                 /* Likewise ensure the event queues start with the correct state. */                 vListInitialise( &( pxNewQueue->xTasksWaitingToSend ) );                 vListInitialise( &( pxNewQueue->xTasksWaitingToReceive ) ); // ———————————————————————————————————— //        piero         #if (configUSE_QUEUECREATE_HOOK == 1)             {                 extern void vApplicationQueueCreateHook( xQUEUE *pxCurrentQueue, unsigned portBASE_TYPE uxCurrentQueueLength, unsigned portBASE_TYPE uxCurrentItemSize );                 /* Call the user defined function from within the create queue function.                  This allows the application designer to add memory usage check.                 NOTE: vApplicationQueueCreateHook(..) MUST NOT, UNDER ANY CIRCUMSTANCES,                 CALL A FUNCTION THAT MIGHT BLOCK. */                    vApplicationQueueCreateHook( pxNewQueue, uxQueueLength, portBASE_TYPE uxItemSize );;             }         #endif // ————————————————————————————————————                 return  pxNewQueue; ….

I DID FREERTOS CHANGES for memory tracer

I need feedback about this idea….. No answers??? Bye, Piero

I DID FREERTOS CHANGES for memory tracer

I think the changes are very useful.  The next version of FreeRTOS.org will include a new set of trace macros, which will allows all scheduler events to be traced. Regards.