summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1999-03-01 15:18:26 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1999-03-01 15:18:26 +0000
commite069cdc3f1b5350d19244c0dbf187044ad7f08f7 (patch)
tree7258dcab2a888a5c9d0d48ca4fb46f9b7e58bec6 /c/src/lib/libbsp
parentCorrected the comments on --enable-gcc28 and switched the sense of the (diff)
downloadrtems-e069cdc3f1b5350d19244c0dbf187044ad7f08f7.tar.bz2
Part of the automake VI patch from Ralf Corsepius <corsepiu@faw.uni-ulm.de>:
> 5) rtems-rc-19990202-1.diff/reorg-install.sh > > reorg-install.sh fixes a Makefile variable name clash of RTEMS > configuration files and automake/autoconf standards. > Until now, RTEMS used $(INSTALL) for install-if-change. Automake and > autoconf use $(INSTALL) for a bsd-compatible install. As > install-if-change and bsd-install are not compatible, I renamed all > references to install-if-changed to $(INSTALL_CHANGED) and used > $(INSTALL) for bsd-install (==automake/autoconf standard). When > automake will be introduced install-if-change will probably be replaced > by $(INSTALL) and therefore will slowly vanish. For the moment, this > patch fixes a very nasty problem which prevents adding any automake file > until now (There are still more).
Diffstat (limited to 'c/src/lib/libbsp')
-rw-r--r--c/src/lib/libbsp/shared/main.c6
-rw-r--r--c/src/lib/libbsp/sparc/erc32/Makefile.in3
-rw-r--r--c/src/lib/libbsp/sparc/erc32/gnatsupp/Makefile.in59
-rw-r--r--c/src/lib/libbsp/sparc/erc32/gnatsupp/gnatsupp.c107
-rw-r--r--c/src/lib/libbsp/sparc/erc32/wrapup/Makefile.in2
5 files changed, 174 insertions, 3 deletions
diff --git a/c/src/lib/libbsp/shared/main.c b/c/src/lib/libbsp/shared/main.c
index f413a0628b..a23e2d8a45 100644
--- a/c/src/lib/libbsp/shared/main.c
+++ b/c/src/lib/libbsp/shared/main.c
@@ -30,6 +30,12 @@ extern rtems_cpu_table Cpu_table;
rtems_interrupt_level bsp_isr_level;
+/*
+ * Since there is a forward reference
+ */
+
+int main(int argc, char **argv);
+
int boot_card(int argc, char **argv)
{
int status;
diff --git a/c/src/lib/libbsp/sparc/erc32/Makefile.in b/c/src/lib/libbsp/sparc/erc32/Makefile.in
index 4060625945..41f8963a52 100644
--- a/c/src/lib/libbsp/sparc/erc32/Makefile.in
+++ b/c/src/lib/libbsp/sparc/erc32/Makefile.in
@@ -15,5 +15,4 @@ include $(RTEMS_ROOT)/make/directory.cfg
# wrapup is the one that actually builds and installs the library
# from the individual .rel files built in other directories
-# NOTE: we pick up HPPA clock and timer from libcpu/hppa
-SUB_DIRS=startsis include startup console clock timer wrapup tools
+SUB_DIRS=startsis include startup gnatsupp console clock timer wrapup tools
diff --git a/c/src/lib/libbsp/sparc/erc32/gnatsupp/Makefile.in b/c/src/lib/libbsp/sparc/erc32/gnatsupp/Makefile.in
new file mode 100644
index 0000000000..a35d5470b8
--- /dev/null
+++ b/c/src/lib/libbsp/sparc/erc32/gnatsupp/Makefile.in
@@ -0,0 +1,59 @@
+#
+# $Id$
+#
+
+@SET_MAKE@
+srcdir = @srcdir@
+VPATH = @srcdir@:@srcdir@/../../../shared
+RTEMS_ROOT = @top_srcdir@
+PROJECT_ROOT = @PROJECT_ROOT@
+
+INSTALL = @INSTALL@
+
+PGM=${ARCH}/gnatsupp.rel
+
+# C source names, if any, go here -- minus the .c
+C_PIECES=gnatsupp
+C_FILES=$(C_PIECES:%=%.c)
+C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
+
+H_FILES=
+
+# Assembly source names, if any, go here -- minus the .s
+S_PIECES=
+S_FILES=$(S_PIECES:%=%.S)
+S_O_FILES=$(S_FILES:%.S=${ARCH}/%.o)
+
+SRCS=linkcmds $(C_FILES) $(CC_FILES) $(H_FILES) $(S_FILES)
+OBJS=$(C_O_FILES)
+
+include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg
+include $(RTEMS_ROOT)/make/leaf.cfg
+
+#
+# (OPTIONAL) Add local stuff here using +=
+#
+
+DEFINES +=
+CPPFLAGS +=
+CFLAGS +=
+
+LD_PATHS +=
+LD_LIBS +=
+LDFLAGS +=
+
+#
+# Add your list of files to delete here. The config files
+# already know how to delete some stuff, so you may want
+# to just run 'make clean' first to see what gets missed.
+# 'make clobber' already includes 'make clean'
+#
+
+CLEAN_ADDITIONS +=
+CLOBBER_ADDITIONS +=
+
+${PGM}: ${SRCS} ${OBJS}
+ $(make-rel)
+
+all: ${ARCH} $(SRCS) $(PGM)
+ $(INSTALL_CHANGE) $(srcdir)/linkcmds ${PROJECT_RELEASE}/lib
diff --git a/c/src/lib/libbsp/sparc/erc32/gnatsupp/gnatsupp.c b/c/src/lib/libbsp/sparc/erc32/gnatsupp/gnatsupp.c
new file mode 100644
index 0000000000..79f1f037db
--- /dev/null
+++ b/c/src/lib/libbsp/sparc/erc32/gnatsupp/gnatsupp.c
@@ -0,0 +1,107 @@
+/*
+ *
+ * Support for gnat/rtems machine error exception handling.
+ * Jiri Gaisler, ESA/ESTEC, 17-02-1999.
+ *
+ */
+
+#include <bsp.h>
+#include <signal.h>
+
+/*
+ * Synchronous trap handler. Map the trap number of SIGFPE, SIGSEGV
+ * or SIGILL to generate the corresponding Ada exception.
+ */
+
+rtems_isr __gnat_exception_handler
+ ( rtems_vector_number trap)
+{
+ rtems_unsigned32 real_trap;
+ rtems_unsigned32 signal;
+
+ real_trap = SPARC_REAL_TRAP_NUMBER(trap);
+ switch (real_trap) {
+ case 0x08: /* FPU exception */
+ case 0x0A: /* TAG overflow */
+ case 0x82: /* divide by zero */
+ signal = SIGFPE; /* Will cause Constraint_Error */
+ break;
+ case 0x01: /* Instruction access exception */
+ case 0x09: /* Data access exception */
+ signal = SIGSEGV; /* Will cause Storage_Error */
+ break;
+ default: /* Anything else ... */
+ signal = SIGILL; /* Will cause Program_Error */
+ break;
+ }
+ kill(getpid(),signal);
+}
+
+/*
+ * Asynchronous trap handler. As it happens, the interrupt trap numbers for
+ * SPARC is 17 - 31, so we just map then directly on the same signal.
+ */
+
+rtems_isr __gnat_interrupt_handler
+ ( rtems_vector_number trap)
+{
+ rtems_unsigned32 real_trap;
+
+ real_trap = SPARC_REAL_TRAP_NUMBER(trap);
+
+ kill(getpid(),real_trap);
+
+}
+
+/*
+ * Default signal handler with error reporting
+ */
+
+void __gnat_signals_Abormal_termination_handler( int signo )
+{
+ switch ( signo ) {
+ case SIGFPE:
+ DEBUG_puts("\nConstraint_Error\n");
+ break;
+ case SIGSEGV:
+ DEBUG_puts("\nStorage_Error\n");
+ break;
+ default:
+ DEBUG_puts("\nProgram_Error\n");
+ break;
+ }
+ exit( 1 );
+}
+
+const struct sigaction __gnat_error_vector = {
+ 0, -1, {__gnat_signals_Abormal_termination_handler}};
+
+void __gnat_install_handler()
+{
+ rtems_unsigned32 trap;
+ rtems_isr_entry previous_isr;
+
+ sigaction(SIGSEGV, &__gnat_error_vector, NULL);
+ sigaction(SIGFPE , &__gnat_error_vector, NULL);
+ sigaction(SIGILL , &__gnat_error_vector, NULL);
+
+ for ( trap=0 ; trap<256 ; trap++ ) {
+
+ /*
+ * Skip window overflow, underflow, and flush as well as software
+ * trap 0 which we will use as a shutdown. Also avoid trap 0x70 - 0x7f
+ * which cannot happen and where some of the space is used to pass
+ * paramaters to the program. Trap 0x1d is used by the clock tick
+ * and 0x83 by the remote debugging stub.
+ */
+
+ if (( trap >= 0x11 ) && ( trap <= 0x1f )) {
+ if ( trap != 0x1d )
+ rtems_interrupt_catch( __gnat_interrupt_handler,
+ trap, &previous_isr );
+ } else if (( trap != 5 && trap != 6 && trap != 0x83 ) &&
+ (( trap < 0x70 ) || ( trap > 0x80 )))
+ set_vector( __gnat_exception_handler,
+ SPARC_SYNCHRONOUS_TRAP( trap ), 1 );
+ }
+}
diff --git a/c/src/lib/libbsp/sparc/erc32/wrapup/Makefile.in b/c/src/lib/libbsp/sparc/erc32/wrapup/Makefile.in
index d27b87cafc..73c86d23e9 100644
--- a/c/src/lib/libbsp/sparc/erc32/wrapup/Makefile.in
+++ b/c/src/lib/libbsp/sparc/erc32/wrapup/Makefile.in
@@ -10,7 +10,7 @@ PROJECT_ROOT = @PROJECT_ROOT@
INSTALL = @INSTALL@
-BSP_PIECES=startup console clock timer
+BSP_PIECES=startup console clock timer gnat_supp
# pieces to pick up out of libcpu/sparc
CPU_PIECES=reg_win
GENERIC_PIECES=