diff options
Diffstat (limited to '')
-rw-r--r-- | testsuites/sptests/spstkalloc02/init.c | 22 |
1 files changed, 21 insertions, 1 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); |