source: rtems/cpukit/include/rtems/libcsupport.h @ 2afb22b

Last change on this file since 2afb22b was 2afb22b, checked in by Chris Johns <chrisj@…>, on Dec 23, 2017 at 7:18:56 AM

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.3 KB
Line 
1/**
2 * @file
3 *
4 * @brief Standard C Library Support
5 *
6 * This include file contains the information regarding the
7 * RTEMS specific support for the standard C library.
8 */
9
10/*
11 *  COPYRIGHT (c) 1989-2011.
12 *  On-Line Applications Research Corporation (OAR).
13 *
14 *  The license and distribution terms for this file may be
15 *  found in the file LICENSE in this distribution or at
16 *  http://www.rtems.org/license/LICENSE.
17 */
18
19#ifndef _RTEMS_RTEMS_LIBCSUPPORT_H
20#define _RTEMS_RTEMS_LIBCSUPPORT_H
21
22#include <sys/types.h>
23#include <stdint.h>
24
25#include <rtems/score/heap.h>
26#include <rtems/rtems/tasks.h>
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32/**
33 * @defgroup libcsupport Standard C Library Support
34 *
35 * @brief RTEMS Specific Support for the Standard C Library
36 *
37 */
38/**@{**/
39
40extern void malloc_dump(void);
41
42/**
43 * @brief Malloc walk.
44 */
45extern bool malloc_walk(int source, bool printf_enabled);
46
47/**
48 * @brief Set malloc heap pointer.
49 *
50 * This routine is primarily used for debugging.
51 */
52void malloc_set_heap_pointer(Heap_Control *new_heap);
53
54/**
55 * @brief Get malloc heap pointer.
56 *
57 * This routine is primarily used for debugging.
58 */
59Heap_Control *malloc_get_heap_pointer( void );
60
61/**
62 * @brief Get free malloc information.
63 *
64 * Find amount of free heap remaining
65 */
66extern size_t malloc_free_space(void);
67
68/**
69 * @brief Get malloc status information.
70 *
71 * Find amount of free heap remaining.
72 */
73extern int malloc_info(Heap_Information_block *the_info);
74
75/*
76 *  Prototypes required to install newlib reentrancy user extension
77 */
78bool newlib_create_hook(
79  rtems_tcb *current_task,
80  rtems_tcb *creating_task
81);
82
83void newlib_terminate_hook(
84  rtems_tcb *current_task
85);
86
87#define RTEMS_NEWLIB_EXTENSION \
88{ \
89  newlib_create_hook,     /* rtems_task_create  */ \
90  0,                      /* rtems_task_start   */ \
91  0,                      /* rtems_task_restart */ \
92  0,                      /* rtems_task_delete  */ \
93  0,                      /* task_switch  */ \
94  0,                      /* task_begin   */ \
95  0,                      /* task_exitted */ \
96  0,                      /* fatal        */ \
97  newlib_terminate_hook   /* thread terminate */ \
98}
99
100typedef struct {
101  uint32_t active_barriers;
102  uint32_t active_extensions;
103  uint32_t active_message_queues;
104  uint32_t active_partitions;
105  uint32_t active_periods;
106  uint32_t active_ports;
107  uint32_t active_regions;
108  uint32_t active_semaphores;
109  uint32_t active_tasks;
110  uint32_t active_timers;
111} rtems_resource_rtems_api;
112
113typedef struct {
114  uint32_t active_message_queues;
115  uint32_t active_semaphores;
116  uint32_t active_threads;
117  uint32_t active_timers;
118} rtems_resource_posix_api;
119
120typedef struct {
121  Heap_Information_block workspace_info;
122  Heap_Information_block heap_info;
123  uint32_t active_posix_key_value_pairs;
124  uint32_t active_posix_keys;
125  rtems_resource_rtems_api rtems_api;
126  rtems_resource_posix_api posix_api;
127  int open_files;
128} rtems_resource_snapshot;
129
130/**
131 * @brief Tasks a snapshot of the resource usage of the system.
132 *
133 * @param[out] snapshot The snapshot of used resources.
134 *
135 * @see rtems_resource_snapshot_equal() and rtems_resource_snapshot_check().
136 *
137 * @code
138 * #include <assert.h>
139 *
140 * #include <rtems/libcsupport.h>
141 *
142 * void example(void)
143 * {
144 *   rtems_resource_snapshot before;
145 *
146 *   test_setup();
147 *   rtems_resource_snapshot_take(&before);
148 *   test();
149 *   assert(rtems_resource_snapshot_check(&before));
150 *   test_cleanup();
151 * }
152 * @endcode
153 */
154void rtems_resource_snapshot_take(rtems_resource_snapshot *snapshot);
155
156/**
157 * @brief Compares two resource snapshots for equality.
158 *
159 * @param[in] a One resource snapshot.
160 * @param[in] b Another resource snapshot.
161 *
162 * @retval true The resource snapshots are equal.
163 * @retval false Otherwise.
164 *
165 * @see rtems_resource_snapshot_take().
166 */
167bool rtems_resource_snapshot_equal(
168  const rtems_resource_snapshot *a,
169  const rtems_resource_snapshot *b
170);
171
172/**
173 * @brief Takes a new resource snapshot and checks that it is equal to the
174 * given resource snapshot.
175 *
176 * @param[in] snapshot The resource snapshot used for comparison with the new
177 * resource snapshot.
178 *
179 * @retval true The resource snapshots are equal.
180 * @retval false Otherwise.
181 *
182 * @see rtems_resource_snapshot_take().
183 */
184bool rtems_resource_snapshot_check(const rtems_resource_snapshot *snapshot);
185
186/** @} */
187
188#ifdef __cplusplus
189}
190#endif
191
192#endif
193/* end of include file */
Note: See TracBrowser for help on using the repository browser.