I' m debugging weird clock settings on my board and I was running some performance tests.
I added a C module doing :
Code: Select all
#define NOP asm volatile(" nop \n\t")
STATIC mp_obj_t perf_count(size_t n_args, const mp_obj_t *args) {
(void)n_args;
uint32_t start = HAL_GetTick();
uint32_t count = 0;
uint32_t end = 0;
for(count=0; count<10000000; count++) { NOP; }
end = HAL_GetTick();
return mp_obj_new_int(end - start);
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(perf_count_obj, 0, 2, perf_count);
so that's about 21Mhz at best right ?
I don't know the ARM Cortex M4 instructions timings (and not sure when to find them for the STM32F4) and not sure also which instructions gcc will generate for this loop ? Something like this ?
Code: Select all
movw r0, 0xffff
movt r0, 0xffff
loop:
sub r0, r0, #1
cmp r0, #0
bhi loop
Thanks