source: rtems/bsps/include/bsp/bootcard.h @ 07e2eac

5
Last change on this file since 07e2eac was 07e2eac, checked in by Sebastian Huber <sebastian.huber@…>, on 12/13/19 at 13:22:16

bsps: Remove uses of BSP_GET_WORK_AREA_DEBUG

The code covered by BSP_GET_WORK_AREA_DEBUG was basically dead code
since there was no normal way to activate it (e.g. via a BSP
configuration option). A follow up patch will bring back this feature
through a CONFIGURE_VERBOSE_SYSTEM_INITIALIZATION configuration option.

Update #3838.

  • Property mode set to 100644
File size: 3.8 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup RTEMSBSPsSharedStartup
5 */
6
7/*
8 * Copyright (c) 2008-2014 embedded brains GmbH.  All rights reserved.
9 *
10 *  embedded brains GmbH
11 *  Dornierstr. 4
12 *  82178 Puchheim
13 *  Germany
14 *  <rtems@embedded-brains.de>
15 *
16 * The license and distribution terms for this file may be
17 * found in the file LICENSE in this distribution or at
18 * http://www.rtems.org/license/LICENSE.
19 */
20
21#ifndef LIBBSP_SHARED_BOOTCARD_H
22#define LIBBSP_SHARED_BOOTCARD_H
23
24#include <string.h>
25
26#include <rtems/config.h>
27#include <rtems/bspIo.h>
28#include <rtems/malloc.h>
29#include <rtems/score/wkspace.h>
30
31#include <bspopts.h>
32
33#ifdef __cplusplus
34extern "C" {
35#endif /* __cplusplus */
36
37/**
38 * @defgroup RTEMSBSPsSharedStartup Bootcard
39 *
40 * @ingroup RTEMSBSPsShared
41 *
42 * @brief Standard system startup.
43 *
44 * @{
45 */
46
47/**
48 * @brief Global pointer to the command line of boot_card().
49 */
50extern const char *bsp_boot_cmdline;
51
52void bsp_start(void);
53
54void bsp_reset(void);
55
56/**
57 * @brief Standard system initialization procedure.
58 *
59 * You may pass a command line in @a cmdline.  It is later available via the
60 * global @ref bsp_boot_cmdline variable.
61 *
62 * This is the C entry point for ALL RTEMS BSPs.  It is invoked from the
63 * assembly language initialization file usually called @c start.S which does
64 * the basic CPU setup (stack, C runtime environment, zero BSS, load other
65 * sections) and calls afterwards boot_card().  The boot card function provides
66 * the framework for the BSP initialization sequence.  For the basic flow of
67 * initialization see RTEMS C User's Guide, Initialization Manager.
68 *
69 * This style of initialization ensures that the C++ global constructors are
70 * executed after RTEMS is initialized.
71 */
72void boot_card(const char *cmdline) RTEMS_NO_RETURN;
73
74#ifdef CONFIGURE_MALLOC_BSP_SUPPORTS_SBRK
75  /**
76   * @brief Gives the BSP a chance to reduce the work area size with sbrk()
77   * adding more later.
78   *
79   * bsp_sbrk_init() may reduce the work area size passed in. The routine
80   * returns the 'sbrk_amount' to be used when extending the heap.  Note that
81   * the return value may be zero.
82   *
83   * In case the @a area size is altered, then the remaining size of the
84   * @a area must be greater than or equal to @a min_size.
85   */
86  ptrdiff_t bsp_sbrk_init(Heap_Area *area, uintptr_t min_size);
87#endif
88
89static inline void bsp_work_area_initialize_default(
90  void *area_begin,
91  uintptr_t area_size
92)
93{
94  Heap_Area area = {
95    .begin = area_begin,
96    .size = area_size
97  };
98
99  #if BSP_DIRTY_MEMORY == 1
100    memset(area.begin, 0xCF,  area.size);
101  #endif
102
103  #ifdef CONFIGURE_MALLOC_BSP_SUPPORTS_SBRK
104    {
105      uintptr_t overhead = _Heap_Area_overhead(CPU_HEAP_ALIGNMENT);
106      uintptr_t work_space_size = rtems_configuration_get_work_space_size();
107      ptrdiff_t sbrk_amount = bsp_sbrk_init(
108        &area,
109        work_space_size
110          + overhead
111          + (rtems_configuration_get_unified_work_area() ? 0 : overhead)
112      );
113
114      rtems_heap_set_sbrk_amount(sbrk_amount);
115    }
116  #endif
117
118  _Workspace_Handler_initialization(&area, 1, NULL);
119  RTEMS_Malloc_Initialize(&area, 1, NULL);
120}
121
122static inline void bsp_work_area_initialize_with_table(
123  Heap_Area *areas,
124  size_t area_count
125)
126{
127  _Workspace_Handler_initialization(areas, area_count, _Heap_Extend);
128  RTEMS_Malloc_Initialize(areas, area_count, _Heap_Extend);
129}
130
131void bsp_work_area_initialize(void);
132
133struct Per_CPU_Control;
134
135/**
136 * @brief Standard start routine for secondary processors.
137 *
138 * This function is usually called by low-level startup code of secondary
139 * processors or boot loaders starting a secondary processor.  The final step
140 * of this function is a call to
141 * _SMP_Start_multitasking_on_secondary_processor().
142 */
143void bsp_start_on_secondary_processor(struct Per_CPU_Control *cpu_self);
144
145/** @} */
146
147#ifdef __cplusplus
148}
149#endif /* __cplusplus */
150
151#endif /* LIBBSP_SHARED_BOOTCARD_H */
Note: See TracBrowser for help on using the repository browser.