Skip to content

Commit df0b764

Browse files
committed
Add traceSTARTING_SCHEDULER tracing hook.
Discussed here: https://forums.freertos.org/t/tracing-improvements/20097 This hook enables tracers to run code on startup after all RTOS resources are created and to detect that the scheduler is starting without relying on traceENTER/traceEXIT macros. It also provides tracers access to the task handle of all IDLE tasks, allowing them to be identified unambiguously and without relying on INCLUDE_xTaskGetIdleTaskHandle.
1 parent 65e6297 commit df0b764

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

include/FreeRTOS.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,13 @@
621621
#define traceTASK_SWITCHED_IN()
622622
#endif
623623

624+
#ifndef traceSTARTING_SCHEDULER
625+
626+
/* Called after all idle tasks and timer task (if enabled) have been created
627+
* succesfully, just before the scheduler is started. */
628+
#define traceSTARTING_SCHEDULER( xIdleTaskHandles )
629+
#endif
630+
624631
#ifndef traceINCREASE_TICK_COUNT
625632

626633
/* Called before stepping the tick count after waking from tickless idle

tasks.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3735,6 +3735,8 @@ void vTaskStartScheduler( void )
37353735
/* Setting up the timer tick is hardware specific and thus in the
37363736
* portable interface. */
37373737

3738+
traceSTARTING_SCHEDULER( xIdleTaskHandles );
3739+
37383740
/* The return value for xPortStartScheduler is not required
37393741
* hence using a void datatype. */
37403742
( void ) xPortStartScheduler();

0 commit comments

Comments
 (0)