5
Last change
on this file since eea21eac was
eea21eac,
checked in by Sebastian Huber <sebastian.huber@…>, on 12/13/19 at 05:18:36
|
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.
|
-
Property mode set to
100644
|
File size:
1.3 KB
|
Rev | Line | |
---|
[1a48cbf] | 1 | #ifdef HAVE_CONFIG_H |
---|
| 2 | #include "config.h" |
---|
| 3 | #endif |
---|
| 4 | |
---|
| 5 | #include "../spfatal_support/spfatal.h" |
---|
| 6 | |
---|
[d329acf4] | 7 | /* Test __assert_func with NULL function name |
---|
| 8 | * |
---|
| 9 | * COPYRIGHT (c) 1989-2009. |
---|
| 10 | * On-Line Applications Research Corporation (OAR). |
---|
| 11 | * |
---|
| 12 | * The license and distribution terms for this file may be |
---|
| 13 | * found in the file LICENSE in this distribution or at |
---|
[c499856] | 14 | * http://www.rtems.org/license/LICENSE. |
---|
[d329acf4] | 15 | */ |
---|
| 16 | |
---|
[a9127a2e] | 17 | #include <rtems/score/wkspace.h> |
---|
[eea21eac] | 18 | #include <rtems/score/memory.h> |
---|
| 19 | #include <rtems/sysinit.h> |
---|
[a9127a2e] | 20 | |
---|
[d329acf4] | 21 | #define FATAL_ERROR_TEST_NAME "12" |
---|
| 22 | #define FATAL_ERROR_DESCRIPTION \ |
---|
| 23 | "_Heap_Initialize fails during RTEMS initialization" |
---|
| 24 | #define FATAL_ERROR_EXPECTED_SOURCE INTERNAL_ERROR_CORE |
---|
| 25 | #define FATAL_ERROR_EXPECTED_ERROR INTERNAL_ERROR_TOO_LITTLE_WORKSPACE |
---|
| 26 | |
---|
[eea21eac] | 27 | static void force_error( void ) |
---|
[d329acf4] | 28 | { |
---|
[eea21eac] | 29 | void *p; |
---|
[d329acf4] | 30 | |
---|
| 31 | /* we will not run this far */ |
---|
[eea21eac] | 32 | p = _Workspace_Allocate( 1 ); |
---|
| 33 | RTEMS_OBFUSCATE_VARIABLE( p ); |
---|
[d329acf4] | 34 | } |
---|
[1a48cbf] | 35 | |
---|
[eea21eac] | 36 | static void consume_all_memory( void ) |
---|
| 37 | { |
---|
| 38 | const Memory_Information *mem; |
---|
| 39 | size_t i; |
---|
| 40 | |
---|
| 41 | mem = _Memory_Get(); |
---|
| 42 | |
---|
| 43 | for ( i = 0; i < _Memory_Get_count( mem ); ++i ) { |
---|
| 44 | Memory_Area *area; |
---|
| 45 | |
---|
| 46 | area = _Memory_Get_area( mem, i ); |
---|
| 47 | _Memory_Consume( area, _Memory_Get_free_size( area ) ); |
---|
| 48 | } |
---|
| 49 | } |
---|
| 50 | |
---|
| 51 | RTEMS_SYSINIT_ITEM( |
---|
| 52 | consume_all_memory, |
---|
| 53 | RTEMS_SYSINIT_WORKSPACE, |
---|
| 54 | RTEMS_SYSINIT_ORDER_FIRST |
---|
| 55 | ); |
---|
| 56 | |
---|
[1a48cbf] | 57 | #include "../spfatal_support/spfatalimpl.h" |
---|
Note: See
TracBrowser
for help on using the repository browser.