summaryrefslogtreecommitdiffstats
path: root/cpukit/include/rtems/confdefs/wkspace.h
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/include/rtems/confdefs/wkspace.h')
-rw-r--r--cpukit/include/rtems/confdefs/wkspace.h54
1 files changed, 53 insertions, 1 deletions
diff --git a/cpukit/include/rtems/confdefs/wkspace.h b/cpukit/include/rtems/confdefs/wkspace.h
index 1db4f2d09d..65f66c5c48 100644
--- a/cpukit/include/rtems/confdefs/wkspace.h
+++ b/cpukit/include/rtems/confdefs/wkspace.h
@@ -10,7 +10,7 @@
*/
/*
- * Copyright (C) 2020, 2021 embedded brains GmbH (http://www.embedded-brains.de)
+ * Copyright (C) 2020, 2021 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -47,6 +47,7 @@
#include <rtems/confdefs/inittask.h>
#include <rtems/confdefs/initthread.h>
#include <rtems/confdefs/objectsposix.h>
+#include <rtems/confdefs/percpu.h>
#include <rtems/confdefs/threads.h>
#include <rtems/confdefs/wkspacesupport.h>
#include <rtems/score/coremsg.h>
@@ -111,8 +112,18 @@
+ 1024 * CONFIGURE_MEMORY_OVERHEAD \
+ _CONFIGURE_HEAP_HANDLER_OVERHEAD )
+#if defined(CONFIGURE_IDLE_TASK_STORAGE_SIZE) || \
+ defined(CONFIGURE_TASK_STACK_ALLOCATOR_FOR_IDLE)
+ #define _CONFIGURE_IDLE_TASK_STACKS 0
+#else
+ #define _CONFIGURE_IDLE_TASK_STACKS \
+ ( _CONFIGURE_MAXIMUM_PROCESSORS * \
+ _Configure_From_stackspace( CONFIGURE_IDLE_TASK_STACK_SIZE ) )
+#endif
+
#define _CONFIGURE_STACK_SPACE_SIZE \
( _CONFIGURE_INIT_TASK_STACK_EXTRA \
+ + _CONFIGURE_IDLE_TASK_STACKS \
+ _CONFIGURE_POSIX_INIT_THREAD_STACK_EXTRA \
+ _CONFIGURE_LIBBLOCK_TASKS_STACK_EXTRA \
+ CONFIGURE_EXTRA_TASK_STACKS \
@@ -167,12 +178,14 @@ const uintptr_t _Stack_Space_size = _CONFIGURE_STACK_SPACE_SIZE;
#pragma GCC diagnostic ignored "-Wpragmas"
#pragma GCC diagnostic ignored "-Wtautological-pointer-compare"
+ /* Custom allocator may or may not use the work space. */
#ifdef CONFIGURE_TASK_STACK_ALLOCATOR_AVOIDS_WORK_SPACE
const bool _Stack_Allocator_avoids_workspace = true;
#else
const bool _Stack_Allocator_avoids_workspace = false;
#endif
+ /* Custom allocator may or may not need initialization. */
#ifdef CONFIGURE_TASK_STACK_ALLOCATOR_INIT
const Stack_Allocator_initialize _Stack_Allocator_initialize =
_CONFIGURE_ASSERT_NOT_NULL(
@@ -187,6 +200,7 @@ const uintptr_t _Stack_Space_size = _CONFIGURE_STACK_SPACE_SIZE;
);
#endif
+ /* Custom allocator must include allocate and free */
const Stack_Allocator_allocate _Stack_Allocator_allocate =
_CONFIGURE_ASSERT_NOT_NULL(
Stack_Allocator_allocate,
@@ -200,11 +214,49 @@ const uintptr_t _Stack_Space_size = _CONFIGURE_STACK_SPACE_SIZE;
);
#pragma GCC diagnostic pop
+
+/*
+ * Must provide both a custom stack allocator and deallocator
+ */
#elif defined(CONFIGURE_TASK_STACK_ALLOCATOR) \
|| defined(CONFIGURE_TASK_STACK_DEALLOCATOR)
#error "CONFIGURE_TASK_STACK_ALLOCATOR and CONFIGURE_TASK_STACK_DEALLOCATOR must be both defined or both undefined"
#endif
+#ifdef CONFIGURE_IDLE_TASK_STORAGE_SIZE
+ #ifdef CONFIGURE_TASK_STACK_ALLOCATOR_FOR_IDLE
+ #error "CONFIGURE_IDLE_TASK_STORAGE_SIZE and CONFIGURE_TASK_STACK_ALLOCATOR_FOR_IDLE are mutually exclusive"
+ #endif
+
+ #define _CONFIGURE_IDLE_TASK_STORAGE_SIZE \
+ RTEMS_ALIGN_UP( \
+ RTEMS_TASK_STORAGE_SIZE( \
+ CONFIGURE_IDLE_TASK_STORAGE_SIZE, \
+ RTEMS_DEFAULT_ATTRIBUTES \
+ ), \
+ CPU_INTERRUPT_STACK_ALIGNMENT \
+ )
+
+ const size_t _Stack_Allocator_allocate_for_idle_storage_size =
+ _CONFIGURE_IDLE_TASK_STORAGE_SIZE;
+
+ char _Stack_Allocator_allocate_for_idle_storage_areas[
+ _CONFIGURE_MAXIMUM_PROCESSORS * _CONFIGURE_IDLE_TASK_STORAGE_SIZE
+ ] RTEMS_ALIGNED( CPU_INTERRUPT_STACK_ALIGNMENT )
+ RTEMS_SECTION( ".rtemsstack.idle" );
+
+ #define CONFIGURE_TASK_STACK_ALLOCATOR_FOR_IDLE \
+ _Stack_Allocator_allocate_for_idle_static
+#endif
+
+#ifndef CONFIGURE_TASK_STACK_ALLOCATOR_FOR_IDLE
+ #define CONFIGURE_TASK_STACK_ALLOCATOR_FOR_IDLE \
+ _Stack_Allocator_allocate_for_idle_workspace
+#endif
+
+const Stack_Allocator_allocate_for_idle _Stack_Allocator_allocate_for_idle =
+ CONFIGURE_TASK_STACK_ALLOCATOR_FOR_IDLE;
+
#ifdef CONFIGURE_DIRTY_MEMORY
RTEMS_SYSINIT_ITEM(
_Memory_Dirty_free_areas,