summaryrefslogtreecommitdiffstats
path: root/testsuites/sptests/spstkalloc02
diff options
context:
space:
mode:
Diffstat (limited to 'testsuites/sptests/spstkalloc02')
-rw-r--r--testsuites/sptests/spstkalloc02/init.c22
-rw-r--r--testsuites/sptests/spstkalloc02/spstkalloc02.doc4
2 files changed, 23 insertions, 3 deletions
diff --git a/testsuites/sptests/spstkalloc02/init.c b/testsuites/sptests/spstkalloc02/init.c
index 5e5db20f0f..30803bfc8e 100644
--- a/testsuites/sptests/spstkalloc02/init.c
+++ b/testsuites/sptests/spstkalloc02/init.c
@@ -9,7 +9,7 @@
*/
/*
- * Copyright (c) 2011 embedded brains GmbH. All rights reserved.
+ * Copyright (c) 2011 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -44,6 +44,7 @@ const char rtems_test_name[] = "SPSTKALLOC 2";
#include <stdio.h>
#include <inttypes.h>
+#include <rtems/malloc.h>
#include <rtems/score/heapimpl.h>
#define TASK_COUNT 5
@@ -56,6 +57,8 @@ static void task_stack_init(size_t stack_space_size);
static void *task_stack_allocate(size_t stack_size);
+static void *task_stack_allocate_for_idle(uint32_t unused, size_t *stack_size);
+
static void task_stack_free(void *addr);
static void print_info(void)
@@ -138,10 +141,18 @@ static rtems_task Init(rtems_task_argument argument)
*/
#define CONFIGURE_APPLICATION_DISABLE_FILESYSTEM
+/*
+ * This test requires full control over the present thread-local objects. This
+ * is necessary for the custom stack allocator below. In certain Newlib
+ * configurations, the Newlib reentrancy support may add thread-local objects.
+ */
+#define CONFIGURE_DISABLE_NEWLIB_REENTRANCY
+
#define CONFIGURE_MAXIMUM_TASKS TASK_COUNT
#define CONFIGURE_TASK_STACK_ALLOCATOR_INIT task_stack_init
#define CONFIGURE_TASK_STACK_ALLOCATOR task_stack_allocate
+#define CONFIGURE_TASK_STACK_ALLOCATOR_FOR_IDLE task_stack_allocate_for_idle
#define CONFIGURE_TASK_STACK_DEALLOCATOR task_stack_free
#define CONFIGURE_TASK_STACK_ALLOCATOR_AVOIDS_WORK_SPACE
#define CONFIGURE_TASK_STACK_FROM_ALLOCATOR(stack_size) \
@@ -176,6 +187,15 @@ static void *task_stack_allocate(size_t stack_size)
return _Heap_Allocate(&task_stack_heap, stack_size);
}
+static void *task_stack_allocate_for_idle(uint32_t unused, size_t *stack_size)
+{
+ return rtems_heap_allocate_aligned_with_boundary(
+ *stack_size,
+ CPU_STACK_ALIGNMENT,
+ 0
+ );
+}
+
static void task_stack_free(void *addr)
{
_Heap_Free(&task_stack_heap, addr);
diff --git a/testsuites/sptests/spstkalloc02/spstkalloc02.doc b/testsuites/sptests/spstkalloc02/spstkalloc02.doc
index a2dd0357ba..96cdfb52c2 100644
--- a/testsuites/sptests/spstkalloc02/spstkalloc02.doc
+++ b/testsuites/sptests/spstkalloc02/spstkalloc02.doc
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: BSD-2-Clause
-# Copyright (c) 2011 embedded brains GmbH.
+# Copyright (c) 2011 embedded brains GmbH & Co. KG
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@@ -26,7 +26,7 @@
This file describes the directives and concepts tested by this test set.
-test set name: spstkalloc01
+test set name: spstkalloc02
The test expects that no thread-local object is present.