summaryrefslogtreecommitdiffstats
path: root/bsps/include
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2019-12-13 06:18:36 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2020-02-04 06:06:41 +0100
commiteea21eaca117ecd98afea164e1808d6530ef487f (patch)
treeca4e15da28b71a5ecca5fc357798261a39b3f250 /bsps/include
parentbsps: Remove uses of BSP_GET_WORK_AREA_DEBUG (diff)
downloadrtems-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 'bsps/include')
-rw-r--r--bsps/include/bsp/bootcard.h62
1 files changed, 1 insertions, 61 deletions
diff --git a/bsps/include/bsp/bootcard.h b/bsps/include/bsp/bootcard.h
index 6121ff9ba1..e3eed8da46 100644
--- a/bsps/include/bsp/bootcard.h
+++ b/bsps/include/bsp/bootcard.h
@@ -21,11 +21,10 @@
#ifndef LIBBSP_SHARED_BOOTCARD_H
#define LIBBSP_SHARED_BOOTCARD_H
-#include <string.h>
-
#include <rtems/config.h>
#include <rtems/bspIo.h>
#include <rtems/malloc.h>
+#include <rtems/score/memory.h>
#include <rtems/score/wkspace.h>
#include <bspopts.h>
@@ -71,65 +70,6 @@ void bsp_reset(void);
*/
void boot_card(const char *cmdline) RTEMS_NO_RETURN;
-#ifdef CONFIGURE_MALLOC_BSP_SUPPORTS_SBRK
- /**
- * @brief Gives the BSP a chance to reduce the work area size with sbrk()
- * adding more later.
- *
- * bsp_sbrk_init() may reduce the work area size passed in. The routine
- * returns the 'sbrk_amount' to be used when extending the heap. Note that
- * the return value may be zero.
- *
- * In case the @a area size is altered, then the remaining size of the
- * @a area must be greater than or equal to @a min_size.
- */
- ptrdiff_t bsp_sbrk_init(Heap_Area *area, uintptr_t min_size);
-#endif
-
-static inline void bsp_work_area_initialize_default(
- void *area_begin,
- uintptr_t area_size
-)
-{
- Heap_Area area = {
- .begin = area_begin,
- .size = area_size
- };
-
- #if BSP_DIRTY_MEMORY == 1
- memset(area.begin, 0xCF, area.size);
- #endif
-
- #ifdef CONFIGURE_MALLOC_BSP_SUPPORTS_SBRK
- {
- uintptr_t overhead = _Heap_Area_overhead(CPU_HEAP_ALIGNMENT);
- uintptr_t work_space_size = rtems_configuration_get_work_space_size();
- ptrdiff_t sbrk_amount = bsp_sbrk_init(
- &area,
- work_space_size
- + overhead
- + (rtems_configuration_get_unified_work_area() ? 0 : overhead)
- );
-
- rtems_heap_set_sbrk_amount(sbrk_amount);
- }
- #endif
-
- _Workspace_Handler_initialization(&area, 1, NULL);
- RTEMS_Malloc_Initialize(&area, 1, NULL);
-}
-
-static inline void bsp_work_area_initialize_with_table(
- Heap_Area *areas,
- size_t area_count
-)
-{
- _Workspace_Handler_initialization(areas, area_count, _Heap_Extend);
- RTEMS_Malloc_Initialize(areas, area_count, _Heap_Extend);
-}
-
-void bsp_work_area_initialize(void);
-
struct Per_CPU_Control;
/**