source: ada-examples/hello_world_ada/init.c @ 8b09de0

ada-examples-4-10-branchada-examples-4-8-branchada-examples-4-9-branch
Last change on this file since 8b09de0 was 8b09de0, checked in by Joel Sherrill <joel.sherrill@…>, on Jul 17, 2007 at 6:29:37 PM

2007-07-17 Joel Sherrill <joel.sherrill@…>

  • hello_world_ada/Makefile.pc386, hello_world_ada/init.c: Update to gcc 4.2.0 and rtems 4.8.
  • hello_world_ada/Makefile.anybsp: New file.
  • hello_world_ada/Makefile.erc32, hello_world_ada/Makefile.jmr3904, hello_world_ada/Makefile.psim: Removed.
  • Property mode set to 100644
File size: 2.3 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-1997.
3 *  On-Line Applications Research Corporation (OAR).
4 *  Copyright assigned to U.S. Government, 1994.
5 *
6 *  The license and distribution terms for this file may be found in
7 *  the file LICENSE in this distribution or at
8 *  http://www.OARcorp.com/rtems/license.html.
9 *
10 *  $Id$
11 */
12
13#include <bsp.h>
14
15#include <assert.h>
16#include <pthread.h>
17#include <stdlib.h>
18
19extern rtems_configuration_table  BSP_Configuration;
20
21#ifdef GNAT_PID
22#include <unistd.h>
23pid_t getpid()
24{
25  return GNAT_PID;
26}
27#endif
28
29/*
30 *  By having the POSIX_Init thread create a second thread just
31 *  to invoke gnat_main, we can override all default attributes
32 *  of the "Ada environment task".  Otherwise, we would be
33 *  stuck with the defaults set by RTEMS.
34 */
35 
36void *start_gnat_main( void * argument )
37{
38  extern int gnat_main ( int argc, char **argv, char **envp );
39
40  printk( "Transferring to Ada\n" );
41  (void) gnat_main ( 0, 0, 0 );
42
43  exit( 0 );
44
45  return 0;
46}
47
48extern  size_t  _ada_pthread_minimum_stack_size();
49
50void *POSIX_Init( void *argument )
51{
52  pthread_t       thread_id;
53  pthread_attr_t  attr;
54  size_t          stacksize = _ada_pthread_minimum_stack_size();
55  int             status;
56  printk( "Starting Posix Init thread\n" );
57
58  status = pthread_attr_init( &attr );
59  assert( !status );
60
61#define GNAT_MAIN_STACKSPACE 100
62#ifdef GNAT_MAIN_STACKSPACE
63  stacksize = GNAT_MAIN_STACKSPACE * 1024;
64#else
65#define GNAT_MAIN_STACKSPACE 0
66#endif
67
68  status = pthread_attr_setstacksize( &attr, stacksize );
69  assert( !status );
70
71  status = pthread_create( &thread_id, &attr, start_gnat_main, NULL );
72  assert( !status );
73
74  printk( "Exiting Posix Init thread\n" );
75  pthread_exit( 0 );
76
77  return 0;
78}
79
80/* configuration information */
81
82#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
83#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
84
85#define CONFIGURE_MICROSECONDS_PER_TICK RTEMS_MILLISECONDS_TO_MICROSECONDS(1)
86
87#define CONFIGURE_POSIX_INIT_THREAD_TABLE
88
89#define CONFIGURE_MAXIMUM_SEMAPHORES 10
90#define CONFIGURE_GNAT_RTEMS
91#define CONFIGURE_MAXIMUM_ADA_TASKS      20
92#define CONFIGURE_MAXIMUM_FAKE_ADA_TASKS 0
93
94#define CONFIGURE_MEMORY_OVERHEAD        (GNAT_MAIN_STACKSPACE)
95/*
96#define CONFIGURE_MEMORY_OVERHEAD        (256 + GNAT_MAIN_STACKSPACE)
97*/
98
99#define CONFIGURE_INIT
100
101#include <rtems/confdefs.h>
102
Note: See TracBrowser for help on using the repository browser.