From 7c9f464b708f8b6a1ba31d08fd65a069a288f13a Mon Sep 17 00:00:00 2001 From: Nicolas Pitre Date: Fri, 14 Mar 2025 22:50:46 -0400 Subject: [PATCH] kernel: kheap: workaround for Percepio's TraceRecorder kludge In .../modules/debug/percepio/TraceRecorder/kernelports/Zephyr/include/\ tracing_tracerecorder.h there is a concealed non-parameterized direct reference to a local variable that is no longer in scope. Provide a dummy stub for compilation to succeed until that module's layering violation is fixed, after which this could be reverted. Signed-off-by: Nicolas Pitre --- kernel/kheap.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/kernel/kheap.c b/kernel/kheap.c index 548a417b4d9..90aa3b0ee1f 100644 --- a/kernel/kheap.c +++ b/kernel/kheap.c @@ -125,6 +125,15 @@ void *k_heap_aligned_alloc(struct k_heap *heap, size_t align, size_t bytes, void *ret = z_heap_alloc_helper(heap, align, bytes, timeout, sys_heap_aligned_alloc); + /* + * modules/debug/percepio/TraceRecorder/kernelports/Zephyr/include/tracing_tracerecorder.h + * contains a concealed non-parameterized direct reference to a local + * variable through the SYS_PORT_TRACING_OBJ_FUNC_EXIT macro below + * that is no longer in scope. Provide a dummy stub for compilation + * to still succeed until that module's layering violation is fixed. + */ + bool blocked_alloc = false; ARG_UNUSED(blocked_alloc); + SYS_PORT_TRACING_OBJ_FUNC_EXIT(k_heap, aligned_alloc, heap, timeout, ret); return ret;