Building gnat/rtems with gnat 3.12p and gcc2.8.1 (hello_world_ada)
lange92 at 2067.resnet.uni.edu
lange92 at 2067.resnet.uni.edu
Mon Aug 6 13:12:35 UTC 2001
Hi all,
I found that I could successfully build the hello_world_ada example
with the pc386 bsp using the attached Makefile and init.c files.
Basically, the changes I made were to change the function named gnat_main
to _ada_main in 2 places in the init.c file, and created 2 variables
called libobjdir and libsrcdir in the Makefile, and added the parameters
-aOdir and -aIdir to gnatmake in the `all' target, respectively.
Everything compiles fine, and it ends by running the i386-rtemscoff-size
program, with the following results:
text data bss dec hex filename
147808 7324 32756 187888 2ddf0 hello
However, the web page says that it should create
hello_world_ada/o-optimize/<filename>.exe
so that would be
hello_world_ada/o-optimize/hello.exe
Maybe I'm just being paranoid, since it did produce a binary, but there
is no o-optimize directory created, and there is no reference to
o-optimize in the Makefile. I'm quite happy to report that I no longer
need any crt*.o files copies to the directory where I'm building
hello_world_ada.
Now, the binary is 2161934 bytes in size, so it's too large to be
written to a floppy and booted, if that is the proper way to test it. So
how do I test the executable? Should I build a netboot floppy and send it
over via a simple bootp/tftp bootstrapping method? The documentation just
states that this step is dependent on the bsp selected (pc386).
I also have not figured out the use of "-n" and where to put a reference
to call "adafinal", as Joel pointed out in a previous message.
Any ideas where to go from here?
DanL
-------------- next part --------------
#
# Makefile for hello world example
#
MAIN=hello
# Tool paths
tooldir=/users/lange92/illinoiscentral/rtems-4.5.0-gnat-3.12p-gcc-2.8.1-i386-rtemscoff
rtemsdir=/users/lange92/illinoiscentral/rtems-4.5.0-gnat-3.12p-gcc-2.8.1-i386-rtemscoff-noinitfini/pc386
#rtemsdir=${tooldir}/rtems/score603e
#rtemsdir=/users/lange92/illinoiscentral/rtems-i386/pc386/
#libsrcdir=/
libobjdir=/users/lange92/illinoiscentral/rtems-4.5.0-gnat-3.12p-gcc-2.8.1-i386-rtemscoff/lib/gcc-lib/i386-rtemscoff/2.8.1/adalib
libsrcdir=/users/lange92/illinoiscentral/rtems-4.5.0-gnat-3.12p-gcc-2.8.1-i386-rtemscoff/lib/gcc-lib/i386-rtemscoff/2.8.1/adainclude
# Tool names
GCC=${tooldir}/bin/i386-rtemscoff-gcc
GNATMAKE=${tooldir}/bin/i386-rtemscoff-gnatmake
SIZE=${tooldir}/bin/i386-rtemscoff-size
CARGS=-B${rtemsdir}/lib/ -specs ${rtemsdir}/lib/bsp_specs -qrtems -mcpu=i386
all: init.o
$(GNATMAKE) -v -O -gnata -gnatE -gnato $(MAIN) -g \
-cargs $(CARGS) \
-aOdir $(libobjdir) \
-aIdir $(libsrcdir) \
-largs $(CARGS) init.o
$(SIZE) $(MAIN)
init.o: init.c
$(GCC) -O4 -g -Wall -ansi -fasm $(CARGS) -c init.c
run:
@ echo Must run on the real target
gdb:
@ echo No real target
clean:
rm -f b_$(MAIN).c b_$(MAIN).o *.o *.ali $(MAIN)
-------------- next part --------------
/*
* COPYRIGHT (c) 1989-1997.
* On-Line Applications Research Corporation (OAR).
* Copyright assigned to U.S. Government, 1994.
*
* The license and distribution terms for this file may be found in
* the file LICENSE in this distribution or at
* http://www.OARcorp.com/rtems/license.html.
*
* $Id: init.c,v 1.13 1996/06/10 20:49:07 joel Exp $
*/
#include <bsp.h>
#include <assert.h>
#include <pthread.h>
#ifdef GNAT_PID
#include <unistd.h>
pid_t getpid()
{
return GNAT_PID;
}
#endif
/*
* By having the POSIX_Init thread create a second thread just
* to invoke gnat_main, we can override all default attributes
* of the "Ada environment task". Otherwise, we would be
* stuck with the defaults set by RTEMS.
*/
void *start_gnat_main( void * argument )
{
extern int _ada_main ( int argc, char **argv, char **envp );
(void) _ada_main ( 0, 0, 0 );
exit( 0 );
return 0;
}
void *POSIX_Init( void *argument )
{
pthread_t thread_id;
pthread_attr_t attr;
int status;
status = pthread_attr_init( &attr );
assert( !status );
#ifdef GNAT_MAIN_STACKSPACE
status = pthread_attr_setstacksize( &attr, GNAT_MAIN_STACKSPACE );
assert( !status );
#endif
status = pthread_create( &thread_id, &attr, start_gnat_main, NULL );
assert( !status );
pthread_exit( 0 );
return 0;
}
/* configuration information */
#define CONFIGURE_SPTEST
#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
#define CONFIGURE_MICROSECONDS_PER_TICK RTEMS_MILLISECONDS_TO_MICROSECONDS(1)
#define CONFIGURE_POSIX_INIT_THREAD_TABLE
#define CONFIGURE_MAXIMUM_POSIX_THREADS 20
#define CONFIGURE_MAXIMUM_POSIX_KEYS 20
#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 30
#define CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES 20
#define CONFIGURE_INIT
#include <confdefs.h>
More information about the users
mailing list