summaryrefslogtreecommitdiffstats
path: root/hello_world_ada
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2007-07-17 18:29:37 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2007-07-17 18:29:37 +0000
commit8b09de0188973f13769da25b55657a29188da3e4 (patch)
treecfa5a51fc3bf582f089f5aebf8d33e65e2802d7f /hello_world_ada
parent2007-04-13 Joel Sherrill <joel@OARcorp.com> (diff)
downloadada-examples-8b09de0188973f13769da25b55657a29188da3e4.tar.bz2
2007-07-17 Joel Sherrill <joel.sherrill@oarcorp.com>
* 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.
Diffstat (limited to 'hello_world_ada')
-rw-r--r--hello_world_ada/Makefile.anybsp42
-rw-r--r--hello_world_ada/Makefile.erc3242
-rw-r--r--hello_world_ada/Makefile.jmr390441
-rw-r--r--hello_world_ada/Makefile.pc38626
-rw-r--r--hello_world_ada/Makefile.psim42
-rw-r--r--hello_world_ada/init.c15
6 files changed, 64 insertions, 144 deletions
diff --git a/hello_world_ada/Makefile.anybsp b/hello_world_ada/Makefile.anybsp
new file mode 100644
index 0000000..1e97f13
--- /dev/null
+++ b/hello_world_ada/Makefile.anybsp
@@ -0,0 +1,42 @@
+#
+# Makefile for hello world example -- any BSP without special help
+#
+# Directly produces an executable for any BSP which directly runs
+# the format (usually ELF) produced by just linking an application.
+# The executables produced by this Makefile should run on at least the
+# following BSPs:
+# arm/edb7312
+# mips/jmr3904
+# powerpc/psim
+# powerpc/score603e
+# sparc/erc32
+# sparc/sis
+#
+
+MAIN=hello
+
+include $(RTEMS_MAKEFILE_PATH)/Makefile.inc
+
+include $(RTEMS_CUSTOM)
+include $(PROJECT_ROOT)/make/leaf.cfg
+
+ifeq ($(RTEMS_BSP),ep5200)
+LINKARGS+=-qnolinkcmds -T$(RTEMS_LINKCMDS)
+endif
+
+# Tool helpers
+rtemsdir=${RTEMS_MAKEFILE_PATH}
+GNATMAKE=$(AS:as=gnatmake)
+CARGS=-B${rtemsdir}/lib/ -specs bsp_specs -qrtems $(CPU_CFLAGS)
+
+all: init.o
+ $(GNATMAKE) -v -O -gnata -gnatE -gnato $(MAIN) -g \
+ -bargs -Mgnat_main \
+ -largs $(CARGS) $(LINKARGS) init.o
+ $(SIZE) $(MAIN)
+
+init.o: init.c
+ $(CC) $(CFLAGS) $(CPU_CFLAGS) -c init.c
+
+clean:
+ rm -f b~$(MAIN).* *.o *.ali $(MAIN)
diff --git a/hello_world_ada/Makefile.erc32 b/hello_world_ada/Makefile.erc32
deleted file mode 100644
index 26230d4..0000000
--- a/hello_world_ada/Makefile.erc32
+++ /dev/null
@@ -1,42 +0,0 @@
-#
-# Makefile for hello world example
-#
-
-MAIN=hello
-
-# Tool paths
-target=sparc-rtems
-tooldir=/home/joel/gnat-to-test/${target}/
-tooldir=/usr2/tools_install/gnat-3.12p//${target}/
-rtemsdir=${tooldir}/erc32
-
-# Tool names
-GCC=${tooldir}/bin/${target}-gcc
-GNATMAKE=${tooldir}/bin/${target}-gnatmake
-SIZE=${tooldir}/bin/${target}-size
-SIS=${tooldir}/bin/sparc-rtems-sis
-GDB=${tooldir}/bin/sparc-rtems-gdb
-
-CARGS=-B${rtemsdir}/lib/ -specs bsp_specs -qrtems -mcpu=cypress
-
-# -bargs -r
-all: init.o
- $(GNATMAKE) -v -O -gnata -gnatE -gnato $(MAIN) -g \
- -bargs -Mgnat_main \
- -cargs $(CARGS) \
- -largs $(CARGS) init.o
- $(SIZE) $(MAIN)
-
-
-
-init.o: init.c
- $(GCC) -O4 -g -Wall -ansi -fasm $(CARGS) -c init.c
-
-run:
- $(SIS) $(MAIN)
-
-gdb:
- $(GDB) $(MAIN)
-
-clean:
- rm -f b_$(MAIN).c b_$(MAIN).o *.o *.ali $(MAIN)
diff --git a/hello_world_ada/Makefile.jmr3904 b/hello_world_ada/Makefile.jmr3904
deleted file mode 100644
index 8fc1420..0000000
--- a/hello_world_ada/Makefile.jmr3904
+++ /dev/null
@@ -1,41 +0,0 @@
-#
-# Makefile for hello world example
-#
-
-MAIN=hello
-
-# Tool paths
-target=mips-rtems
-tooldir=/opt/rtems/
-rtemsdir=${tooldir}/$(target)/jmr3904
-
-# Tool names
-GCC=${tooldir}/bin/${target}-gcc
-GNATMAKE=${tooldir}/bin/${target}-gnatmake
-SIZE=${tooldir}/bin/${target}-size
-RUN=${tooldir}/bin/mipstx39-rtems-run
-GDB=${tooldir}/bin/mipstx39-rtems-gdb
-
-CARGS=-B$(rtemsdir)/lib/ -specs bsp_specs -qrtems -march=r3900 -G0
-
-# -bargs -r
-all: init.o
- $(GNATMAKE) -v -O -gnata -gnatE -gnato $(MAIN) -g \
- -bargs -Mgnat_main \
- -cargs $(CARGS) \
- -largs $(CARGS) init.o
- $(SIZE) $(MAIN)
-
-
-
-init.o: init.c
- $(GCC) -O4 -g -Wall -ansi -fasm $(CARGS) -c init.c
-
-run:
- $(RUN) $(MAIN)
-
-gdb:
- $(GDB) $(MAIN)
-
-clean:
- rm -f b_$(MAIN).c b_$(MAIN).o *.o *.ali $(MAIN)
diff --git a/hello_world_ada/Makefile.pc386 b/hello_world_ada/Makefile.pc386
index f82cc1c..8bbbca8 100644
--- a/hello_world_ada/Makefile.pc386
+++ b/hello_world_ada/Makefile.pc386
@@ -4,24 +4,22 @@
MAIN=hello
-# Tool paths
-target=i386-rtems
-tooldir=/opt/rtems/
-rtemsdir=${tooldir}/$(target)/pc386
-
-# Tool names
-GCC=${tooldir}/bin/${target}-gcc
-GNATMAKE=${tooldir}/bin/${target}-gnatmake
-SIZE=${tooldir}/bin/${target}-size
-OBJCOPY=${tooldir}/bin/${target}-objcopy
-NM=${tooldir}/bin/${target}-nm
+include $(RTEMS_MAKEFILE_PATH)/Makefile.inc
+
+include $(RTEMS_CUSTOM)
+include $(PROJECT_ROOT)/make/leaf.cfg
+
+# Constants for relocating
HEADERADDR=0x00097E00
START16FILE=$(rtemsdir)/lib/start16.bin
START16ADDR=0x00097C00
RELOCADDR=0x00100000
-CARGS=-B${rtemsdir}/lib/ -specs bsp_specs -qrtems \
+# Tool helpers
+rtemsdir=${RTEMS_MAKEFILE_PATH}
+GNATMAKE=$(AS:as=gnatmake)
+CARGS=-B${rtemsdir}/lib/ -specs bsp_specs -qrtems $(CPU_CFLAGS) \
-Wl,-Ttext,$(RELOCADDR)
all: init.o $(MAIN)
@@ -45,10 +43,8 @@ $(MAIN).exe: init.o
$(rtemsdir)/build-tools/bin2boot -v $(MAIN).bt $(HEADERADDR) \
$(START16FILE) $(START16ADDR) 0 $(MAIN).bin $(RELOCADDR) 0
-
init.o: init.c
- $(GCC) -O4 -g -Wall -ansi -fasm $(CARGS) \
- -DGNAT_MAIN_STACKSPACE=16 -c init.c
+ $(CC) $(CFLAGS) -c init.c
clean:
rm -f b_$(MAIN).c b_$(MAIN).o *.o *.ali $(MAIN)
diff --git a/hello_world_ada/Makefile.psim b/hello_world_ada/Makefile.psim
deleted file mode 100644
index 3e8f09b..0000000
--- a/hello_world_ada/Makefile.psim
+++ /dev/null
@@ -1,42 +0,0 @@
-#
-# Makefile for hello world example
-#
-
-MAIN=hello
-
-# Tool paths
-target=powerpc-rtems
-tooldir=/home/joel/gnat-3.11b/${target}/
-rtemsdir=${tooldir}/rtems/psim
-
-# Tool names
-GCC=${tooldir}/bin/${target}-gcc
-GNATMAKE=${tooldir}/bin/${target}-gnatmake
-SIZE=${tooldir}/bin/${target}-size
-PSIM=${tooldir}/bin/powerpc-rtems-run
-GDB=${tooldir}/bin/powerpc-rtems-gdb
-
-CARGS=-B${rtemsdir}/lib/ -specs bsp_specs -qrtems -mcpu=603
-
-all: init.o
- $(GNATMAKE) -v -O -gnata -gnatE -gnato $(MAIN) -g \
- -bargs -r \
- -cargs $(CARGS) \
- -largs $(CARGS) init.o
- $(SIZE) $(MAIN)
-
-
-
-init.o: init.c
- $(GCC) -O4 -g -Wall -ansi -fasm $(CARGS) -c init.c
-
-run:
- -$(PSIM) -o "/#address-cells 2" \
- -o "/openprom/options/oea-memory-size 4194304" $(MAIN)
- @echo Ignore the return code. It is meaningless.
-
-gdb:
- $(GDB) -x gdb.psim $(MAIN)
-
-clean:
- rm -f b_$(MAIN).c b_$(MAIN).o *.o *.ali $(MAIN)
diff --git a/hello_world_ada/init.c b/hello_world_ada/init.c
index 0aac9a7..a3b2bbd 100644
--- a/hello_world_ada/init.c
+++ b/hello_world_ada/init.c
@@ -14,6 +14,7 @@
#include <assert.h>
#include <pthread.h>
+#include <stdlib.h>
extern rtems_configuration_table BSP_Configuration;
@@ -36,6 +37,7 @@ void *start_gnat_main( void * argument )
{
extern int gnat_main ( int argc, char **argv, char **envp );
+ printk( "Transferring to Ada\n" );
(void) gnat_main ( 0, 0, 0 );
exit( 0 );
@@ -43,12 +45,15 @@ void *start_gnat_main( void * argument )
return 0;
}
+extern size_t _ada_pthread_minimum_stack_size();
+
void *POSIX_Init( void *argument )
{
pthread_t thread_id;
pthread_attr_t attr;
size_t stacksize = _ada_pthread_minimum_stack_size();
int status;
+ printk( "Starting Posix Init thread\n" );
status = pthread_attr_init( &attr );
assert( !status );
@@ -66,6 +71,7 @@ void *POSIX_Init( void *argument )
status = pthread_create( &thread_id, &attr, start_gnat_main, NULL );
assert( !status );
+ printk( "Exiting Posix Init thread\n" );
pthread_exit( 0 );
return 0;
@@ -73,8 +79,8 @@ void *POSIX_Init( void *argument )
/* configuration information */
-#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
-#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_MICROSECONDS_PER_TICK RTEMS_MILLISECONDS_TO_MICROSECONDS(1)
@@ -82,14 +88,15 @@ void *POSIX_Init( void *argument )
#define CONFIGURE_MAXIMUM_SEMAPHORES 10
#define CONFIGURE_GNAT_RTEMS
-/*
#define CONFIGURE_MAXIMUM_ADA_TASKS 20
#define CONFIGURE_MAXIMUM_FAKE_ADA_TASKS 0
+#define CONFIGURE_MEMORY_OVERHEAD (GNAT_MAIN_STACKSPACE)
+/*
#define CONFIGURE_MEMORY_OVERHEAD (256 + GNAT_MAIN_STACKSPACE)
*/
#define CONFIGURE_INIT
-#include <confdefs.h>
+#include <rtems/confdefs.h>