From e766f7dca502b8849a8f24dd79d625b5f3b6ddd4 Mon Sep 17 00:00:00 2001 From: Petteri Aimonen Date: Tue, 23 Jun 2020 14:24:44 +0300 Subject: [PATCH] stackusage test case: fix problem caused by compiler inlining --- tests/stackusage/stackusage.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/stackusage/stackusage.c b/tests/stackusage/stackusage.c index 7d08fa7a..1d48b361 100644 --- a/tests/stackusage/stackusage.c +++ b/tests/stackusage/stackusage.c @@ -20,8 +20,7 @@ static volatile uint32_t *g_stackptr; void start_stack_measuring() { uint32_t i = 0; - uint32_t stackfill[MAX_STACK_ENTRIES]; - g_stackptr = stackfill; + g_stackptr = (volatile uint32_t*)((uintptr_t)&i - MAX_STACK_ENTRIES * sizeof(uint32_t)); for (i = 0; i < MAX_STACK_ENTRIES; i++) { g_stackbuf[i] = g_stackptr[i];