This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Part Number: MSP432P401R
Tool/software: Code Composer Studio
I'm I'm trying to find out how many cycles a loop takes. I'm using the cycle count feature in the breakpoint window of the ccs debugger. If I step through the block of code, I get a lot more cycles then if I were to execute the whole loop. For example, if I step through, I calculate that one interation of the loop is 2 cycles. So, assuming that if I execute the loop 1000 times, I should only get about 2000 cycles. However if I run the whole loop, I end up with something like 12,000 cycles. What am I doing wrong?
Thanks,
John
Hello Kenneth,
I will need to look into this some more, but I believe that I found a similar discussion here ( ).
I do not exactly follow your description and example. Are you saying that when you stepped through the code you end up with 12K cycles or if you let it free-run. Also, are you resetting the counter?
Thanks,
Chris
Thank you for your response Chris. I made a video to try to clarify what is happening. In this example, when I step through, I takes 3 cycles to execute the instructions in the loop (including the branch) and the loop is iterating 30k times. I would expect ~90k cycles if I did the whole loop. However, as you see at the end, I get ~360k cycles.
John
I'm using CCS v7.2.0.00013. A C file is calling the assembly file. Here is the file.
Thanks,
John
John,
I am not able to reproduce your results. I ran your project on CCS 7.2 and get a cycle count of ~120k cycles, so 4 cycles for each run through the loop. I am attaching a video of my result below.
I'm not sure why you are seeing ~360k cycles. I ran the code on a MSP432 Launchpad, is that what you are using as well?
Thanks for the reply. Yes, I'm using the MSP432 LaunchPad (MSP-EXP432P401R rev 1.0). Is the problem specific to this revision?
One other question about the video Artie, is the branch 2 cycles? Because you only have 3 instructions in the loop. Should it be ~90k cycles, not ~120k?
Thanks,
John
Kenneth Faller said:One other question about the video Artie, is the branch 2 cycles?
Yes, it seems so according to this ARM reference page on Cortex M instructions and cycle count.
**Attention** This is a public forum