From e23102f5dcc9b32559ca4530abd8f54264e084b5 Mon Sep 17 00:00:00 2001 From: Andrew Boie Date: Thu, 20 Feb 2020 16:06:30 -0800 Subject: [PATCH] samples: pi: fix stack overflow This was silently corrupting memory on x86-64. Enable CONFIG_TEST so that this is detected properly, and increase the stack size appropriately. Signed-off-by: Andrew Boie --- samples/smp/pi/prj.conf | 3 +++ samples/smp/pi/src/main.c | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/samples/smp/pi/prj.conf b/samples/smp/pi/prj.conf index 7829564f9ad..e39bcae12e1 100644 --- a/samples/smp/pi/prj.conf +++ b/samples/smp/pi/prj.conf @@ -3,3 +3,6 @@ CONFIG_MAIN_THREAD_PRIORITY=11 # Enable SMP CONFIG_SMP=y + +# Enable assertions, stack overflow checking, etc +CONFIG_TEST=y diff --git a/samples/smp/pi/src/main.c b/samples/smp/pi/src/main.c index 97fc0cf0a6c..eae6a27ff15 100644 --- a/samples/smp/pi/src/main.c +++ b/samples/smp/pi/src/main.c @@ -17,7 +17,8 @@ #define DIGITS_NUM 240 #define LENGTH ((DIGITS_NUM / 4) * 14) -#define STACK_SIZE (LENGTH * sizeof(int) + 512) +#define STACK_SIZE ((LENGTH * sizeof(int) + 512) + \ + CONFIG_TEST_EXTRA_STACKSIZE) #ifdef CONFIG_SMP #define CORES_NUM CONFIG_MP_NUM_CPUS