Hi, I would like to write a piece of code in ARM assembler and would like to count the cycles it take to execute.
When I was playing with PICs this was really straight forward as the built in simulator allowed you to inspect the cycle count, start stop the stop watch.
Is there something similar available to ARM?
I have written a small piece of code in assembler, I haven't assembled or run it yet but would appreciate some eyes.
; Assume 40021000 is base address of GPIO port
; and 0x14 is offset of ODR
ldr r1,=40021000 ; load base address of GPIO port
ldr r2,[sp],#4 ; pop logic to be written to GPIO port
; Cycle count
.START
str r2,[r1, #0x14] ; output value to GPIO port 1
ldr r2,[sp],#4 ; pop logic 1
ldr r0,[sp],#4 ; pop delay count 1
b INNER1 ; branch into middle of delay 2
.LOOP1
mov r0,r0 ; NOP 1 1
mov r0,r0 ; NOP 1 1
mov r0,r0 ; NOP 1 1
mov r0,r0 ; NOP 1 1
.INNER1
sub r0, r0, #1 ; decrement delay count 1 1
mov r0,r0 ; NOP 1 1
cbnz r0, LOOP1 ; loop if count > 0 * * *1 no branch or 2 if branch
.END
; START->END always completes in
; multiples of 8 cycles