From ba92372b8d754cf65917a560cd27e4088548de0e Mon Sep 17 00:00:00 2001 From: deepikabhavnani Date: Thu, 13 Dec 2018 13:54:51 -0600 Subject: [PATCH] CMSIS/RTX: Move Idle and Timer thread stack to bss section. In case of ARM compiler, idle and timer thread stack though assigned to `.bss.os` section since not zero initialized are part of `data` section. In this commit, we are moving stacks of idle and timer thread to bss section and thereby saving ROM space. --- rtos/TARGET_CORTEX/rtx5/RTX/Source/rtx_lib.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/rtos/TARGET_CORTEX/rtx5/RTX/Source/rtx_lib.c b/rtos/TARGET_CORTEX/rtx5/RTX/Source/rtx_lib.c index 8fe704f80e..5b73431d81 100644 --- a/rtos/TARGET_CORTEX/rtx5/RTX/Source/rtx_lib.c +++ b/rtos/TARGET_CORTEX/rtx5/RTX/Source/rtx_lib.c @@ -122,9 +122,12 @@ static osRtxThread_t os_idle_thread_cb \ __attribute__((section(".bss.os.thread.cb"))); // Idle Thread Stack +#if defined (__CC_ARM) +static uint64_t os_idle_thread_stack[OS_IDLE_THREAD_STACK_SIZE/8]; +#else static uint64_t os_idle_thread_stack[OS_IDLE_THREAD_STACK_SIZE/8] \ __attribute__((section(".bss.os.thread.stack"))); - +#endif // Idle Thread Attributes static const osThreadAttr_t os_idle_thread_attr = { #if defined(OS_IDLE_THREAD_NAME) @@ -178,9 +181,13 @@ __attribute__((section(".data.os.timer.mpi"))) = static osRtxThread_t os_timer_thread_cb \ __attribute__((section(".bss.os.thread.cb"))); +#if defined (__CC_ARM) +static uint64_t os_timer_thread_stack[OS_TIMER_THREAD_STACK_SIZE/8]; +#else // Timer Thread Stack static uint64_t os_timer_thread_stack[OS_TIMER_THREAD_STACK_SIZE/8] \ __attribute__((section(".bss.os.thread.stack"))); +#endif // Timer Thread Attributes static const osThreadAttr_t os_timer_thread_attr = {