diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2019-12-13 06:18:36 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-02-04 06:06:41 +0100 |
commit | eea21eaca117ecd98afea164e1808d6530ef487f (patch) | |
tree | ca4e15da28b71a5ecca5fc357798261a39b3f250 /testsuites/smptests/smpfatal09 | |
parent | bsps: Remove uses of BSP_GET_WORK_AREA_DEBUG (diff) | |
download | rtems-eea21eaca117ecd98afea164e1808d6530ef487f.tar.bz2 |
bsps: Rework work area initialization
The work area initialization was done by the BSP through
bsp_work_area_initialize(). This approach predated the system
initialization through the system initialization linker set. The
workspace and C program heap were unconditionally initialized. The aim
is to support RTEMS application configurations which do not need the
workspace and C program heap. In these configurations, the workspace
and C prgram heap should not get initialized.
Change all bsp_work_area_initialize() to implement _Memory_Get()
instead. Move the dirty memory, sbrk(), per-CPU data, workspace, and
malloc() heap initialization into separate system initialization steps.
This makes it also easier to test the individual initialization steps.
This change adds a dependency to _Heap_Extend() to all BSPs. This
dependency will be removed in a follow up change.
Update #3838.
Diffstat (limited to 'testsuites/smptests/smpfatal09')
-rw-r--r-- | testsuites/smptests/smpfatal09/init.c | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/testsuites/smptests/smpfatal09/init.c b/testsuites/smptests/smpfatal09/init.c index ecbb54d586..3ef93921b2 100644 --- a/testsuites/smptests/smpfatal09/init.c +++ b/testsuites/smptests/smpfatal09/init.c @@ -31,7 +31,8 @@ #include <rtems.h> #include <rtems/score/percpudata.h> -#include <rtems/score/wkspace.h> +#include <rtems/score/memory.h> +#include <rtems/sysinit.h> #include <tmacros.h> @@ -41,7 +42,26 @@ const char rtems_test_name[] = "SMPFATAL 9"; static void Init( rtems_task_argument arg ) { - Heap_Area area = { .begin = NULL, .size = 0 }; + (void) arg; +} + +static void consume_all_memory( void ) +{ + const Memory_Information *mem; + size_t i; + + mem = _Memory_Get(); + + for ( i = 0; i < _Memory_Get_count( mem ); ++i ) { + Memory_Area *area; + + area = _Memory_Get_area( mem, i ); + _Memory_Consume( area, _Memory_Get_free_size( area ) ); + } +} + +static void begin_test( void ) +{ int i; TEST_BEGIN(); @@ -49,10 +69,15 @@ static void Init( rtems_task_argument arg ) RTEMS_OBFUSCATE_VARIABLE( i ); rtems_test_assert( i == 123 ); - _Workspace_Handler_initialization( &area, 1, NULL ); - rtems_test_assert( 0 ); + consume_all_memory(); } +RTEMS_SYSINIT_ITEM( + begin_test, + RTEMS_SYSINIT_PER_CPU_DATA, + RTEMS_SYSINIT_ORDER_FIRST +); + static void fatal_extension( rtems_fatal_source source, bool always_set_to_false, |