We are trying to measure the time taken by a particular function in our code. However, this function is a critical test function and is executed before the timers and interrupts on the controller are configured and initialized. Configuring/enabling any interrupts would cause the stack to be modified and would disturb the working of the function and cause it to give incorrect results. Is there any mechanism such as a free running timer that we can use to measure the time without having to configure any interrupts or timers?
We would like to do the following:
Initialize or start free running timer
Read the timer value t1
Execute function
Read the timer value t2
Any solution provided for the above needs to be applicable to both F2802 and F2806 controllers.