diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2007-07-23 22:11:30 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2007-07-23 22:11:30 +0000 |
commit | 9e6e1e876167f882204371b81718cb16e460d4d8 (patch) | |
tree | 642e8f56c256b7859f2aa862c5ca9c31c9f1e946 | |
parent | 2007-07-17 Joel Sherrill <joel.sherrill@oarcorp.com> (diff) | |
download | ada-examples-9e6e1e876167f882204371b81718cb16e460d4d8.tar.bz2 |
2007-07-23 Joel Sherrill <joel.sherrill@oarcorp.com>
* hello_world_ada/Makefile.anybsp, hello_world_ada/Makefile.pc386,
hello_world_ada/init.c: Clean up.
* hello_world_ada/.cvsiginore, hello_world_ada/README: New files.
* hello_world_ada/Makefile.score603e, hello_world_ada/README.ERC32,
hello_world_ada/README.PSIM, hello_world_ada/gdb.psim: Removed.
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | hello_world_ada/.cvsiginore | 5 | ||||
-rw-r--r-- | hello_world_ada/Makefile.anybsp | 1 | ||||
-rw-r--r-- | hello_world_ada/Makefile.pc386 | 1 | ||||
-rw-r--r-- | hello_world_ada/Makefile.score603e | 38 | ||||
-rw-r--r-- | hello_world_ada/README | 32 | ||||
-rw-r--r-- | hello_world_ada/README.ERC32 | 91 | ||||
-rw-r--r-- | hello_world_ada/README.PSIM | 74 | ||||
-rw-r--r-- | hello_world_ada/gdb.psim | 2 | ||||
-rw-r--r-- | hello_world_ada/init.c | 36 |
10 files changed, 69 insertions, 219 deletions
@@ -1,3 +1,11 @@ +2007-07-23 Joel Sherrill <joel.sherrill@oarcorp.com> + + * hello_world_ada/Makefile.anybsp, hello_world_ada/Makefile.pc386, + hello_world_ada/init.c: Clean up. + * hello_world_ada/.cvsiginore, hello_world_ada/README: New files. + * hello_world_ada/Makefile.score603e, hello_world_ada/README.ERC32, + hello_world_ada/README.PSIM, hello_world_ada/gdb.psim: Removed. + 2007-07-17 Joel Sherrill <joel.sherrill@oarcorp.com> * hello_world_ada/Makefile.anybsp, hello_world_ada/Makefile.pc386, diff --git a/hello_world_ada/.cvsiginore b/hello_world_ada/.cvsiginore new file mode 100644 index 0000000..cf1b678 --- /dev/null +++ b/hello_world_ada/.cvsiginore @@ -0,0 +1,5 @@ +b~hello.adb +b~hello.ads +b~hello.ali +hello +hello.ali diff --git a/hello_world_ada/Makefile.anybsp b/hello_world_ada/Makefile.anybsp index 9020f35..a424f20 100644 --- a/hello_world_ada/Makefile.anybsp +++ b/hello_world_ada/Makefile.anybsp @@ -41,3 +41,4 @@ init.o: init.c clean: rm -f b~$(MAIN).* *.o *.ali $(MAIN) + rm -f *.num *.exe *.obj *.bin *.bt diff --git a/hello_world_ada/Makefile.pc386 b/hello_world_ada/Makefile.pc386 index 542b500..422ad4d 100644 --- a/hello_world_ada/Makefile.pc386 +++ b/hello_world_ada/Makefile.pc386 @@ -49,3 +49,4 @@ init.o: init.c clean: rm -f b_$(MAIN).c b_$(MAIN).o *.o *.ali $(MAIN) + rm -f *.num *.exe *.obj *.bin *.bt diff --git a/hello_world_ada/Makefile.score603e b/hello_world_ada/Makefile.score603e deleted file mode 100644 index 55ac847..0000000 --- a/hello_world_ada/Makefile.score603e +++ /dev/null @@ -1,38 +0,0 @@ -# -# Makefile for hello world example -# - -MAIN=hello - -# Tool paths -tooldir=/avenger/afcc_ada/tools/powerpc-rtems-gnat-3.10p/ -rtemsdir=${tooldir}/rtems/score603e - -# Tool names -GCC=${tooldir}/bin/powerpc-rtems-gcc -GNATMAKE=${tooldir}/bin/powerpc-rtems-gnatmake -SIZE=${tooldir}/bin/powerpc-rtems-size - -CARGS=-B${rtemsdir}/lib/ -specs bsp_specs -qrtems -mcpu=603 -CARGS+=-DGNAT_MAIN_STACKSPACE=100 - -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: - @ echo Must run on the real target - -gdb: - @ echo No real target - -clean: - rm -f b_$(MAIN).c b_$(MAIN).o *.o *.ali $(MAIN) diff --git a/hello_world_ada/README b/hello_world_ada/README new file mode 100644 index 0000000..a57bfda --- /dev/null +++ b/hello_world_ada/README @@ -0,0 +1,32 @@ +# +# $Id$ +# + +The Makefile.anybsp can be used to compile and link an executable +for most BSPs. Some BSPs require extra transformation in order to +download and those may require their own Makefile (e.g. pc386). + +The following is an example of how to build this test: + +export RTEMS_MAKEFILE_PATH=/home/joel/rtems-4.8-work/bsp-install/CPU-rtems4.8/BSP/ +make -f Makefile.anybsp clean all + +This procedure has been used on the following BSPs: + + arm/edb7312 + bfin/eZKit533 + m68k/mcf5206elite + mips/jmr3904 + powerpc/gen5200 + powerpc/psim + sparc/erc32 + sparc/leon2 + sparc/leon3 + sparc/sis + +For the i386/pc386 BSP, you need to use the other Makefile.pc386 similar +to the following: + +export RTEMS_MAKEFILE_PATH=/home/joel/rtems-4.8-work/bsp-install/i386-rtems4.8/pc386/ +make -f Makefile.pc386 clean all + diff --git a/hello_world_ada/README.ERC32 b/hello_world_ada/README.ERC32 deleted file mode 100644 index 59ab0b3..0000000 --- a/hello_world_ada/README.ERC32 +++ /dev/null @@ -1,91 +0,0 @@ -# -# $Id$ -# - -In this directory, there are the following files: - - Makefile - Example Makefile file - README - the file you are reading. - hello.adb - simple hello world file - init.c - RTEMS initialization thread which invokes the Ada main - -The following make stanza are included: - - all - This stanza builds the executable hello. - - run - This invokes the SPARC Instruction Simulator (SIS) on hello. - - gdb - This invokes gdb with the integrated SPARC Instruction - Simulator (SIS) on hello. - - clean - This stanza removes all generated files. - -The tool directory must be in your path for this to work. - -SAMPLE SESSION WITH SIS -======================= - -The following is a sample session with sis: - - $ gmake run - /home/joel/gnat-3.10b/sparc-rtems//bin/sis hello - - SIS - SPARC intruction simulator 2.7.4, copyright Jiri Gaisler 1995 - Bug-reports to jgais@wd.estec.esa.nl - - loading hello: - section .text at 0x02000000 (159152 bytes) - section .data at 0x02026db0 (4384 bytes) - section .bss at 0x02027ed0 (30948 bytes)(not loaded) - serial port A on stdin/stdout - sis> go - resuming at 0x02000000 - Hello World - IU in error mode (257) - 712144 02000800 91d02000 ta 0 - sis> quit - -Note that the user typed "go" to start the executable and "quit" to -exit the simulator. The normal exit message is "IU in error mode (257)" -because the program exits by generating an unhandled trap. - - -SAMPLE SESSION WITH GDB -======================= - -The following is a sample session with sis: - - $ gmake gdb - /home/joel/gnat-3.10b/sparc-rtems//bin/sis-gdb hello - GNU gdb 4.16.1a - Copyright 1996 Free Software Foundation, Inc. - GDB is free software, covered by the GNU General Public License, and you are - welcome to change it and/or distribute copies of it under certain conditions. - Type "show copying" to see the conditions. - There is absolutely no warranty for GDB. Type "show warranty" for details. - This GDB was configured as "--host=i486-linux --target=sparc-erc32-aout"... - - SIS - SPARC instruction simulator 2.7.4 - Bug-reports to Jiri Gaisler ESA/ESTEC (jgais@wd.estec.esa.nl) - serial port A on stdin/stdout - Connected to the simulator. - loading /usr1/rtems/work/tools_ada/example/hello: - section .text at 0x02000000 (159152 bytes) - section .data at 0x02026db0 (4384 bytes) - section .bss at 0x02027ed0 (30948 bytes)(not loaded) - (gdb) run - Starting program: /usr1/rtems/work/tools_ada/example/hello - Hello World - - Program exited normally. - (gdb) quit - -Note that the user typed "run" to start the executable and "quit" to -exit the debugger. Other gdb commands function the same as when gdb -is used natively. - -The program "sis-gdb" is a script which always invokes a command file -to initialize the simulator and load the executable into the simulator's -memory. - - diff --git a/hello_world_ada/README.PSIM b/hello_world_ada/README.PSIM deleted file mode 100644 index afa4ee4..0000000 --- a/hello_world_ada/README.PSIM +++ /dev/null @@ -1,74 +0,0 @@ -# -# $Id$ -# - -In this directory, there are the following files: - - Makefile - Example Makefile file - README - the file you are reading. - hello.adb - simple hello world file - init.c - RTEMS initialization thread which invokes the Ada main - -The following make stanza are included: - - all - This stanza builds the executable hello. - - run - This invokes the PowerPC Simulator (PSIM) on hello. - - gdb - This invokes gdb with the integrated PowerPC Simulator - (PSIM) on hello. - - clean - This stanza removes all generated files. - -The tool directory must be in your path for this to work. - -SAMPLE SESSION WITH PSIM -======================== - -The following is a sample session with psim: - - $ gmake run - - /home/joel/gnat-3.10p/powerpc-rtems//bin/psim hello - Hello World - Hello World - gmake: *** [run] Error 132 - -At this point, programs run under the powerpc-rtems-run command -restart a second time. This is an known problem with the RTEMS PSIM -Board Support Package. - -Note that the powerpc-rtems-run command has no interactive mode. - - -SAMPLE SESSION WITH GDB -======================= - -The following is a sample session with sis: - - $ gmake gdb - /home/joel/gnat-3.10p/powerpc-rtems//bin/psim-gdb hello - GNU gdb 4.16.1a - Copyright 1996 Free Software Foundation, Inc. - GDB is free software, covered by the GNU General Public License, and you are - welcome to change it and/or distribute copies of it under certain conditions. - Type "show copying" to see the conditions. - There is absolutely no warranty for GDB. Type "show warranty" for details. - This GDB was configured as "--host=i486-linux --target=powerpc-unknown-eabi"... - Connected to the simulator. - (gdb) run - Starting program: /usr1/rtems/work/tools_ada/example/hello - Hello World - (gdb) quit - The program is running. Quit anyway (and kill it)? (y or n) y - - -Note that the user typed "run" to start the executable and "quit" to -exit the debugger. Other gdb commands function the same as when gdb -is used natively. - -The program "psim-gdb" is a script which always invokes a command file -to initialize the simulator and load the executable into the simulator's -memory. - - diff --git a/hello_world_ada/gdb.psim b/hello_world_ada/gdb.psim deleted file mode 100644 index 496f1ac..0000000 --- a/hello_world_ada/gdb.psim +++ /dev/null @@ -1,2 +0,0 @@ -tar sim -o "/#address-cells 2" -o "/openprom/options/oea-memory-size 4194304" -load diff --git a/hello_world_ada/init.c b/hello_world_ada/init.c index f417d96..c5914a9 100644 --- a/hello_world_ada/init.c +++ b/hello_world_ada/init.c @@ -4,7 +4,7 @@ * * 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. + * http://www.rtems.com/license/LICENSE. * * $Id$ */ @@ -17,12 +17,19 @@ extern rtems_configuration_table BSP_Configuration; +/* + * Using GNAT's Distributed Systems Annex support requires + * each node in the system to have different pid's. In a + * single CPU RTEMS system, it is always one. This lets the + * user override the RTEMS default. + */ #ifdef GNAT_PID -#include <unistd.h> -pid_t getpid() -{ - return GNAT_PID; -} + #include <unistd.h> + + pid_t getpid() + { + return GNAT_PID; + } #endif /* @@ -44,18 +51,17 @@ void *start_gnat_main( void * argument ) return 0; } -extern size_t _ada_pthread_minimum_stack_size(); - #ifndef GNAT_MAIN_STACKSPACE -#define GNAT_MAIN_STACKSPACE 0 + #define GNAT_MAIN_STACKSPACE 0 #endif + void *POSIX_Init( void *argument ) { pthread_t thread_id; pthread_attr_t attr; size_t stacksize; int status; - printk( "Starting Posix Init thread\n" ); + extern size_t _ada_pthread_minimum_stack_size(); status = pthread_attr_init( &attr ); assert( !status ); @@ -70,29 +76,31 @@ 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; } /* configuration information */ +/* Standard output and a clock tick so time passes */ #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER +/* We want a clock tick every millisecond */ #define CONFIGURE_MICROSECONDS_PER_TICK RTEMS_MILLISECONDS_TO_MICROSECONDS(1) +/* The initialization task is a POSIX Initialization thread with default attributes */ #define CONFIGURE_POSIX_INIT_THREAD_TABLE -#define CONFIGURE_MAXIMUM_SEMAPHORES 10 +/* We are using GNAT/RTEMS with a maximum of 20 Ada tasks and no fake Ada tasks. */ +/* A fake Ada task is a task created outside the Ada run-time that calls into Ada. */ #define CONFIGURE_GNAT_RTEMS #define CONFIGURE_MAXIMUM_ADA_TASKS 20 #define CONFIGURE_MAXIMUM_FAKE_ADA_TASKS 0 +/* Account for any extra task stack size */ #define CONFIGURE_MEMORY_OVERHEAD (GNAT_MAIN_STACKSPACE) #define CONFIGURE_INIT #include <rtems/confdefs.h> - |