-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add traceSTARTING_SCHEDULER tracing hook. #1082
Add traceSTARTING_SCHEDULER tracing hook. #1082
Conversation
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.
db66f8f
to
df0b764
Compare
Fixed spelling error. CMock tests continue to fail due to missing fallback macro in FreeRTOS.h in "FreeRTOS" repo as described above. |
Hi @schilkp , Thanks for creating the PR. Please fix the spell check errors. After that we can merge the PR. |
Hi @shubnil! Thanks for the review. Sure - It seems I still can't get that word correct after 2 tries :) In general, what is the preferred workflow here? Do you want to me to force-push a fixed version (including possibly a re-base) or stack a commit? |
You can abandon this PR and create a new one with the fix. |
Signed-off-by: Gaurav Aggarwal <[email protected]>
|
* 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.
Description
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.
Notes:
I had another think about the above discussion regarding a
traceTASK_IS_IDLE_TASK
andtraceTASK_IS_TIMER_TASK
hook. I agree that they are probably very specific and maybe not the best solution. Instead I propose atraceSTARTING_SCHEDULER
hook that is called just beforexPortStartScheduler
and exposes the idle task TCBs.This is probably a much more generic solution. It allows tracers to cleanly detect that the scheduler has started, and gives them an opportunity to inject code after the idle and timer tasks have been created. This allows a tracer to, if they wish, identify those tasks unambiguously.
I opted to expose
xIdleTaskHandles
as a macro parameter so the tracer does not have rely on "unhygienically" accessing this static variable or onINCLUDE_xTaskGetIdleTaskHandle
being enabled.I am happy for feedback here if you think this is appropriate.
Test Steps
The CMOCK test suite in https://github.com/FreeRTOS/FreeRTOS continues to pass with no regressions, after the fallback tracing hook has also been added to the duplicate FreeRTOS.h header file in that repo used during mock code generation:
Please let me know how, if you are looking at merging, how I should go about updating this?
Checklist:
Related Issue
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.