summaryrefslogtreecommitdiff
path: root/bsps/include/bsp/bootcard.h
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2017-12-23 18:18:56 +1100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-01-25 08:45:26 +0100
commit2afb22b7e1ebcbe40373ff7e0efae7d207c655a9 (patch)
tree44759efe9374f13200a97e96d91bd9a2b7e5ce2a /bsps/include/bsp/bootcard.h
parent9704efb4ec088a472842cbc9bc46392685ebc806 (diff)
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.
Diffstat (limited to 'bsps/include/bsp/bootcard.h')
-rw-r--r--bsps/include/bsp/bootcard.h188
1 files changed, 188 insertions, 0 deletions
diff --git a/bsps/include/bsp/bootcard.h b/bsps/include/bsp/bootcard.h
new file mode 100644
index 0000000000..aaac42e8e2
--- /dev/null
+++ b/bsps/include/bsp/bootcard.h
@@ -0,0 +1,188 @@
+/**
+ * @file
+ *
+ * @ingroup bsp_bootcard
+ *
+ * @brief Standard system startup.
+ */
+
+/*
+ * Copyright (c) 2008-2014 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Dornierstr. 4
+ * 82178 Puchheim
+ * Germany
+ * <rtems@embedded-brains.de>
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#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/wkspace.h>
+
+#include <bspopts.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * @defgroup shared_bootcard Bootcard
+ *
+ * @ingroup bsp_shared
+ *
+ * @brief Standard system startup.
+ *
+ * @{
+ */
+
+/**
+ * @brief Global pointer to the command line of boot_card().
+ */
+extern const char *bsp_boot_cmdline;
+
+void bsp_start(void);
+
+void bsp_predriver_hook(void);
+
+void bsp_reset(void);
+
+/**
+ * @brief Standard system initialization procedure.
+ *
+ * You may pass a command line in @a cmdline. It is later available via the
+ * global @ref bsp_boot_cmdline variable.
+ *
+ * This is the C entry point for ALL RTEMS BSPs. It is invoked from the
+ * assembly language initialization file usually called @c start.S which does
+ * the basic CPU setup (stack, C runtime environment, zero BSS, load other
+ * sections) and calls afterwards boot_card(). The boot card function provides
+ * the framework for the BSP initialization sequence. For the basic flow of
+ * initialization see RTEMS C User's Guide, Initialization Manager.
+ *
+ * This style of initialization ensures that the C++ global constructors are
+ * executed after RTEMS is initialized.
+ */
+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
+
+ /*
+ * The following may be helpful in debugging what goes wrong when
+ * you are allocating the Work Area in a new BSP.
+ */
+ #ifdef BSP_GET_WORK_AREA_DEBUG
+ {
+ void *sp = __builtin_frame_address(0);
+ void *end = (char *) area.begin + area.size;
+ printk(
+ "work_area_start = 0x%p\n"
+ "work_area_size = %lu 0x%08lx\n"
+ "end = 0x%p\n"
+ "current stack pointer = 0x%p%s\n",
+ area.begin,
+ (unsigned long) area.size, /* decimal */
+ (unsigned long) area.size, /* hexadecimal */
+ end,
+ sp,
+ (uintptr_t) sp >= (uintptr_t) area.begin
+ && (uintptr_t) sp <= (uintptr_t) end ?
+ " OVERLAPS!" : ""
+ );
+ }
+ #endif
+
+ _Workspace_Handler_initialization(&area, 1, NULL);
+
+ #ifdef BSP_GET_WORK_AREA_DEBUG
+ printk(
+ "heap_start = 0x%p\n"
+ "heap_size = %lu\n",
+ area.begin,
+ (unsigned long) area.size
+ );
+ #endif
+
+ 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);
+
+/**
+ * @brief Standard start routine for secondary processors.
+ *
+ * This function is usually called by low-level startup code of secondary
+ * processors or boot loaders starting a secondary processor. The final step
+ * of this function is a call to
+ * _SMP_Start_multitasking_on_secondary_processor().
+ */
+void bsp_start_on_secondary_processor(void);
+
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* LIBBSP_SHARED_BOOTCARD_H */