Hi, I am trying to do the following on Microblaze. Here is the program structure.
void main() { Xuint32 countvalue;
enable_timer(); // do some stuff on Microblaze
... //some lines of code ....
countvalue = readback_timer(); disable_timer();
//send count value back to serial port ...
return1; }
In short, I am trying to keep tab of how fast various sections of code takes to run using a timer running on Microblaze.
when i do compile with some compiler optimization level set to -O1 or - O2 or -O3, the compiler cleverly enables the timer at the WRONG place. it enables the timer and then disables the timer again, giving me a very short compute time. this is not what i want. :( since i want to be able to accurately measure how long it takes for the code to execute. I tried declaring countvalue as
volatile Xuint32 countvalue;
It doesn't quite work. Does anybody have an idea on how i could go about solving this?
thanks for your patience; I have not much experience developing embedded firmware.
Chris