From 447ebd7fd55326fff89e82022f7f8ba42efc4f4e Mon Sep 17 00:00:00 2001 From: Lourens Naude Date: Thu, 8 Oct 2026 17:26:26 +0100 Subject: [PATCH] arch/arm/src/imxrt: Start the DWT cycle counter for perf events. CONFIG_ARCH_PERF_EVENTS is on by default for ARMv7-M, but imxrt never called up_perf_init(), so perf_gettime() read zero and anything timed with it, rpmsg_ping for one, reported 0 ns. Initialise the counter with BOARD_CPU_FREQUENCY after the MPU is set up, as samv7 and stm32h7 do. Assisted-by: Claude:claude-fable-5-1 Signed-off-by: Lourens Naude --- arch/arm/src/imxrt/imxrt_start.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm/src/imxrt/imxrt_start.c b/arch/arm/src/imxrt/imxrt_start.c index 02b807aa7ad..808bd549443 100644 --- a/arch/arm/src/imxrt/imxrt_start.c +++ b/arch/arm/src/imxrt/imxrt_start.c @@ -282,6 +282,10 @@ void __start(void) imxrt_mpu_initialize(); #endif +#ifdef CONFIG_ARCH_PERF_EVENTS + up_perf_init((void *)BOARD_CPU_FREQUENCY); +#endif + /* Enable I- and D-Caches */ up_enable_icache();