source: rtems/c/src/lib/libbsp/shared/main.c @ bd9c3d1

4.104.114.84.9
Last change on this file since bd9c3d1 was bd9c3d1, checked in by Joel Sherrill <joel.sherrill@…>, on Apr 15, 1998 at 8:50:31 PM

Numerous changes which in total greatly reduced the amount of source
code in each BSP's bspstart.c. These changes were:

+ confdefs.h now knows libio's semaphore requirements
+ shared/main.c now copies Configuration to BSP_Configuration
+ shared/main.c fills in the Cpu_table with default values

This removed the need for rtems_libio_config() and the constant
BSP_LIBIO_MAX_FDS in every BSP. Plus now the maximum number of open
files can now be set on the gcc command line.

  • Property mode set to 100644
File size: 2.4 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
22char *rtems_progname;
23
24extern void bsp_start( void );
25extern void bsp_cleanup( void );
26
27extern rtems_configuration_table  Configuration;
28extern rtems_configuration_table  BSP_Configuration;
29extern rtems_cpu_table            Cpu_table;
30
31rtems_interrupt_level bsp_isr_level;
32
33int main(int argc, char **argv)
34{
35
36  if ((argc > 0) && argv && argv[0])
37    rtems_progname = argv[0];
38  else
39    rtems_progname = "RTEMS";
40
41  rtems_initialize_executive_late( bsp_isr_level );
42
43  return 0;
44}
45
46int boot_card(int argc, char **argv)
47{
48  int status;
49
50  /*
51   *  Set default values for the CPU Table fields all ports must have.
52   *  These values can be overridden in bsp_start() but they are
53   *  right most of the time.
54   */
55
56  Cpu_table.pretasking_hook                 = NULL;
57  Cpu_table.predriver_hook                  = NULL;
58  Cpu_table.postdriver_hook                 = NULL;
59  Cpu_table.idle_task                       = NULL;
60  Cpu_table.do_zero_of_workspace            = TRUE;
61  Cpu_table.interrupt_stack_size            = RTEMS_MINIMUM_STACK_SIZE;
62  Cpu_table.extra_mpci_receive_server_stack = 0;
63  Cpu_table.stack_allocate_hook             = NULL;
64  Cpu_table.stack_free_hook                 = NULL;
65
66
67  /*
68   *  Copy the configuration table so we and the BSP wants to change it.
69   */
70
71  BSP_Configuration = Configuration;
72
73  /*
74   *  The atexit hook will be before the static destructor list's entry
75   *  point.
76   */
77
78  bsp_start();
79
80  /*
81   *  Initialize RTEMS but do NOT start multitasking.
82   */
83
84  bsp_isr_level =
85    rtems_initialize_executive_early( &BSP_Configuration, &Cpu_table );
86
87  /*
88   *  Call main() and get the global constructors invoked if there
89   *  are any.
90   */
91
92  status = main(argc, argv);
93
94  /*
95   *  Perform any BSP specific shutdown actions.
96   */
97
98  bsp_cleanup(); 
99
100  /*
101   *  Now return to the start code.
102   */
103
104  return status;
105}
106
Note: See TracBrowser for help on using the repository browser.