How to run code and view serial on Nucleo board
Hello,
I am trying to count how many clock cycles pieces of code take to run on my Nucleo board. I am using the following code for timing:
start_cycles = DWT->CYCCNT;
// dummy code
end_cycles = DWT->CYCCNT;
diff_cycles = end_cycles - start_cycles;
printf("Num clocks: %u \n", diff_cycles);
I am using different levels of optimization in the compiler settings and checking using live expressions (but also SWV to check what is printed to console). I had heard that debug mode can make things run slower due to a myriad of different factors. So I am wondering how I can, in the simplest way possible, run this code outside of debug mode and still have SWV or something enabled such that the clocks are printed to console.
Pressing the run button starts debugging but disconnects and shuts down after successfully connecting, and going to run as > C/C++ application does the same.
If anyone has any leads on this, it would be greatly appreciated. Thank you.
