From f74455127d3d595d0fe2638c6ead22933fe5a3ee Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 9 May 2023 09:58:38 -0700 Subject: [PATCH] libc/common: Refine check for xtensa _heap_sentry Not all xtensa targets define the top of usable RAM via the _heap_sentry address; it looks like the list is limited to esp32, esp32s2, esp32s3 and intel parts. The first three all define HAS_ESPRESSIF_HAL, so key the test using that or SOC_FAMILY_INTEL_ADSP. Signed-off-by: Keith Packard --- lib/libc/common/source/stdlib/malloc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/libc/common/source/stdlib/malloc.c b/lib/libc/common/source/stdlib/malloc.c index e87a633cfe0..7a2fee6aa2f 100644 --- a/lib/libc/common/source/stdlib/malloc.c +++ b/lib/libc/common/source/stdlib/malloc.c @@ -99,7 +99,8 @@ static POOL_SECTION unsigned char __aligned(HEAP_ALIGN) malloc_arena[HEAP_SIZE]; # define HEAP_BASE ROUND_UP(USED_RAM_END_ADDR, HEAP_ALIGN) -# ifdef CONFIG_XTENSA +# if defined(CONFIG_XTENSA) && (defined(CONFIG_SOC_FAMILY_INTEL_ADSP) \ + || defined(CONFIG_HAS_ESPRESSIF_HAL)) extern char _heap_sentry[]; # define HEAP_SIZE ROUND_DOWN((POINTER_TO_UINT(_heap_sentry) - HEAP_BASE), HEAP_ALIGN) # else