Skip to content

Commit

Permalink
Add traceSTARTING_SCHEDULER tracing hook. (FreeRTOS#1082)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
schilkp authored and AhmedIsmail02 committed Jun 12, 2024
1 parent 9bfda43 commit a106391
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions include/FreeRTOS.h
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,13 @@
#define traceTASK_SWITCHED_IN()
#endif

#ifndef traceSTARTING_SCHEDULER

/* Called after all idle tasks and timer task (if enabled) have been created
* successfully, just before the scheduler is started. */
#define traceSTARTING_SCHEDULER( xIdleTaskHandles )
#endif

#ifndef traceINCREASE_TICK_COUNT

/* Called before stepping the tick count after waking from tickless idle
Expand Down
2 changes: 2 additions & 0 deletions tasks.c
Original file line number Diff line number Diff line change
Expand Up @@ -3732,6 +3732,8 @@ void vTaskStartScheduler( void )

traceTASK_SWITCHED_IN();

traceSTARTING_SCHEDULER( xIdleTaskHandles );

/* Setting up the timer tick is hardware specific and thus in the
* portable interface. */

Expand Down

0 comments on commit a106391

Please sign in to comment.