diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-09-30 11:31:58 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-10-01 19:05:33 +0200 |
commit | f2185d109930fb5db31a5c228a3f46178072f270 (patch) | |
tree | 166d29b19bcf7ff01b4368f351e3fab52b750c19 /cpukit/include | |
parent | rtems: Canonicalize name and id checks (diff) | |
download | rtems-f2185d109930fb5db31a5c228a3f46178072f270.tar.bz2 |
Decouple the C Program Heap initialization
Before this patch RTEMS_Malloc_Initialize() had a fixed dependency on
_Workspace_Area. Introduce _Workspace_Malloc_initializer to have this
dependency only if CONFIGURE_UNIFIED_WORK_AREAS is defined by the
application configuration.
Diffstat (limited to 'cpukit/include')
-rw-r--r-- | cpukit/include/rtems/confdefs/wkspace.h | 3 | ||||
-rw-r--r-- | cpukit/include/rtems/malloc.h | 2 | ||||
-rw-r--r-- | cpukit/include/rtems/score/wkspacedata.h | 26 |
3 files changed, 30 insertions, 1 deletions
diff --git a/cpukit/include/rtems/confdefs/wkspace.h b/cpukit/include/rtems/confdefs/wkspace.h index 89d7c21b2a..d40194cbec 100644 --- a/cpukit/include/rtems/confdefs/wkspace.h +++ b/cpukit/include/rtems/confdefs/wkspace.h @@ -126,6 +126,9 @@ const uintptr_t _Workspace_Size = CONFIGURE_EXECUTIVE_RAM_SIZE; #ifdef CONFIGURE_UNIFIED_WORK_AREAS const bool _Workspace_Is_unified = true; + + struct Heap_Control *( * const _Workspace_Malloc_initializer )( void ) = + _Workspace_Malloc_initialize_unified; #endif uint32_t rtems_minimum_stack_size = CONFIGURE_MINIMUM_TASK_STACK_SIZE; diff --git a/cpukit/include/rtems/malloc.h b/cpukit/include/rtems/malloc.h index 34bdbcb91e..13e94ac38a 100644 --- a/cpukit/include/rtems/malloc.h +++ b/cpukit/include/rtems/malloc.h @@ -43,7 +43,7 @@ extern "C" { */ extern Heap_Control *RTEMS_Malloc_Heap; -void RTEMS_Malloc_Initialize( +Heap_Control *RTEMS_Malloc_Initialize( const Memory_Information *mem, Heap_Initialization_or_extend_handler extend ); diff --git a/cpukit/include/rtems/score/wkspacedata.h b/cpukit/include/rtems/score/wkspacedata.h index 613a320dfe..fd6fd1c1cb 100644 --- a/cpukit/include/rtems/score/wkspacedata.h +++ b/cpukit/include/rtems/score/wkspacedata.h @@ -43,6 +43,8 @@ extern "C" { #endif +struct Heap_Control; + /** * @addtogroup RTEMSScoreWorkspace * @@ -65,6 +67,30 @@ extern const uintptr_t _Workspace_Size; */ extern const bool _Workspace_Is_unified; +/** + * @brief Initializes the C Program Heap separated from the RTEMS Workspace. + * + * @return Returns the heap control used for the C Program Heap. + */ +struct Heap_Control *_Workspace_Malloc_initialize_separate( void ); + +/** + * @brief Initializes the C Program Heap so that it is unified with the RTEMS + * Workspace. + * + * @return Returns the heap control used for the C Program Heap. + */ +struct Heap_Control *_Workspace_Malloc_initialize_unified( void ); + +/** + * @brief This constant provides the C Program Heap initialization handler. + * + * This constant is defined by the application configuration option + * #CONFIGURE_UNIFIED_WORK_AREAS via <rtems/confdefs.h> or a default + * configuration. + */ +extern struct Heap_Control *( * const _Workspace_Malloc_initializer )( void ); + /** @} */ #ifdef __cplusplus |