Vitis Unified 2025.2 - How to enable traceTASK_SWITCHED_IN & traceTASK_SWITCHED_OUT

Does anyone have experience with setting your own function hooks for traceTASK_SWITCHED_IN and traceTASK_SWITCHED_OUT in AMD Vitis Unified 2025.2?

My application is a ZynqMP app running on A53-0 and is standalone with FreeRTOS + lwIP (socket API). I am trying to see how long one of my tasks actually runs on the CPU so I wanted to hook into these two macros. The issue is that Vitis manages FreeRTOS inside the platform and compiles it into a static library and there are no Vitis options to set it to call a user defined function.

Thank you.

Using these macros requires adding their definition to FreeRTOSConfig.h. Can you not re-compile FreeRTOS after adding these to FreeRTOSConfig.h?

If I remember correctly, when you modify FreeRTOSConfig.h in the platform project, you should be able to rebuild the static library.

Also, if you want detailed statistics, you might want to try Percepio Tracealyzer:

Thank you for the reply. The problem with editing FreeRTOSConfig.h directly is that any time the BSP is regenerated or the platform is cleaned it wipes out user changes.

Thank you for the reply. The problem with editing FreeRTOSConfig.h directly is that any time the BSP is regenerated or the platform is cleaned it wipes out user changes.

It seems FreeRTOSConfig.h is generated in this tcl script, so you could consider adding an extra puts line at the right place.

Thank you for the suggestion.