source: rtems/c/src/lib/libbsp/shared/bootcard.c @ 2858939a

5
Last change on this file since 2858939a was 2858939a, checked in by Sebastian Huber <sebastian.huber@…>, on 12/09/15 at 11:03:49

bsps: Delete superfluous bsp_pretasking_hook()

Use the bsp_predriver_hook() instead.

Update #2408.

  • Property mode set to 100644
File size: 3.8 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup bsp_bootcard
5 *
6 * @brief Standard system startup.
7 *
8 *  This is the C entry point for ALL RTEMS BSPs.  It is invoked
9 *  from the assembly language initialization file usually called
10 *  start.S.  It provides the framework for the BSP initialization
11 *  sequence.  The basic flow of initialization is:
12 *
13 *  + start.S: basic CPU setup (stack, zero BSS)
14 *    + boot_card
15 *      + bspstart.c: bsp_start - more advanced initialization
16 *      + obtain information on BSP memory and allocate RTEMS Workspace
17 *      + rtems_initialize_data_structures
18 *      + allocate memory to C Program Heap
19 *      + initialize C Library and C Program Heap
20 *      + rtems_initialize_before_drivers
21 *      + bsp_predriver_hook
22 *      + rtems_initialize_device_drivers
23 *        - all device drivers
24 *      + bsp_postdriver_hook
25 *      + rtems_initialize_start_multitasking
26 *        - 1st task executes C++ global constructors
27 *          .... appplication runs ...
28 *          - exit
29 *      + will not return to here
30 *
31 *  This style of initialization ensures that the C++ global
32 *  constructors are executed after RTEMS is initialized.
33 *  Thanks to Chris Johns <cjohns@plessey.com.au> for the idea
34 *  to move C++ global constructors into the first task.
35 */
36
37/*
38 *  COPYRIGHT (c) 1989-2014.
39 *  On-Line Applications Research Corporation (OAR).
40 *
41 *  The license and distribution terms for this file may be
42 *  found in the file LICENSE in this distribution or at
43 *  http://www.rtems.org/license/LICENSE.
44 */
45
46#include <bsp/bootcard.h>
47
48#include <rtems.h>
49
50/*
51 *  At most a single pointer to the cmdline for those target
52 *  short on memory and not supporting a command line.
53 */
54const char *bsp_boot_cmdline;
55
56/*
57 *  This is the initialization framework routine that weaves together
58 *  calls to RTEMS and the BSP in the proper sequence to initialize
59 *  the system while maximizing shared code and keeping BSP code in C
60 *  as much as possible.
61 */
62void boot_card(
63  const char *cmdline
64)
65{
66  rtems_interrupt_level  bsp_isr_level;
67
68  /*
69   *  Make sure interrupts are disabled.
70   */
71  (void) bsp_isr_level;
72  rtems_interrupt_local_disable( bsp_isr_level );
73
74  bsp_boot_cmdline = cmdline;
75
76  /*
77   *  Initialize the RTEMS Workspace and the C Program Heap.
78   */
79  bsp_work_area_initialize();
80
81  /*
82   * Invoke Board Support Package initialization routine written in C.
83   */
84  bsp_start();
85
86  /*
87   *  Initialize RTEMS data structures
88   */
89  rtems_initialize_data_structures();
90
91  /*
92   *  Initialize the C library for those BSPs using the shared
93   *  framework.
94   */
95  bsp_libc_init();
96
97  /*
98   *  Let RTEMS perform initialization it requires before drivers
99   *  are allowed to be initialized.
100   */
101  rtems_initialize_before_drivers();
102
103  /*
104   *  Execute BSP specific pre-driver hook. Drivers haven't gotten
105   *  to initialize yet so this is a good chance to initialize
106   *  buses, spurious interrupt handlers, etc..
107   *
108   *  NOTE: Many BSPs do not require this handler and use the
109   *        shared stub.
110   */
111  bsp_predriver_hook();
112
113  /*
114   *  Initialize all device drivers.
115   */
116  rtems_initialize_device_drivers();
117
118  /*
119   *  Invoke the postdriver hook.  This normally opens /dev/console
120   *  for use as stdin, stdout, and stderr.
121   */
122  bsp_postdriver_hook();
123
124  /*
125   *  Complete initialization of RTEMS and switch to the first task.
126   *  Global C++ constructors will be executed in the context of that task.
127   */
128  rtems_initialize_start_multitasking();
129
130  /***************************************************************
131   ***************************************************************
132   *  APPLICATION RUNS NOW!!!  We will not return to here!!!     *
133   ***************************************************************
134   ***************************************************************/
135}
Note: See TracBrowser for help on using the repository browser.