-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add portTASK_SWITCH_HOOK #867
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 portTASK_SWITCH_HOOK #867
Conversation
This commit adds a portTASK_SWITCH_HOOK() macro which allows ports to inject behavior immediately after a context switch. For example, this macro could be used by ports that need to set an end of stack watchpoint after a context swtich.
How does this differ to the existing traceTASK_SWITCHED_IN() and traceTASK_SWITCHED_OUT() macros? |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #867 +/- ##
==========================================
- Coverage 93.78% 93.64% -0.14%
==========================================
Files 6 6
Lines 3184 2550 -634
Branches 885 608 -277
==========================================
- Hits 2986 2388 -598
- Misses 91 107 +16
+ Partials 107 55 -52
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Hi @RichardBarry, using the trace macros would also work. However, one consideration for not using trace macros to inject behavior is that the trace macros are sometimes provided by a third party debugging tool. For example, in ESP-IDF, we simply include the FreeRTOS trace macro headers provided by Segger Sysview. |
FreeRTOS/FreeRTOS-Kernel#867 Signed-off-by: Gaurav Aggarwal <[email protected]>
Kudos, SonarCloud Quality Gate passed!
|
* Add a unit test for tasks.c This test simulates the scenario when a task with priority higher than the currently executing task is unblocked as a result of the xTaskIncrementTick call. This is needed to fix the coverage drop in PR FreeRTOS#568. Signed-off-by: Gaurav Aggarwal <[email protected]> * Add description for the test Signed-off-by: Gaurav Aggarwal <[email protected]> * Add doc for another test Signed-off-by: Gaurav Aggarwal <[email protected]> Signed-off-by: Gaurav Aggarwal <[email protected]>
Description
This PR adds a
portTASK_SWITCH_HOOK()
invTaskSwitchContext()
to allow ports to inject behavior immediately after a context switch. For example, on the ESP32, this hook could be used for setting end of stack watchpoint (without needing to do it in the assembly routine that callsvTaskSwitchContext()
.Test Steps
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.