summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/unix/posix/startup/main.c
blob: 520cd36b04d39f794be42a190d6c6093ef69decf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
 *  Description:
 *  This file exists solely to (try to) ensure RTEMS is initialized.
 *  It is not to be used in systems which want C++ support.
 *
 *  $Id$
 */

#include <bsp.h>
#include <stdio.h>
#include <stdlib.h>

/*
 * RTEMS program name
 * Probably not used by anyone, but it is nice to have it.
 * Actually the UNIX version of CPU_INVOKE_DEBUGGER will probably
 * need to use it
 */

char *rtems_progname;

int main(
  int argc,
  char **argv
)
{
  rtems_argc = argc;
  rtems_argv = argv;

  bsp_start();

  if ((argc > 0) && argv && argv[0])
      rtems_progname = argv[0];
  else
      rtems_progname = "RTEMS";

  /*
   *  Start multitasking
   */

  rtems_initialize_executive_late( bsp_isr_level );

  /*
   * Returns when multitasking is stopped
   * This allows our destructors to get run normally
   */

  fflush( stdout );
  fflush( stderr );

  bsp_cleanup();

  return 0;
}