I need to know about the hook functions in FreeRTOS kernel which are called whenever a scheduling decision is made.
I have used traceTASK_SWITCHED_OUT, and traceTASK_SWITCHED_IN macros, but they work with tasks, not at every context switch.
Can someone provide a little information or any example to use them?
Also, for a malloc() failed hook set configUSE_MALLOC_FAILED_HOOK to 1, then in your application write a function
void vApplicationMallocFailedHook( void ); /* used for heap_1.c and heap_2.c and heap_3.c only */
Is there a link for the malloc failed thing?
For stack overflow hook set configCHECK_FOR_STACK_OVERFLOW to 1 or 2, and provide a function
void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName );
tick hook is called during each tick interrupt by the kernel.
I need a hook function that is called at every context switch (whenever a scheduling decision is made).
Is there any hook function to fulfill this requirement?
You can do this using the traceTASK_SWITCHED_OUT and traceTASK_SWITCHED_IN macros. The sections I’m currently adding to the tutorial books actually contain an example that show you how to do just that.
These macros run in the context of the tasks.c file, so have access to the pxCurrentTCB variable. Therefore, what you do is something along the lines of: