From 0aa74332d4377f7584138c7a72b5265615e60db8 Mon Sep 17 00:00:00 2001 From: Kelvin Lawson Date: Thu, 7 Mar 2013 02:59:35 +0000 Subject: [PATCH] ARM: Increase stack size above 1KB on ARM as printf() observed to use ~1700 bytes on GCC toolchain used during development. --- ports/arm/atomport-tests.h | 4 ++-- ports/arm/tests-main.c | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ports/arm/atomport-tests.h b/ports/arm/atomport-tests.h index 5df864b..1c52be9 100644 --- a/ports/arm/atomport-tests.h +++ b/ports/arm/atomport-tests.h @@ -48,8 +48,8 @@ extern void dbg_format_msg (char *format, ...) ; */ #define _STR(x) x -/* Default thread stack size (in bytes) */ -#define TEST_THREAD_STACK_SIZE 1024 +/* Default thread stack size (in bytes). Allow plenty for printf(). */ +#define TEST_THREAD_STACK_SIZE 4096 /* Uncomment to enable logging of stack usage to UART */ /* #define TESTS_LOG_STACK_USAGE */ diff --git a/ports/arm/tests-main.c b/ports/arm/tests-main.c index f345321..a157d54 100644 --- a/ports/arm/tests-main.c +++ b/ports/arm/tests-main.c @@ -63,8 +63,13 @@ * stack saves and context switch saves, but the application main thread * will generally be carrying out more nested function calls and require * stack for application code local variables etc. + * + * 1KB might be adequate but if using printf() then at least 2KB would be + * prudent otherwise the stdio functions otherwise stack overruns are + * likely. Nearly 2KB was seen to be used on the toolchain used for + * development. */ -#define MAIN_STACK_SIZE_BYTES 1024 +#define MAIN_STACK_SIZE_BYTES 4096 /* Local data */