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

4.104.114.84.95
Last change on this file since e2a2ec60 was e2a2ec60, checked in by Joel Sherrill <joel.sherrill@…>, on Mar 21, 1998 at 3:37:18 PM

Switch to using a shared main() for all of the embedded BSPs
based on the GNU tools. This usually involved correcting the
type of bsp_start(), bsp_cleanup(), adjusting the start code to
call the right start routine (the shared boot_card()), and then
removing code from bsp_start() which was performed in the new
boot_card()/main() path.

  • Property mode set to 100644
File size: 1.3 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  BSP_Configuration;
28extern rtems_cpu_table            Cpu_table;
29
30rtems_interrupt_level bsp_isr_level;
31
32int main(int argc, char **argv, char **environ)
33{
34
35  if ((argc > 0) && argv && argv[0])
36    rtems_progname = argv[0];
37  else
38    rtems_progname = "RTEMS";
39
40  rtems_initialize_executive_late( bsp_isr_level );
41
42  return 0;
43}
44
45void boot_card(void)
46{
47  int status;
48
49  /* the atexit hook will be before the static destructor list's entry
50     point */
51  bsp_start();
52
53  bsp_isr_level =
54    rtems_initialize_executive_early( &BSP_Configuration, &Cpu_table );
55
56  status = main(0, 0, 0);
57
58  bsp_cleanup(); 
59
60  exit( status );
61}
62
Note: See TracBrowser for help on using the repository browser.