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 07/17/07 at 18:29:37

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
RevLine 
[7efcefa]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>
[8b09de0]17#include <stdlib.h>
[7efcefa]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
[8b09de0]40  printk( "Transferring to Ada\n" );
[7efcefa]41  (void) gnat_main ( 0, 0, 0 );
42
43  exit( 0 );
44
45  return 0;
46}
47
[8b09de0]48extern  size_t  _ada_pthread_minimum_stack_size();
49
[7efcefa]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;
[8b09de0]56  printk( "Starting Posix Init thread\n" );
[7efcefa]57
58  status = pthread_attr_init( &attr );
59  assert( !status );
60
[a1affab]61#define GNAT_MAIN_STACKSPACE 100
[7efcefa]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
[8b09de0]74  printk( "Exiting Posix Init thread\n" );
[7efcefa]75  pthread_exit( 0 );
76
77  return 0;
78}
79
80/* configuration information */
81
[8b09de0]82#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
83#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
[7efcefa]84
85#define CONFIGURE_MICROSECONDS_PER_TICK RTEMS_MILLISECONDS_TO_MICROSECONDS(1)
86
87#define CONFIGURE_POSIX_INIT_THREAD_TABLE
88
[a1affab]89#define CONFIGURE_MAXIMUM_SEMAPHORES 10
[7efcefa]90#define CONFIGURE_GNAT_RTEMS
91#define CONFIGURE_MAXIMUM_ADA_TASKS      20
92#define CONFIGURE_MAXIMUM_FAKE_ADA_TASKS 0
93
[8b09de0]94#define CONFIGURE_MEMORY_OVERHEAD        (GNAT_MAIN_STACKSPACE)
95/*
[7efcefa]96#define CONFIGURE_MEMORY_OVERHEAD        (256 + GNAT_MAIN_STACKSPACE)
97*/
98
99#define CONFIGURE_INIT
100
[8b09de0]101#include <rtems/confdefs.h>
[7efcefa]102
Note: See TracBrowser for help on using the repository browser.