summaryrefslogtreecommitdiffstats
path: root/cpukit/score
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2019-12-09 16:03:11 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2020-02-12 09:08:36 +0100
commit32991495b48d1b5e4804b2f10a67a800f4608e75 (patch)
tree2a05470107f3a8918689b9ed4c94760f08a2631a /cpukit/score
parentscore: Move thread stack allocation (diff)
downloadrtems-32991495b48d1b5e4804b2f10a67a800f4608e75.tar.bz2
score: Statically allocate idle/MPCI stacks
Place idle and MPCI stacks into extra linker sections. This can be optionally used by applications to control the placement of the stacks. Update #3835.
Diffstat (limited to 'cpukit/score')
-rw-r--r--cpukit/score/src/mpci.c7
-rw-r--r--cpukit/score/src/mpcidefault.c8
-rw-r--r--cpukit/score/src/threadcreateidle.c11
3 files changed, 16 insertions, 10 deletions
diff --git a/cpukit/score/src/mpci.c b/cpukit/score/src/mpci.c
index 1f9b838796..f173eeb588 100644
--- a/cpukit/score/src/mpci.c
+++ b/cpukit/score/src/mpci.c
@@ -135,11 +135,10 @@ static void _MPCI_Create_server( void )
config.budget_algorithm = THREAD_CPU_BUDGET_ALGORITHM_NONE;
config.is_fp = CPU_ALL_TASKS_ARE_FP;
config.stack_size = _Stack_Minimum()
+ + _MPCI_Configuration.extra_mpci_receive_server_stack
+ CPU_MPCI_RECEIVE_SERVER_EXTRA_STACK
- + _MPCI_Configuration.extra_mpci_receive_server_stack;
- config.stack_size = _Stack_Extend_size( config.stack_size, config.is_fp );
- config.stack_area = _Stack_Allocate( config.stack_size );
- _Assert( config.stack_area != NULL );
+ + CPU_ALL_TASKS_ARE_FP * CONTEXT_FP_SIZE;
+ config.stack_area = _MPCI_Receive_server_stack;
ok = _Thread_Initialize(
&_Thread_Information,
diff --git a/cpukit/score/src/mpcidefault.c b/cpukit/score/src/mpcidefault.c
index fad806c5c1..395515759b 100644
--- a/cpukit/score/src/mpcidefault.c
+++ b/cpukit/score/src/mpcidefault.c
@@ -19,6 +19,7 @@
#endif
#include <rtems/score/mpci.h>
+#include <rtems/score/context.h>
#include <rtems/score/objectdata.h>
#include <rtems/score/stack.h>
#include <rtems/score/thread.h>
@@ -35,3 +36,10 @@ const MPCI_Configuration _MPCI_Configuration = {
STACK_MINIMUM_SIZE, /* MPCI receive server stack size */
NULL /* pointer to MPCI address table */
};
+
+char _MPCI_Receive_server_stack[
+ STACK_MINIMUM_SIZE
+ + CPU_MPCI_RECEIVE_SERVER_EXTRA_STACK
+ + CPU_ALL_TASKS_ARE_FP * CONTEXT_FP_SIZE
+] RTEMS_ALIGNED( CPU_INTERRUPT_STACK_ALIGNMENT )
+RTEMS_SECTION( ".rtemsstack.mpci" );
diff --git a/cpukit/score/src/threadcreateidle.c b/cpukit/score/src/threadcreateidle.c
index c06f211a6b..dbb2018bf8 100644
--- a/cpukit/score/src/threadcreateidle.c
+++ b/cpukit/score/src/threadcreateidle.c
@@ -51,12 +51,11 @@ static void _Thread_Create_idle_for_CPU( Per_CPU_Control *cpu )
config.name.name_u32 = _Objects_Build_name( 'I', 'D', 'L', 'E' );
config.is_fp = CPU_IDLE_TASK_IS_FP;
config.is_preemptible = true;
- config.stack_size = _Stack_Ensure_minimum(
- rtems_configuration_get_idle_task_stack_size()
- );
- config.stack_size = _Stack_Extend_size( config.stack_size, config.is_fp );
- config.stack_area = _Stack_Allocate( config.stack_size );
- _Assert( config.stack_area != NULL );
+ config.stack_size = rtems_configuration_get_idle_task_stack_size()
+ + CPU_IDLE_TASK_IS_FP * CONTEXT_FP_SIZE;
+ config.stack_area = &_Thread_Idle_stacks[
+ _Per_CPU_Get_index( cpu ) * config.stack_size
+ ];
/*
* The entire workspace is zeroed during its initialization. Thus, all