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

4.104.114.84.95
Last change on this file since bd527866 was bd527866, checked in by Joel Sherrill <joel.sherrill@…>, on 08/02/99 at 15:24:57

Now correctly does deep copy.

  • Property mode set to 100644
File size: 2.9 KB
Line 
1/*
2 *  A simple main which can be used on any embedded target.
3 *
4 *  This style of initialization insures that the C++ global
5 *  constructors are executed after RTEMS is initialized.
6 *
7 *  Thanks to Chris Johns <cjohns@plessey.com.au> for this idea.
8 *
9 *  COPYRIGHT (c) 1989-1998.
10 *  On-Line Applications Research Corporation (OAR).
11 *  Copyright assigned to U.S. Government, 1994.
12 *
13 *  The license and distribution terms for this file may be
14 *  found in the file LICENSE in this distribution or at
15 *  http://www.OARcorp.com/rtems/license.html.
16 *
17 *  $Id$
18 */
19
20#include <bsp.h>
21
22extern void bsp_start( void );
23extern void bsp_cleanup( void );
24
25extern rtems_configuration_table  Configuration;
26extern rtems_configuration_table  BSP_Configuration;
27extern rtems_cpu_table            Cpu_table;
28
29rtems_api_configuration_table BSP_RTEMS_Configuration;
30
31#ifdef RTEMS_POSIX_API
32posix_api_configuration_table BSP_POSIX_Configuration;
33#endif
34
35/* Initialize C++ global Ctor/Dtor and initializes exception handling. */
36#if defined(USE_INIT_FINI)
37extern void _fini( void );
38extern void _init( void );
39#endif
40
41rtems_interrupt_level bsp_isr_level;
42
43/*
44 *  Since there is a forward reference
45 */
46
47int main(int argc, char **argv);
48
49int boot_card(int argc, char **argv)
50{
51  int status;
52
53  /*
54   *  Set default values for the CPU Table fields all ports must have.
55   *  These values can be overridden in bsp_start() but they are
56   *  right most of the time.
57   */
58
59  Cpu_table.pretasking_hook                 = NULL;
60  Cpu_table.predriver_hook                  = NULL;
61  Cpu_table.postdriver_hook                 = NULL;
62  Cpu_table.idle_task                       = NULL;
63  Cpu_table.do_zero_of_workspace            = TRUE;
64  Cpu_table.interrupt_stack_size            = RTEMS_MINIMUM_STACK_SIZE;
65  Cpu_table.extra_mpci_receive_server_stack = 0;
66  Cpu_table.stack_allocate_hook             = NULL;
67  Cpu_table.stack_free_hook                 = NULL;
68
69
70  /*
71   *  Copy the configuration table so we and the BSP wants to change it.
72   */
73
74  BSP_Configuration       = Configuration;
75
76  BSP_RTEMS_Configuration = *Configuration.RTEMS_api_configuration;
77  BSP_Configuration.RTEMS_api_configuration = &BSP_RTEMS_Configuration;
78
79#ifdef RTEMS_POSIX_API
80  BSP_POSIX_Configuration = *Configuration.POSIX_api_configuration;
81  BSP_Configuration.POSIX_api_configuration = &BSP_POSIX_Configuration;
82#endif
83
84  /*
85   *  The atexit hook will be before the static destructor list's entry
86   *  point.
87   */
88
89  bsp_start();
90
91  /*
92   *  Initialize RTEMS but do NOT start multitasking.
93   */
94
95  bsp_isr_level =
96    rtems_initialize_executive_early( &BSP_Configuration, &Cpu_table );
97
98  /*
99   *  Call main() and get the global constructors invoked if there
100   *  are any.
101   */
102#ifdef USE_INIT_FINI
103   atexit( _fini );
104   _init();
105#endif
106
107  status = main(argc, argv);
108
109  /*
110   *  Perform any BSP specific shutdown actions.
111   */
112
113  bsp_cleanup(); 
114
115  /*
116   *  Now return to the start code.
117   */
118
119  return status;
120}
Note: See TracBrowser for help on using the repository browser.