From 9ad3c4f8d62bba234af84ee81cd73da639be7510 Mon Sep 17 00:00:00 2001 From: Luca Valente Date: Tue, 18 May 2021 19:48:58 +0200 Subject: [PATCH] hal: Add cpu_perf_start for cv32e40p --- include/hal/cv32e40p/cv32e40p.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/hal/cv32e40p/cv32e40p.h b/include/hal/cv32e40p/cv32e40p.h index 039b92d..59ae522 100644 --- a/include/hal/cv32e40p/cv32e40p.h +++ b/include/hal/cv32e40p/cv32e40p.h @@ -296,7 +296,23 @@ static inline void cpu_perf_conf(unsigned int confMask) * the rest of the config can be given through conf parameter */ static inline void cpu_perf_start() { #ifndef PLP_NO_PERF_COUNTERS + // enable all counters asm volatile("csrc 0x320, %0" : : "r"(0xffffffff)); + // arbitrary association of one event to one counter, + // just the implemented ones will increase + asm volatile("csrw 0x323, %0" : : "r"(1<