summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2020-11-19 08:40:13 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2020-11-19 17:41:07 +0100
commitc5af8aa0704d52e1d9757b863ed2831282642a56 (patch)
tree6acda4c1d3e99d2b51bc3bcdd501725bcca11891 /cpukit
parentvalidation/ts-performance-0: Add partition tests (diff)
downloadrtems-c5af8aa0704d52e1d9757b863ed2831282642a56.tar.bz2
config: Simplify task stack allocator init
Replace runtime checks with compile time assertions. This makes the INTERNAL_ERROR_BAD_STACK_HOOK obsolete.
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/include/rtems/confdefs/wkspace.h18
-rw-r--r--cpukit/include/rtems/score/interr.h2
-rw-r--r--cpukit/score/src/stackallocatorinit.c8
3 files changed, 19 insertions, 9 deletions
diff --git a/cpukit/include/rtems/confdefs/wkspace.h b/cpukit/include/rtems/confdefs/wkspace.h
index d40194cbec..81d172815e 100644
--- a/cpukit/include/rtems/confdefs/wkspace.h
+++ b/cpukit/include/rtems/confdefs/wkspace.h
@@ -137,6 +137,12 @@ const uintptr_t _Stack_Space_size = _CONFIGURE_STACK_SPACE_SIZE;
#if defined(CONFIGURE_TASK_STACK_ALLOCATOR) \
&& defined(CONFIGURE_TASK_STACK_DEALLOCATOR)
+ /* Ignore potential warnings from the static assertions below */
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Waddress"
+ #pragma GCC diagnostic ignored "-Wpragmas"
+ #pragma GCC diagnostic ignored "-Wtautological-pointer-compare"
+
#ifdef CONFIGURE_TASK_STACK_ALLOCATOR_AVOIDS_WORK_SPACE
const bool _Stack_Allocator_avoids_workspace = true;
#else
@@ -150,9 +156,19 @@ const uintptr_t _Stack_Space_size = _CONFIGURE_STACK_SPACE_SIZE;
const Stack_Allocator_initialize _Stack_Allocator_initialize = NULL;
#endif
+ RTEMS_STATIC_ASSERT(
+ CONFIGURE_TASK_STACK_ALLOCATOR != NULL,
+ CONFIGURE_TASK_STACK_ALLOCATOR_MUST_NOT_BE_NULL
+ );
+
const Stack_Allocator_allocate _Stack_Allocator_allocate =
CONFIGURE_TASK_STACK_ALLOCATOR;
+ RTEMS_STATIC_ASSERT(
+ CONFIGURE_TASK_STACK_DEALLOCATOR != NULL,
+ CONFIGURE_TASK_STACK_DEALLOCATOR_MUST_NOT_BE_NULL
+ );
+
const Stack_Allocator_free _Stack_Allocator_free =
CONFIGURE_TASK_STACK_DEALLOCATOR;
@@ -161,6 +177,8 @@ const uintptr_t _Stack_Space_size = _CONFIGURE_STACK_SPACE_SIZE;
RTEMS_SYSINIT_DIRTY_MEMORY,
RTEMS_SYSINIT_ORDER_MIDDLE
);
+
+ #pragma GCC diagnostic pop
#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"
diff --git a/cpukit/include/rtems/score/interr.h b/cpukit/include/rtems/score/interr.h
index 85767d0bc5..4b06199ae9 100644
--- a/cpukit/include/rtems/score/interr.h
+++ b/cpukit/include/rtems/score/interr.h
@@ -177,7 +177,7 @@ typedef enum {
INTERNAL_ERROR_OUT_OF_GLOBAL_OBJECTS = 11,
INTERNAL_ERROR_OUT_OF_PROXIES = 12,
INTERNAL_ERROR_INVALID_GLOBAL_ID = 13,
- INTERNAL_ERROR_BAD_STACK_HOOK = 14,
+ /* INTERNAL_ERROR_BAD_STACK_HOOK = 14, */
/* INTERNAL_ERROR_BAD_ATTRIBUTES = 15, */
/* INTERNAL_ERROR_IMPLEMENTATION_KEY_CREATE_INCONSISTENCY = 16, */
/* INTERNAL_ERROR_IMPLEMENTATION_BLOCKING_OPERATION_CANCEL = 17, */
diff --git a/cpukit/score/src/stackallocatorinit.c b/cpukit/score/src/stackallocatorinit.c
index 60d243631f..412e3142b3 100644
--- a/cpukit/score/src/stackallocatorinit.c
+++ b/cpukit/score/src/stackallocatorinit.c
@@ -38,20 +38,12 @@
#endif
#include <rtems/score/stack.h>
-#include <rtems/score/interr.h>
#include <rtems/config.h>
void _Stack_Allocator_do_initialize( void )
{
rtems_stack_allocate_init_hook init_hook;
- if (
- rtems_configuration_get_stack_allocate_hook() == NULL
- || rtems_configuration_get_stack_free_hook() == NULL
- ) {
- _Internal_error( INTERNAL_ERROR_BAD_STACK_HOOK );
- }
-
init_hook = rtems_configuration_get_stack_allocate_init_hook();
if ( init_hook != NULL ) {