source: rtems/bsps/arm/include/bsp/start.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.2 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup arm_start
5 *
6 * @brief ARM system low level start.
7 */
8
9/*
10 * Copyright (c) 2008-2013 embedded brains GmbH.  All rights reserved.
11 *
12 *  embedded brains GmbH
13 *  Obere Lagerstr. 30
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_ARM_SHARED_START_H
24#define LIBBSP_ARM_SHARED_START_H
25
26#include <string.h>
27
28#include <bsp/linker-symbols.h>
29
30#ifdef __cplusplus
31extern "C" {
32#endif /* __cplusplus */
33
34/**
35 * @defgroup arm_start System Start
36 *
37 * @ingroup arm_shared
38 *
39 * @brief ARM system low level start.
40 *
41 * @{
42 */
43
44#define BSP_START_TEXT_SECTION __attribute__((section(".bsp_start_text")))
45
46#define BSP_START_DATA_SECTION __attribute__((section(".bsp_start_data")))
47
48/*
49* Many ARM boot loaders pass arguments to loaded OS kernel
50*/
51#ifdef BSP_START_HOOKS_WITH_LOADER_ARGS
52#define BSP_START_HOOKS_LOADER_ARGS int saved_psr, int saved_machid, int saved_dtb_adr
53#else
54#define BSP_START_HOOKS_LOADER_ARGS void
55#endif
56
57/**
58* @brief System start entry.
59*/
60void _start(void);
61
62/**
63* @brief Start entry hook 0.
64*
65* This hook will be called from the start entry code after all modes and
66* stack pointers are initialized but before the copying of the exception
67* vectors.
68*/
69void bsp_start_hook_0(BSP_START_HOOKS_LOADER_ARGS);
70
71/**
72* @brief Start entry hook 1.
73*
74* This hook will be called from the start entry code after copying of the
75* exception vectors but before the call to boot_card().
76*/
77void bsp_start_hook_1(BSP_START_HOOKS_LOADER_ARGS);
78
79/**
80 * @brief Similar to standard memcpy().
81 *
82 * The memory areas must be word aligned.  Copy code will be executed from the
83 * stack.  If @a dest equals @a src nothing will be copied.
84 */
85void bsp_start_memcpy(int *dest, const int *src, size_t n);
86
87/**
88 * @brief ARM entry point to bsp_start_memcpy().
89 */
90void bsp_start_memcpy_arm(int *dest, const int *src, size_t n);
91
92/**
93 * @brief Copies all standard sections from the load to the runtime area.
94 */
95BSP_START_TEXT_SECTION static inline void bsp_start_copy_sections(void)
96{
97  /* Copy .text section */
98  bsp_start_memcpy(
99    (int *) bsp_section_text_begin,
100    (const int *) bsp_section_text_load_begin,
101    (size_t) bsp_section_text_size
102  );
103
104  /* Copy .rodata section */
105  bsp_start_memcpy(
106    (int *) bsp_section_rodata_begin,
107    (const int *) bsp_section_rodata_load_begin,
108    (size_t) bsp_section_rodata_size
109  );
110
111  /* Copy .data section */
112  bsp_start_memcpy(
113    (int *) bsp_section_data_begin,
114    (const int *) bsp_section_data_load_begin,
115    (size_t) bsp_section_data_size
116  );
117
118  /* Copy .fast_text section */
119  bsp_start_memcpy(
120    (int *) bsp_section_fast_text_begin,
121    (const int *) bsp_section_fast_text_load_begin,
122    (size_t) bsp_section_fast_text_size
123  );
124
125  /* Copy .fast_data section */
126  bsp_start_memcpy(
127    (int *) bsp_section_fast_data_begin,
128    (const int *) bsp_section_fast_data_load_begin,
129    (size_t) bsp_section_fast_data_size
130  );
131}
132
133BSP_START_TEXT_SECTION static inline void
134bsp_start_memcpy_libc(void *dest, const void *src, size_t n)
135{
136  if (dest != src) {
137    memcpy(dest, src, n);
138  }
139}
140
141/**
142 * @brief Copies the .data, .fast_text and .fast_data sections from the load to
143 * the runtime area using the C library memcpy().
144 *
145 * Works only in case the .start, .text and .rodata sections reside in one
146 * memory region.
147 */
148BSP_START_TEXT_SECTION static inline void bsp_start_copy_sections_compact(void)
149{
150  /* Copy .data section */
151  bsp_start_memcpy_libc(
152    bsp_section_data_begin,
153    bsp_section_data_load_begin,
154    (size_t) bsp_section_data_size
155  );
156
157  /* Copy .fast_text section */
158  bsp_start_memcpy_libc(
159    bsp_section_fast_text_begin,
160    bsp_section_fast_text_load_begin,
161    (size_t) bsp_section_fast_text_size
162  );
163
164  /* Copy .fast_data section */
165  bsp_start_memcpy_libc(
166    bsp_section_fast_data_begin,
167    bsp_section_fast_data_load_begin,
168    (size_t) bsp_section_fast_data_size
169  );
170}
171
172BSP_START_TEXT_SECTION static inline void bsp_start_clear_bss(void)
173{
174  memset(bsp_section_bss_begin, 0, (size_t) bsp_section_bss_size);
175}
176
177/** @} */
178
179#ifdef __cplusplus
180}
181#endif /* __cplusplus */
182
183#endif /* LIBBSP_ARM_SHARED_START_H */
Note: See TracBrowser for help on using the repository browser.