summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/stackallocatorforidle.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2022-09-30 08:06:18 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2022-10-14 10:48:23 +0200
commit45ee958552ca35b6834985718ecd59b27fc52f86 (patch)
tree5d66e79cf20491f0f1b8f32b292a5a398d386ce4 /cpukit/score/src/stackallocatorforidle.c
parentstackchk01: Check CPU_STACK_MINIMUM_SIZE (diff)
downloadrtems-45ee958552ca35b6834985718ecd59b27fc52f86.tar.bz2
config: Add CONFIGURE_IDLE_TASK_STORAGE_SIZE
By default, allocate the IDLE task storage areas from the RTEMS Workspace. This avoids having to estimate the thread-local storage size in the default configuration. Add the application configuration option CONFIGURE_IDLE_TASK_STORAGE_SIZE to request a static allocation of the task storage area for IDLE tasks. Update #3835. Update #4524.
Diffstat (limited to 'cpukit/score/src/stackallocatorforidle.c')
-rw-r--r--cpukit/score/src/stackallocatorforidle.c43
1 files changed, 19 insertions, 24 deletions
diff --git a/cpukit/score/src/stackallocatorforidle.c b/cpukit/score/src/stackallocatorforidle.c
index c97dde030f..c8c8c0b766 100644
--- a/cpukit/score/src/stackallocatorforidle.c
+++ b/cpukit/score/src/stackallocatorforidle.c
@@ -1,6 +1,15 @@
-/*
- * SPDX-License-Identifier: BSD-2-Clause
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @ingroup RTEMSScoreStack
*
+ * @brief This source file contains the implementation of
+ * _Stack_Allocator_allocate_for_idle_static().
+ */
+
+/*
* Copyright (C) 2021 On-Line Applications Research Corporation (OAR)
*
* Redistribution and use in source and binary forms, with or without
@@ -30,35 +39,21 @@
#endif
#include <rtems/score/stack.h>
-#include <rtems/score/thread.h>
#include <rtems/score/assert.h>
-/**
- * @brief Default stack allocator allocate for IDLE threads.
- *
- * The default allocator for IDLE thread stacks gets the memory from a
- * statically allocated area provided via confdefs.h.
- *
- * @param cpu is the index of the CPU for the IDLE thread using this stack.
- *
- * @param stack_size[in] is pointer to a size_t object. On function
- * entry, the object contains the size of the stack area to allocate in
- * bytes.
- *
- * @return Returns the pointer to begin of the allocated stack area.
- */
-static void *_Stack_Allocator_allocate_for_idle_default(
+void *_Stack_Allocator_allocate_for_idle_static(
uint32_t cpu_index,
- size_t *stack_size
+ size_t *storage_size
)
{
+ size_t size;
+
+ size = _Stack_Allocator_allocate_for_idle_storage_size;
+ *storage_size = size;
#if defined(RTEMS_SMP)
- return &_Thread_Idle_stacks[ cpu_index * ( *stack_size ) ];
+ return &_Stack_Allocator_allocate_for_idle_storage_areas[ cpu_index * size ];
#else
_Assert( cpu_index == 0 );
- return &_Thread_Idle_stacks[ 0 ];
+ return &_Stack_Allocator_allocate_for_idle_storage_areas[ 0 ];
#endif
}
-
-const Stack_Allocator_allocate_for_idle _Stack_Allocator_allocate_for_idle =
- _Stack_Allocator_allocate_for_idle_default;