The function wrapper for MPU version to get tick count is in portable/Common/mpu_wrappers.c.
I don’t understand, why … Why do I need at all, raising the privilege? The call returns by copy the value of the counter, and to do this it for some reason, raises (unequivocally) the privilege.
On my platform (ARM …), this is an SWI or similar exception, and this jump is no where ‘cheap’ considering all I want, is just the copy of this unisigned int. (Which, irrelevantly for the question, also happens to be native enough to be atomic, all in all, fast access).
So why do I have this performance hit? … Why this does not directly invoke xTaskGetTickCount, why would anyone place it in a section of flash where ‘user’ mode cannot invoke this?
TickType_t MPU_xTaskGetTickCount( void ) /* FREERTOS_SYSTEM_CALL */
BaseType_t xRunningPrivileged = xPortRaisePrivilege();
xReturn = xTaskGetTickCount();
vPortResetPrivilege( xRunningPrivileged );