source: rtems/bsps/include/bsp/bootcard.h @ 2afb22b

5
Last change on this file since 2afb22b was 2afb22b, checked in by Chris Johns <chrisj@…>, on 12/23/17 at 07:18:56

Remove make preinstall

A speciality of the RTEMS build system was the make preinstall step. It
copied header files from arbitrary locations into the build tree. The
header files were included via the -Bsome/build/tree/path GCC command
line option.

This has at least seven problems:

  • The make preinstall step itself needs time and disk space.
  • Errors in header files show up in the build tree copy. This makes it hard for editors to open the right file to fix the error.
  • There is no clear relationship between source and build tree header files. This makes an audit of the build process difficult.
  • The visibility of all header files in the build tree makes it difficult to enforce API barriers. For example it is discouraged to use BSP-specifics in the cpukit.
  • An introduction of a new build system is difficult.
  • Include paths specified by the -B option are system headers. This may suppress warnings.
  • The parallel build had sporadic failures on some hosts.

This patch removes the make preinstall step. All installed header
files are moved to dedicated include directories in the source tree.
Let @RTEMS_CPU@ be the target architecture, e.g. arm, powerpc, sparc,
etc. Let @RTEMS_BSP_FAMILIY@ be a BSP family base directory, e.g.
erc32, imx, qoriq, etc.

The new cpukit include directories are:

  • cpukit/include
  • cpukit/score/cpu/@RTEMS_CPU@/include
  • cpukit/libnetworking

The new BSP include directories are:

  • bsps/include
  • bsps/@RTEMS_CPU@/include
  • bsps/@RTEMS_CPU@/@RTEMS_BSP_FAMILIY@/include

There are build tree include directories for generated files.

The include directory order favours the most general header file, e.g.
it is not possible to override general header files via the include path
order.

The "bootstrap -p" option was removed. The new "bootstrap -H" option
should be used to regenerate the "headers.am" files.

Update #3254.

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