This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 4fc2b81aa82114bfa58282bfc90af6c88e9e2d0d
Author: Marco Casaroli <[email protected]>
AuthorDate: Tue Nov 3 21:45:47 2026 +0100

    arch/arm/mps: Start the perf counter with ARCH_PERF_EVENTS.
    
    The MPS boards never call up_perf_init(), so the DWT cycle counter does
    not run and its rate stays ULONG_MAX.  With ARCH_PERF_EVENTS (the
    default with SCHED_CRITMONITOR) all perf times are then 0.
    
    Call up_perf_init() in __start() with the processor clock
    (MPS_SYSTICK_CLOCK), as the other Cortex-M chips do.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <[email protected]>
---
 arch/arm/src/mps/mps_start.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/src/mps/mps_start.c b/arch/arm/src/mps/mps_start.c
index ee5f5b0d460..7df3063fc27 100644
--- a/arch/arm/src/mps/mps_start.c
+++ b/arch/arm/src/mps/mps_start.c
@@ -187,6 +187,10 @@ void __start(void)
   up_enable_icache();
   up_enable_dcache();
 
+#ifdef CONFIG_ARCH_PERF_EVENTS
+  up_perf_init((void *)MPS_SYSTICK_CLOCK);
+#endif
+
   /* Then start NuttX */
 
   nx_start();

Reply via email to