From dd73ba960144e1d7344ecc970ac8df5b04a307e2 Mon Sep 17 00:00:00 2001 From: Mahavir Jain Date: Fri, 11 Jun 2021 13:08:11 +0530 Subject: [PATCH] heap: use hal specific API to get cpu cycles count This fixes compilation issue of heap tracing feature for RISC-V architecture. --- components/heap/Kconfig | 2 ++ components/heap/include/heap_trace.inc | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/components/heap/Kconfig b/components/heap/Kconfig index 34c044fc69..5b9dc56189 100644 --- a/components/heap/Kconfig +++ b/components/heap/Kconfig @@ -45,6 +45,8 @@ menu "Heap memory debugging" config HEAP_TRACING_STACK_DEPTH int "Heap tracing stack depth" + range 0 0 if IDF_TARGET_ARCH_RISCV # Disabled for RISC-V due to `__builtin_return_address` limitation + default 0 if IDF_TARGET_ARCH_RISCV range 0 10 default 2 depends on HEAP_TRACING diff --git a/components/heap/include/heap_trace.inc b/components/heap/include/heap_trace.inc index e6a039530b..6f78928549 100644 --- a/components/heap/include/heap_trace.inc +++ b/components/heap/include/heap_trace.inc @@ -19,7 +19,7 @@ /* Encode the CPU ID in the LSB of the ccount value */ inline static uint32_t get_ccount(void) { - uint32_t ccount = xthal_get_ccount() & ~3; + uint32_t ccount = cpu_hal_get_cycle_count() & ~3; #ifndef CONFIG_FREERTOS_UNICORE ccount |= xPortGetCoreID(); #endif